error when trying to link libraries - linux

I am trying to compile my c code on linux i386.
I have the sqlite3 library at:
/usr/lib/i386-linux-gnu/libsqlite3.so.0
/usr/lib/i386-linux-gnu/libsqlite3.so.0.8.6
but the linker does not find them. I even specified the path manually with the -L option which I suspect is not necessary:
cc -pthread -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu -L../i386/debug/lib/ ./bin/i386/debug/*.o -lsculib -lpthread -lsqlite3 -o ../i386/debug/bin/myProgram
/usr/bin/ld: cannot find -lsqlite3
collect2: error: ld returned 1 exit status
make: *** [../i386/debug/bin/core] Error 1
any ideas why it does not find them?

Presumably, you also need the header files.
$ sudo apt-get install libsqlite3-dev

Related

Installing Caffe on Linux Mint: /usr/bin/ld: cannot find -lhdf5_hl

Whenever I try installing caffe onto my linux mint machine, I keep getting this:
AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so.1.0.0
/usr/bin/ld: cannot find -lhdf5_hl
/usr/bin/ld: cannot find -lhdf5
collect2: error: ld returned 1 exit status
Makefile:572: recipe for target '.build_release/lib/libcaffe.so.1.0.0' failed
make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1
Do any of you know what I might be doing wrong? Thank you for responding.
If you build caffe using make + Makefile.config, add the location of libhdf5.so (can be retrieved by locate libhdf5.so), for example
/usr/lib/x86_64-linux-gnu/hdf5/serial, to LIBRARY_DIRS variable.
If you use cmake based build, add this path to LD_LIBRARY_PATH and run ldconfig:
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/hdf5/serial:$LD_LIBRARY_PATH
sudo ldconfig

Cross-compiling Snap7 for MIPS with OpenWrt as OS

Currently i'm working on a project to log data out of a Siemens PLC. To achieve this i'm using Snap7. Snap7 (http://snap7.sourceforge.net/) is a communication library.
I've managed to get it work on my linux desktop but when i try to cross-compile the snap7 library i get some errors
The error is generated when linking all of the object files.
g++ -shared -fPIC -o ../bin/mips-openwrt-linux-g++/libsnap7.so #"filelist.txt" -L. -lpthread -lrt -O3
/usr/bin/ld: ../temp/mips-openwrt-linux/sys_snap_msgsock.o: Relocations in generic ELF (EM: 8)
./temp/mips-openwrt-linux/sys_snap_msgsock.o: could not read symbols: File in wrong format
collect2: error: ld returned 1 exit status
make: *** [../bin/mips-openwrt-linux-g++/libsnap7.so] Error 1
If i'm correct i think it's using the wrong linker, it should use the linker of the toolchain located at: openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/
I've also tried to compile the software with mips-openwrt-linux-g++.
Now another error is given:
mips-openwrt-linux-g++ -shared -fPIC -o ../bin/mips-openwrt-linux-g++/libsnap7.so #"filelist.txt" -L. -lpthread -lrt -O3
openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: ../temp/mips-openwrt-linux/sys_snap_msgsock.o: relocation R_MIPS_26 against `close' can not be used when making a shared object; recompile with -fPIC
../temp/mips-openwrt-linux/sys_snap_msgsock.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [../bin/mips-openwrt-linux-g++/libsnap7.so] Error 1
I hope someone is familiar with this error and can help me out.
Thanks in advance.
edit1:
There are some pre-compiled binaries. In the makefiles i changed the CC to my g++ directory. There is no LD flag so i cannot set my linker over there.
Can you cross compile and run a "hello world" program?
What is the output of file ../temp/mips-openwrt-linux/sys_snap_msgsock.o?

Installing mclust R package

I'm having some problems installing mclust into R, getting the message found below, any ideas?
install.packages("mclust")
Installing package into ‘/home/aleferna/R/x86_64-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://www.laqee.unal.edu.co/CRAN/src/contrib/mclust_4.2.tar.gz'
Content type 'application/x-gzip' length 1602272 bytes (1.5 Mb)
opened URL
==================================================
downloaded 1.5 Mb
* installing *source* package ‘mclust’ ...
** package ‘mclust’ successfully unpacked and MD5 sums checked
** libs
gfortran -fpic -O3 -pipe -g -c mclust.f -o mclust.o
gcc -std=gnu99 -shared -o mclust.so mclust.o -llapack -lblas -lgfortran -lm -lquadmath -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status
make: *** [mclust.so] Error 1
ERROR: compilation failed for package ‘mclust’
* removing ‘/home/aleferna/R/x86_64-pc-linux-gnu-library/3.0/mclust’
The downloaded source packages are in
‘/tmp/RtmpOPyKmZ/downloaded_packages’
Warning message:
In install.packages("mclust") :
installation of package ‘mclust’ had non-zero exit status
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
Means that you need to install such libraries, something like:
$ sudo apt-get install liblapack-dev libblas-dev
Or something like that (depends on your gnu/Linux distribution).

Not found z library when compiling zabbix-server

I have a problem with compiling zabbix-server on CentOS 6.2.
Command line is:
./configure --enable-server --with-mysql --with-net-snmp --with-libcurl
--with-jabber --with-ssh2 --with-openipmi --with-ldap --enable-static
But error occures:
checking for main in -lz... no
configure: error: Not found z library;
Full configure output is here: http://pastebin.ru/WmDP7UL0
I already tried to do:
yum install zlib zlib-devel zlib-static zlibrary zlibrary-devel
But it was unsuccessfully.
Thank you for your attention.
UPD. Config log posted here: http://pastebin.ru/WNtQu9eR and shows this error:
configure:7366: checking for main in -lz
configure:7385: gcc -o conftest -g -O2 -rdynamic -static conftest.c -lz -lm -lrt -lresolv >&5
/usr/bin/ld: cannot find -lm
collect2: ld returned 1 exit status
Here's the actual error:
/usr/bin/ld: cannot find -lm
But it is found previously, which points to something else. Check your ulimits to make sure you don't have a low max open file count.

Install kernlab package on R

I'm trying to install kernlab package on R, but I got a whole bunch of error messages, near the end it says:
g++ -shared -L/usr/local/lib64 -o kernlab.so brweight.o ctable.o cweight.o dbreakpt.o dcauchy.o dgpnrm.o dgpstep.o dprecond.o dprsrch.o dspcg.o dtron.o dtrpcg.o dtrqsol.o esa.o expdecayweight.o inductionsort.o kspectrumweight.o lcp.o misc.o msufsort.o solvebqp.o stringk.o stringkernel.o svm.o wkasailcp.o wmsufsort.o -L/usr/lib64/R/lib -lRlapack -L/usr/lib64/R/lib -lRblas -lgfortran -lm -L/usr/lib64/R/lib -lR
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lgfortran
collect2: ld returned 1 exit status
make: * [kernlab.so] Error 1
ERROR: compilation failed for package âkernlabâ
* removing â/usr/lib64/R/library/kernlabâ
The downloaded source packages are in
â/tmp/RtmpzLdUMp/downloaded_packagesâ
Updating HTML index of packages in '.Library'
Making packages.html ... done
Warning message:
In install.packages("kernlab") :
installation of package âkernlabâ had non-zero exit status
I suspect it has something to do gcc-fortran. I'm using SUSE 11 SP1, I have libgfortran43-4.3.4_20091019-47.1 installed, but i wasn't able to figure out how to install gcc-fortran with yast.
Any help is appreciated! Thanks!
I don't use SUSE but a little bit of searching suggests that you can get gcc-fortran from this page: http://software.opensuse.org/package/gcc-fortran

Resources