how to install lex and yacc in fedora? - fedora

I don't know how to install the lex and yacc in the fedora 24. I installed it in the ubuntu 16. Using following commands:
sudo apt-get update
sudo apt-get install flex
sudo apt-get install bison

Is there any reason why
dnf install flex-devel bison-devel
would not do the job?

Solution for those who encountered the below error:
/usr/bin/ld: cannot find -ll
collect2: error: ld returned 1 exit status
OR
/usr/bin/ld: cannot find -lfl
collect2: error: ld returned 1 exit status
step 1:
dnf install flex bison
step 2:
dnf install flex-devel bison-devel
then run it. I had the same issue, installing flex-devel solved it.

Previous answer didn't do the job, but this did:
sudo dnf install flex-devel bison-devel byacc

Related

libpython3.6-dev, libpython3.6 and mysqlclient not installing on ubuntu 18.04

I tried installing mysql client using pip install mysqlclient but ended up as
#include "Python.h"
^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
So I tried installing packages that could detect header file Python.h
For that I tried sudo apt-get install python3.6-dev
But that resulted into
The following packages have unmet dependencies:
python3.6-dev : Depends: python3.6 (= 3.6.6-1~18.04) but 3.6.6-1+xenial1 is to be installed
Depends: libpython3.6-dev (= 3.6.6-1~18.04) but it is not going to be installed
Depends: libpython3.6 (= 3.6.6-1~18.04) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
How to deal with this situation and where the problem lies?
It seems you are having dependency issue. Install libpython3.6-dev then python3.6-dev and mysql. After that I hope you will be able to install mysqlclient.
sudo apt install libpython3.6-dev
sudo apt install python3.6-dev
sudo apt instal mysql-server
Then you will be able to install mysqlclient.
**if this does not happen it's good to uninstall and reinstall the python3.6 because many people got solution in this way. You can can see here
You may use following commands to do that and repeat those above commands.
sudo apt purge libpython3*
sudo apt-get purge python3.6
sudo apt-get autoremove && sudo apt-get autoclean
sudo apt-get install python3.6*
Hope it will sove your problem.

Installation of MySQL 5.7 on Debian 7 Wheezy

I would like to install MySql 5.7 on Debian 7 Wheezy. I put :
deb http://repo.mysql.com/apt/debian/ wheezy mysql-5.7
in file:
/etc/apt/sources.list.d/mysql.list
Next I run commands:
sudo apt-get update
sudo apt-get upgrade
And tried install package:
sudo apt-get install mysql-server-5.7
I got an error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'mysql-community-server' instead of 'mysql-server-5.7'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mysql-community-server : Depends: mysql-common (= 5.7.11-1debian7) but 5.5.47-0+deb7u1 is to be installed
Depends: mysql-client (= 5.7.11-1debian7)
E: Unable to correct problems, you have held broken packages.
Do you have any ideas to resolve this problem?
I also tried:
Note, selecting 'mysql-community-server' instead of 'mysql-server-5.7'
But it's not the solution of the problem.
I stumbled upon this post and can confirm simply changing the priority of your cache by downloading the .deb package directly from MySQL Downloads
Using the command line:
$ cd /usr/src && sudo wget http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
Please note: by convension the /src directory on linux exists for source code to live before being compiled - I believe the deb package above therefore belongs here.
This works for Debian/Wheezy.
$ sudo dpkg -i http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
Once this you have gone through the steps, you simply hit Ok, and then proceed to install mysql-server like normal:
$ sudo apt-update
$ sudo apt-get install mysql-server
For me, this resulted in the following:
[info] MySQL Community Server 5.7.14 is started.
Setting up mysql-server (5.7.14-1debian7) ...
Further reading, if you ever want to remove this package, you can do so:
$ cd /usr/src && sudo dpkg --remove http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
As of 2020 with Debian Wheezy 7.11 the answer doesn't work anymore. I had to change a few things and thought it might be useful to share the result:
Install mysql-apt-config_0.8.10-1_all.deb (Version 0.8.15-1_all won't work: dpkg can't handle the "control.tar.xz" it contains.)
cd /usr/src
sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb
This will create the necessary /etc/apt/sources.list.d/mysql.list file.
sudo apt-get update
sudo apt-get install mysql-server
Thanks goes to David Kehr from where I got the working mysql-apt-config version.
You don't need to specify the version in the apt-get command, just type :
sudo apt-get install mysql-server
After the install, you can type the following command to check mysql version
aptitude show mysql-server
On my machine I have the following result :
...
VersionĀ : 5.7.13-1debian7
...

Error when trying to install app with mysql2 gem

Im trying to install an open source rails 3.2.21 application that uses the mysql2 gem, but when i try and run the bundle commant I get the following error:
Fetching: mysql2-0.3.18.gem (100%)
Building native extensions. This could take a while...
p
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Users/my_username/.rvm/rubies/ruby-2.1.2/bin/ruby -r ./siteconf20150614-72129-orqsb7.rb extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
-----
Using mysql_config at /usr/local/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load
-----
-----
Setting libpath to /usr/local/Cellar/mysql/5.6.25/lib
-----
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling client.c
compiling infile.c
compiling mysql2_ext.c
compiling result.c
linking shared-object mysql2/mysql2.bundle
ld: warning: directory not found for option '-L/Users/travis/.sm/pkg/active/lib'
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mysql2.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/my_username/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/mysql2-0.3.18 for inspection.
Results logged to /Users/my_username/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/extensions/x86
I tried uninstalling every version of mysql I installed via homebrew and reinstalling them, like so:
brew uninstall --force mysql && brew install mysql
Then running:
sudo gem install mysql2
As suggested by a number of similar questions asked on here, but it still results in the same error as above.
Please could someone offer guidance on how to get this up and running?
For anybody still experiencing the issue:
When you install openssl via brew, you should get the following message:
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig
You can set these build flags (for the local application) by running the following:
bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include"
This worked for me.
See bundler's documentation for more information.
The error log says:
ld: library not found for -lssl
So, you need to install libssl:
brew install openssl
As it was pointed out in comments, there might be a need to export the path to the library.
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
Try this:
gem install mysql2 -v '0.5.2' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include
(Update version as appropriate)
The solution for me was to install the Xcode Command Line Tools.
I had recently updated Xcode through the Mac App Store, and every time I do that, I've found that I have to reinstall the Command Line Tools again.
xcode-select --install
Based on the solution here
brew install openssl
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
solved the problem.
After Homebrew update (openssl#1.1) there is a new path for libs, so may use:
bundle config build.mysql2 --with-opt-dir=$(brew --prefix openssl)
bundle install
It will fix ld: library not found for -lssl error
Thanks #mudasobwa for pointing me in the right direction. It turns out the error was caused by an unlinked openssl file, so running:
brew reinstall openssl && brew link openssl --force
Solved the problem. I found the solution here: OpenSSL, RVM, Brew, conflicting error
On MacBook air M1(macOS) it worked for me.
Install zstd
brew install zstd
Install mysql2
gem install mysql2 -v '0.5.3' -- --with-opt-dir=$(brew --prefix openssl) --with-ldflags=-L/opt/homebrew/Cellar/zstd/1.5.0/lib
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
From here:
https://gorails.com/setup/osx/10.14-mojave
The combination of commands solved it me. I am on Mojave.
brew reinstall openssl && brew link openssl --force
and then
gem install mysql2 -v '0.4.10' -- \
--with-ldflags=-L/usr/local/opt/openssl/lib \
--with-cppflags=-I/usr/local/opt/openssl/include
Steps for me on Monterey M1 Mac
brew install openssl#3
brew install zstd
gem install mysql2 -v '0.5.3' -- --with-opt-dir=$(brew --prefix openssl) --with-ldflags=-L/opt/homebrew/Cellar/zstd/1.5.0/lib
bundle config --local build.mysql2 "--with-opt-dir=$(brew --prefix openssl) --with-ldflags=-L/opt/homebrew/Cellar/zstd/1.5.0/lib"
bundle install
Seems that you miss the main files needed to build mysql2 gem
sudo apt-get install libsqlite3-dev libmysqlclient-dev -y
libsqlite3-dev is not mandatory but install it since it's the default rails DB.
Mac Catalina using Homebrew fix:
gem install mysql2 -- --with-opt-dir="$(brew --prefix openssl)"
the following command works for my Mac os 12.1 MacOs Monterey
gem install mysql2 -v '0.5.3' -- \
--with-mysql-lib=/opt/homebrew/Cellar/mysql/8.0.28/lib \
--with-mysql-dir=/opt/homebrew/Cellar/mysql/8.0.28 \
--with-mysql-config=/opt/homebrew/Cellar/mysql/8.0.28/bin/mysql_config \
--with-mysql-include=/opt/homebrew/Cellar/mysql/8.0.28/include
Please refer this link for more details
https://github.com/brianmario/mysql2/issues/1175
This finally worked for me on macOS Monterey 12.3 (M1 Pro):
gem install mysql2 -- --with-mysql-dir=/opt/homebrew/Cellar/mysql/8.0.28_1
Make sure you read the installation instructions. Notable points for me were:
Make sure MySQL is installed (brew install mysql)
Make sure XCode select tools are installed (xcode-select --install)
Set the with-mysql-dir option to wherever mysql was installed (check with brew info mysql)
Combining the answers given by Aleksei Matiushkin and Alexey Mozorov fixed the problem for me.
But I also updated the openssl before adding the path.
Thanks!
I've been coding with mysql2 gem for years and have encountered with this issue time to time.
Today I found that this magic option -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include no longer worked on my Mac. Indeed, it looks like the default location where brew installs openssl has changed:
$ brew reinstall openssl
...
If you need to have openssl#3 first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/openssl#3/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl#3 you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/openssl#3/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl#3/include"
So following the message, I had to make a few changes to the command and got it work finally:
$ gem install mysql2 -v '0.5.3' -- --with-ldflags=-L/opt/homebrew/opt/openssl#3/lib --with-cppflags=-I/opt/homebrew/opt/openssl#3/include
Hope this will help someone!
This helped me on MacOs 12.6 (Monterey)
brew install mysql openssl
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
gem install mysql2 -v '0.5.3' \
--source 'https://rubygems.org/' -- \
--with-cppflags=-I/usr/local/opt/openssl/include \
--with-ldflags=-L/usr/local/opt/openssl/lib
bundle install
Thanks https://github.com/brianmario/mysql2/issues/1175#issuecomment-1069721834
I found that I had to use --with-opt-dir=/usr/local/opt.
Specifically, I added the following to my ~/.bundle/config file:
BUNDLE_BUILD__MYSQL2: "--with-opt-dir=/usr/local/opt"

Compiler error mysql.h not found

On compiling a software I get this error
mysql/mysql.h: No such file or directory
result of running mysql_config --include is
-I/usr/local/mysql/include
How can I get mysql.h to be detected?
Install mysql development packages on Debian/ubuntu.
sudo apt-get install libmysqld-dev
on CentOs/Redhat (to know who provide - yum provides mysql/mysql.h):
sudo yum install mysql-devel
While building Kamailio from sources on CentOS / Fedora, I encountered mysql/mysql.h: No such file or directory
Since my target was MariaDB, installing mariadb-devel package helped
# yum -y install mariadb-devel
Before installing above package, it was necessary for me to clean-up previously installed MariaDB-client package.
# yum remove MariaDB-client
# yum remove MariaDB-common
# mv /etc/yum.repos.d/mariadb.repo /etc/yum.repos.d/mariadb.repo.bak
If necessary we can get back the original MariaDB-client package after the build process, such as
# mv /etc/yum.repos.d/mariadb.repo.bak /etc/yum.repos.d/mariadb.repo
# yum -y install MariaDB-client

Problem with compiling n-body simulation with CUDA

I have a linux ubuntu 10.04 LTS freshly installed on my x64 PC, and I just followed this step-by-step installation guide to install NVidia CUDA on my PC. But when I cd into ~/NVIDIA_GPU_Computing_SDK/C/src/nbody and try to make the nbody simulation, it just prints out:
/usr/bin/ld: cannot find -lGL
collect2: ld returned 1 exit status
make: *** [../../bin/linux/release/nbody] Error 1
Is this a solvable problem?
I'm a newbie in Linux (and in Cuda programming) so please help me understanding.
cd /usr/lib/
ls -la | grep libGL.so
if libGL.so exists
sudo rm libGL.so
then run
sudo ln -s libGL.so.270.41.19 libGL.so
or whatever version of libGL.so you have
Use the Synaptic Package Manager and install the packages with libgl, libglu, libglut, etc. For example, libgl1-mesa and all its dev variants, freeglut, etc.
sudo apt-get install build-essential x-window-system-dev
will also get you the vast majority of those.