I'm having problems using qemu on Ubuntu
hoan#hoan-pfiev09:~$ qemu-system-aarch64
qemu-system-aarch64: symbol
lookup error: qemu-system-aarch64: undefined symbol:
libusb_free_streams hoan#hoan-pfiev09:~$
(Actually the command I want to run: qemu-system-aarch64 -m 1024 -cpu cortex-a57 -M virt -nographic -kernel openwrt-arm64-qemu-virt.Image)
Although I installed libusb with the command sudo apt-get install libusb-1.0-0-dev, but can not fix this.
hoan#hoan-pfiev09:~$ ldd /usr/bin/qemu-system-aarch64 | grep usb libusb-1.0.so.0 => /usr/local/lib/libusb-1.0.so.0 (0x00007f2bc8849000) libusbredirparser.so.1 => /usr/lib/x86_64-linux-gnu/libusbredirparser.so.1 (0x00007f2bc8641000) hoan#hoan-pfiev09:~$
How to fix this?
hoan#hoan-pfiev09:~$ ldd /usr/bin/qemu-system-aarch64 |grep usb libusb-1.0.so.0 => /usr/local/lib/libusb-1.0.so.0 (0x00007f705b013000) libusbredirparser.so.1 => /usr/lib/x86_64-linux-gnu/libusbredirparser.so.1 (0x00007f705ae0b000) hoan#hoan-pfiev09:~$ hoan#hoan-pfiev09:~$ hoan#hoan-pfiev09:~$ ls /usr/local/lib/libusb-1.0.* -lia 14156758 -rw-r--r-- 1 root root 598258 7月 23 19:25 /usr/local/lib/libusb-1.0.a 14156755 -rwxr-xr-x 1 root root 954 7月 23 19:25 /usr/local/lib/libusb-1.0.la 14156754 lrwxrwxrwx 1 root root 19 7月 23 19:25 /usr/local/lib/libusb-1.0.so -> libusb-1.0.so.0.1.0 14156753 lrwxrwxrwx 1 root root 19 7月 23 19:25 /usr/local/lib/libusb-1.0.so.0 -> libusb-1.0.so.0.1.0 14156267
-rwxr-xr-x 1 root root 343240 7月 23 19:25 /usr/local/lib/libusb-1.0.so.0.1.0 hoan#hoan-pfiev09:~$
hoan#hoan-pfiev09:~$ strings /usr/local/lib/libusb-1.0.a | grep libusb_free_streams hoan#hoan-pfiev09:~$
add more infor
hoan#hoan-pfiev09:~$ ldd /usr/bin/qemu-system-aarch64 | grep usb
libusb-1.0.so.0 => /usr/local/lib/libusb-1.0.so.0
(0x00007f00a6281000) libusbredirparser.so.1 =>
/usr/lib/x86_64-linux-gnu/libusbredirparser.so.1 (0x00007f00a6079000)
hoan#hoan-pfiev09:~$
This error also fixed by command
hoan#hoan-pfiev09:~$ sudo ldconfig /lib/x86_64-linux-gnu/
Thanks for reading my question.
I found the answer
[https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=711589][1]
there was a link library is incorrect here.
Fixed by command:
sudo ln -sf /lib/x86_64-linux-gnu/libusb-1.0.so.0 /usr/local/lib/libusb-1.0.so.0
I've seen things similar to this several times. My self-educated guess would be that in fact this specific package of QEMU requires a fresher version of libusb. So the solution would be to upgrade your libusb to latest version. Or at least to the version that satisfies your installation of QEMU.
Also, the library name is often a symbolic link to the specific library version. You may have a fresher version of the library installed, but the link would still point to an older version. Please check your libusb libraries in /usr/local/lib/, and check the link /lib/XXX/libusb-1.0.so.
Related
I have Ubuntu 20.04 and python 3.10.6 on WSL.
I have been trying to install airflow, and am getting 'airflow: command not found' when I'm trying to do 'airflow initdb' or 'airflow info'.
I have done
export AIRFLOW_HOME=~/airflow
and when I run
myname#LAPTOP-28BMMQV7:/root$ ls -l ~/.local/bin
I can see airflow in the list of files.
drwxrwxr-x 2 myname myname 4096 Nov 20 14:17 __pycache__
-rwxrwxr-x 1 myname myname 3472 Nov 20 14:17 activate-global-python-argcomplete
-rwxrwxr-x 1 myname myname 215 Nov 20 14:17 airflow
-rwxrwxr-x 1 myname myname 213 Nov 20 14:17 alembic
when I run this command to see where my python is, I can see this
myname#LAPTOP-28BMMQV7:/root$ ls -l /usr/bin/python*
lrwxrwxrwx 1 root root 10 Aug 18 11:39 /usr/bin/python3 -> python3.10
lrwxrwxrwx 1 root root 17 Aug 18 11:39 /usr/bin/python3-config -> python3.10-config
-rwxr-xr-x 1 root root 5912936 Nov 2 18:53 /usr/bin/python3.10
I also warnings similar to this:
WARNING: The script pygmentize is installed in '/home/myname/.local/bin' which is not on PATH.
So I need to find a way to add this directory to PATH.
I have found the following advice from the airflow documentation,
If the airflow command is not getting recognized (can happen on Windows when using WSL), then ensure that ~/.local/bin is in your PATH environment variable, and add it in if necessary:
PATH=$PATH:~/.local/bin
am not quite sure how to do it?
I also have a MySQL workbench/server 8.0.31 installed and want to connect it to airflow instead of SQLite. can anybody refer me to a good guide on how to install it correctly?
I have run 'pip install 'apache-airflow[mysql]'.
You were so close! I think your local python (and your terminal whenever you tried airflow db init ) was not able to see the airflow you installed on its path.
There is this video series I go to, whenever I need to install Airflow for a fellow coworker.
This video shows how to install Airflow locally. Also, in the second video it shows how to write a DAG.
And more importantly, on the third video it shows how to connect to a different database just like you wanted.
The site I administer has some CGI scripts that run scripts of the form:
#!/usr/bin/env bash
perl my-script.pl
my-script.pl uses DBD::mysql.
use DBD::mysql;
My scripts use many CPAN modules and I do not want to pollute the "system" Perl (5.16) installed by the Linux distro. Our security policy requires that httpd run as user "apache" and that apache not have a home directory on our server, so my solution has been to install Perl with perlbrew under a different home dir I have access to. Then the Apache config file for the virtual host sets some env vars to access it.
SetEnv PATH /export/home/user1/perl5/perlbrew/perls/perl-5.30.2/bin:${PATH}
SetEnv PERL5LIB /export/home/user1/perl5/perlbrew/perls/perl-5.30.2/lib # this may not be needed
This works well-enough for loading most modules. For example, apache can run:
perl -mDateTime -e 'print $DateTime::VERSION' # prints "1.52"
but if apache attempts:
perl -mDBD::mysql -e 'print $DBD::mysql::VERSION'
it barfs:
Can't locate loadable object for module DBD::mysql in #INC (#INC contains: /export/home/user1/perl5/perlbrew/perls/perl-5.30.2/lib/site_perl/5.30.2/x86_64-linux /export/home/user1/perl5/perlbrew/perls/perl-5.30.2/lib/site_perl/5.30.2 /export/home/user1/perl5/perlbrew/perls/perl-5.30.2/lib/5.30.2/x86_64-linux /export/home/user1/perl5/perlbrew/perls/perl-5.30.2/lib/5.30.2) at -e line 0.
Compilation failed in require.
BEGIN failed--compilation aborted.
The error message "Can't locate ..." is misleading. I confirmed that DBD::mysql is available from the 3rd path in #INC:
$ find ~user1/perl5/perlbrew/perls/perl-5.30.2/lib/site_perl/5.30.2 -name mysql -ls
16540213 4 drwxr-x--- 2 user1 user1 4096 Apr 21 12:51 /export/home/user1/perl5/perlbrew/perls/perl-5.30.2/lib/site_perl/5.30.2/x86_64-linux/auto/DBD/mysql
16540211 4 drwxr-xr-x 2 user1 user1 4096 Apr 21 11:26 /export/home/user1/perl5/perlbrew/perls/perl-5.30.2/lib/site_perl/5.30.2/x86_64-linux/DBD/mysql
Furthermore, user1 can load DBD::mysql with no problem:
perl -mDBD::mysql -e 'print $DBD::mysql::VERSION' # prints 4.050
Therefore, I suspect that the above error message should have read "Can't load libmysqlclient.so ..."
libmysqlclient.so is located in /usr/lib64/mysql/
ls -l /usr/lib64/mysql/
total 3076
lrwxrwxrwx 1 root root 17 Apr 16 11:59 libmysqlclient_r.so -> libmysqlclient.so
lrwxrwxrwx 1 root root 20 Apr 16 11:59 libmysqlclient.so -> libmysqlclient.so.18
lrwxrwxrwx 1 root root 24 Apr 16 11:57 libmysqlclient.so.18 -> libmysqlclient.so.18.0.0
-rwxr-xr-x 1 root root 3135664 Aug 18 2019 libmysqlclient.so.18.0.0
-rwxr-xr-x 1 root root 6758 Aug 18 2019 mysql_config
drwxr-xr-x. 2 root root 4096 Apr 16 11:57 plugin
If user1 runs perl -V, the Linker and Dynamic Linking sections show the following:
Linker and Libraries:
ld='cc'
ldflags =' -fstack-protector-strong -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64 /usr/local/lib64
libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
libc=libc-2.17.so
so=so
useshrplib=false
libperl=libperl.a
gnulibc_version='2.17'
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=so
d_dlsymun=undef
ccdlflags='-Wl,-E'
cccdlflags='-fPIC'
lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'
If I run this same perl as apache, it will produce the same result:
sudo -u apache bash
PATH=~user1/perl5/perlbrew/perls/perl-5.30.2/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin
perl -V
...
Linker and Libraries:
ld='cc'
ldflags =' -fstack-protector-strong -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64 /usr/local/lib64
libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
libc=libc-2.17.so
so=so
useshrplib=false
libperl=libperl.a
gnulibc_version='2.17'
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=so
d_dlsymun=undef
ccdlflags='-Wl,-E'
cccdlflags='-fPIC'
lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'
How come user1 perl can load DBD::mysql but apache can't even though both are running the same Perl with the same #INC paths and their dynamic library loading paths look identical? Does anyone know what else can I do to get to the bottom of this?
For starters, you should never do
SetEnv PERL5LIB /export/home/user1/perl5/perlbrew/perls/perl-5.30.2/lib
If you use .../perl-5.30.2/bin/perl, it will know to look in .../perl-5.30.2/lib, and that's the only perl that should look in that directory.
Ideally, you wouldn't do the following either:
SetEnv PATH /export/home/user1/perl5/perlbrew/perls/perl-5.30.2/bin:${PATH}
The shebang of the script should point to the perl it's meant to use (the one with which it was tested and known to work).
In other words, use the following in the bash script:
./my-script.pl
And use the following shebang in my-script.pl:
#!/export/home/user1/perl5/perlbrew/perls/perl-5.30.2/bin/perl
What you are currently doing isn't terrible, but could bite you if you try to upgrade something.
Finally, perl can't find the module because of permission issues. Assuming the apache user isn't a member of the user1 group, you showed that apache user can't access lib/site_perl/5.30.2/x86_64-linux/auto/DBD/mysql (and it might not be able access other pertinent files either).
Fix:
chmod go+X \
/export \
/export/home \
/export/home/user1\
/export/home/user1/perl5 \
/export/home/user1/perl5/perlbrew \
/export/home/user1/perl5/perlbrew/perls
chmod -R go+rX /export/home/user1/perl5/perlbrew/perls/perl-5.30.2
rake aborted!
dlopen(/Users/ava/.rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/lib/libmysqlclient.18.dylib
Referenced from: /Users/ava/.rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/ava/.rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle`
Ran the following to resolve:
$ sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib \
/usr/lib/libmysqlclient.18.dylib
ln: /usr/lib/libmysqlclient.18.dylib: File exists
My setup:
OSX 10.8.4
MySQL 5.1.71
libmysqlclient.16.dylib
$ locate libmysqlclient.16.dylib
/usr/lib/libmysqlclient.16.dylib
/usr/local/Cellar/mysql51/5.1.71/lib/mysql/libmysqlclient.16.dylib
libmysqlclient.18.dylib
$ locate libmysqlclient.18.dylib
/usr/lib/libmysqlclient.18.dylib
In .bash_profile, I have
export PATH="/usr/local/bin:$HOME/.rvm/bin:$HOME/bin:$PATH"
export DYLD_LIBRARY_PATH=/usr/local/bin/mysql
How to get this rake running? Am I supposed to have libmysqlclient.18.dylib under /usr/local/Cellar/mysql51/5.1.71/lib/mysql too? If yes, how do I create it?
Sorry, if I am mistaken; there is no Mac to check in details.
The error message clearly states, that the library mysql wants is:
/usr/local/lib/libmysqlclient.18.dylib
while the library you have is:
/usr/lib/libmysqlclient.18.dylib
That definitely means, that your mysql installation is somehow broken, but for the quick patch I would recommend soft linking:
$ sudo ln -s /usr/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib
You have likely misplaced arguments within your first solution try.
Instruct Mac OS X to find it as follows, if you are using Bash:
In your ~/.bash_profile:
export DYLD_LIBRARY_PATH=<location of mysqlclient.18.dylib>:$DYLD_LIBRARY_PATH
Restart terminal.
For example, I have the following:
$ ls -ld /usr/local/m*
lrwxr-xr-x 1 root admin 27 May 5 14:28 /usr/local/mysql -> mysql-5.6.13-osx10.7-x86_64
drwxr-xr-x 3 root wheel 102 May 5 13:13 /usr/local/mysql-5.5.29-osx10.6-x86
drwxr-xr-x 17 root wheel 578 May 5 13:13 /usr/local/mysql-5.6.13-osx10.7-x86_64
$ head ~/.bash_profile
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
On an Amazon EC2 (uname -r gives "3.4.37-40.44.amzn1.x86_64", which I hear is based on Cent OS) I tried installing:
yum install mysql
yum install mysql-devel
And even
yum install mysql-libs
(Due to this thread.)
I'm trying to compile a program and link the MySQL libraries to it. This works fine on my Mac, (but the Mac has libmysqlclient.a). libmysqlclient.a is absolutely nowhere to be found on this machine. All it has is libmysqlclient.so, and many versions of it too.
$ sudo find / -name libmysqlclient*
Gives
/usr/lib64/mysql/libmysqlclient_r.so
/usr/lib64/mysql/libmysqlclient.so
/usr/lib64/mysql/libmysqlclient.so.18
/usr/lib64/mysql/libmysqlclient.so.18.0.0
/etc/alternatives/libmysqlclient
/etc/alternatives/libmysqlclient_r
And
ls -l /usr/lib64/mysql
Gives
lrwxrwxrwx 1 root root 34 Apr 11 19:21 libmysqlclient_r.so -> /etc/alternatives/libmysqlclient_r
lrwxrwxrwx 1 root root 32 Apr 11 19:21 libmysqlclient.so -> /etc/alternatives/libmysqlclient
lrwxrwxrwx 1 root root 24 Apr 11 18:24 libmysqlclient.so.18 -> libmysqlclient.so.18.0.0
-rwxr-xr-x 1 root root 2983360 Mar 14 10:09 libmysqlclient.so.18.0.0
-rwxr-xr-x 1 root root 11892 Mar 14 09:12 mysqlbug
-rwxr-xr-x 1 root root 7092 Mar 14 10:08 mysql_config
So the only real file is libmysqlclient.so.18.0.0.
The compiler command:
g++ main.cpp -L/usr/lib64/mysql -lmysqlclient.so.18.0.0
Fails with
/usr/bin/ld: cannot find -lmysqlclient.so.18.0.0
collect2: ld returned 1 exit status
So somebody is lying or I got completely ripped off at the YUM repo and was not given my libmysqlclient.a like I was supposed to.
(I avoided using the many symlinks on the system so I could eliminate possible issues).
bobobobo! You are so wrong.
First of all, you don't need a libmysqlclient.a file, when you have the .so file. The .a file is for static linking, .so file for dynamic linking.. .so files are decidely better and make you cool.
The problem you get when you try and compile without library link is
g++ main.cpp
Gives
undefined reference to `mysql_init'
But that can be fixed with
g++ main.cpp `mysql_config --cflags --libs`
When you use .so, they are linked a run-time. This makes your compiled code smaller. Not usually big deal these days. The really great feature is that when you update your system, and the library gets updated, you will link in the new (and hopefully) better library. The updates often contain bug fixes and security fixes. Possibly performance improvements. Therefore they make your code more cool and, indirectly, make you a little bit more cool.
I am trying to run a Rails two app with Ubuntu 10.04 server, sphinx, myql2 version 0.2.7 and percona server 5.5 (Myslql 5.5). mysql2 in irb works ok, I can connect to the db. this rails 2 app is working in another Centos server with MySql 5.1. When I run:
script/server -e production
I get:
mysql2.so: libmysqlclient_r.so.15: cannot open shared object file: No such file or directory
here are the libs I have:
# ls -l /usr/lib |grep sql
-rw-r--r-- 1 root root 10581008 2011-11-18 16:51 libmysqlclient.a
lrwxrwxrwx 1 root root 16 2011-12-10 05:48 libmysqlclient_r.a -> libmysqlclient.a
lrwxrwxrwx 1 root root 20 2011-12-10 05:48 libmysqlclient.so -> libmysqlclient.so.16
lrwxrwxrwx 1 root root 29 2011-12-10 06:01 libmysqlclient.so.15 -> /usr/lib/libmysqlclient.so.16
-rw-r--r-- 1 root root 7332 2011-11-18 16:44 libmysqlservices.a
-rw-r--r-- 1 root root 562520 2010-02-08 06:59 libsqlite3.a
-rw-r--r-- 1 root root 973 2010-02-08 06:59 libsqlite3.la
lrwxrwxrwx 1 root root 19 2011-12-07 17:15 libsqlite3.so -> libsqlite3.so.0.8.6
lrwxrwxrwx 1 root root 19 2011-03-09 18:43 libsqlite3.so.0 -> libsqlite3.so.0.8.6
-rw-r--r-- 1 root root 528668 2010-02-08 06:59 libsqlite3.so.0.8.6
drwxr-xr-x 3 root root 4096 2011-12-10 05:47 mysql
How can I fix it?
If you encounter this error again after upgrading to 12.04 (or for people arriving here after googling the title of this page after upgrading to 12.04), the following worked for me:
gem uninstall mysql2
gem install mysql2
This will recompile the gem using libmysqlclient18, and worked for me.
You need to install the development libraries. Try
sudo apt-get install libmysqlclient20-dev
or
sudo apt-get install libmysqlclient19-dev
Install the mysql client libraries: apt-get install libmysqlclient16
I had this error with mysql-python and solved this using pip:
pip uninstall mysql-python
pip install mysql-python
Another option that has not been mentioned here, but has been answered in this question. Is that you have to install MySQL-python with the --no-binary option. This question is a lot easier to find, so I'm adding the answer here for reference:
First uninstall your current version of MySQL-python:
pip uninstall MySQL-python
Then install MySQL-python with the --no-binary parameter:
pip install --no-binary MySQL-python MySQL-python
After updated to Ubuntu 19.10. I got the error:
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: libmysqlclient.so.20: cannot open shared object file: No such file or directory
Solution:
1) activate your virtualenv
2) (yourvirtualenv) pip uninstall mysqlclient
3) (yourvirtualenv) pip install mysqlclient
If you are running Ubuntu/Debian, the correct solution is to install libmariadb-dev-compat and rebuild (with MariaDB 10.3+).