I'm building Virtuoso Opensource after doing ./configure --enable_mono - works fine. Calling make then gives me an error, because libgc is not found.
make[2]: Entering directory `/usr/local/src/virtuoso-opensource/libsrc/Thread'
/bin/bash ../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../libsrc/Dk -fno-strict-aliasing -O2 -DMONO_USE_EXC_TABLES -fexceptions -D_REENTRANT -D_GNU_SOURCE -Wall -DNDEBUG -DPOINTER_64 -I/usr/local/src/virtuoso-opensource/libsrc/Xml.new -DOPENSSL_NO_KRB5 -Dlinux -D_GNU_SOURCE -DFILE64 -D_LARGEFILE64_SOURCE -I../../binsrc/mono/mono-1.1.7/libgc/include -I../../libsrc -I../../libsrc/Dk -DNO_UDBC_SDK -DUSE_INCLUDED_LIBGC=1 -g -O2 -MT libthrp_gc_la-sched_pthread_gc.lo -MD -MP -MF .deps/libthrp_gc_la-sched_pthread_gc.Tpo -c -o libthrp_gc_la-sched_pthread_gc.lo `test -f 'sched_pthread_gc.c' || echo './'`sched_pthread_gc.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../libsrc/Dk -fno-strict-aliasing -O2 -DMONO_USE_EXC_TABLES -fexceptions -D_REENTRANT -D_GNU_SOURCE -Wall -DNDEBUG -DPOINTER_64 -I/usr/local/src/virtuoso-opensource/libsrc/Xml.new -DOPENSSL_NO_KRB5 -Dlinux -D_GNU_SOURCE -DFILE64 -D_LARGEFILE64_SOURCE -I../../binsrc/mono/mono-1.1.7/libgc/include -I../../libsrc -I../../libsrc/Dk -DNO_UDBC_SDK -DUSE_INCLUDED_LIBGC=1 -g -O2 -MT libthrp_gc_la-sched_pthread_gc.lo -MD -MP -MF .deps/libthrp_gc_la-sched_pthread_gc.Tpo -c sched_pthread_gc.c -fPIC -DPIC -o .libs/libthrp_gc_la-sched_pthread_gc.o
sched_pthread_gc.c:41:16: fatal error: gc.h: No such file or directory
compilation terminated.
make[2]: *** [libthrp_gc_la-sched_pthread_gc.lo] Error 1
make[2]: Leaving directory `/usr/local/src/virtuoso-opensource/libsrc/Thread'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/virtuoso-opensource/libsrc'
make: *** [all-recursive] Error 1
dellas#india672:/usr/local/src/virtuoso-opensource$
I just did sudo apt-get install libgc-dev which worked. Make still gives me the same error. I'm a Linux noob, can somebody give me advice what might be the problem here or how to solve it?
EDIT: FYI: ldconfig -v -p clearly says that libgc.so exists, so why is this make script looking for the header?
...
libgdbm_compat.so.3 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgdbm_compat.so.3
libgdbm.so.3 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgdbm.so.3
libgd.so.2 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgd.so.2
libgcrypt.so.11 (libc6,x86-64) => /lib/x86_64-linux-gnu/libgcrypt.so.11
libgccpp.so.1 (libc6,x86-64) => /usr/lib/libgccpp.so.1
libgccpp.so (libc6,x86-64) => /usr/lib/libgccpp.so
libgcc_s.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libgcc_s.so.1
libgc.so.1 (libc6,x86-64) => /usr/lib/libgc.so.1
libgc.so (libc6,x86-64) => /usr/lib/libgc.so
libgamin-1.so.0 (libc6,x86-64) => /usr/lib/libgamin-1.so.0
libgailutil.so.18 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgailutil.so.18
libfuse.so.2 (libc6,x86-64) => /lib/libfuse.so.2
...
You should check the contents that were provided by the libgc-dev package. There is generally a compatibility file in /usr/include called gc.h, who's only purpose is to #include <gc/gc.h>. Your distirbution may not have this file, which is causing the compilation problem.
To check the contents of libgc-dev, you do a:
dpkg-query -L libgc-dev
This will list all the files that were provided by this package. If it doesn't contain /usr/include/gc.h, then you may need to alter the #include to read #include <gc/gc.h>, or change the makefile to add: -I/usr/include/gc. I'd change the -I option as a last resort.
As an alternative, you can add a file in /usr/include called gc.h with the simple content:
/* This file is installed for backward compatibility. */
#include <gc/gc.h>
The Virtuoso mono hosting support is for version 1.x and will not work with the current 2.x and later releases for which support needs to be schedule for addition ...
Is is specifically mono runtime support you are seeking or maybe just the ADO.Net Provider for Mono, which can be built using:
cd binsrc/VirtuosoClient.Net
gmake -f Makefile.mono
Best Regards
Hugh Williams
Related
I have tried to follow the tutorials from here to build training tools for Tesseract. I get this error.
depbase=`echo boxchar.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../.. -DNDEBUG -DPANGO_ENABLE_ENGINE -I../../src/api -I../../src/api -I../../src/ccmain -I../../src/ccutil -I../../src/ccstruct -I../../src/lstm -I../../src/arch -I../../src/viewer -I../../src/textord -I../../src/dict -I../../src/classify -I../../src/wordrec -I../../src/cutil -I/usr/local/include/leptonica -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/uuid -I/usr/include/libdrm -g -O2 -std=c++11 -MT boxchar.lo -MD -MP -MF $depbase.Tpo -c -o boxchar.lo boxchar.cpp &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../.. -DNDEBUG -DPANGO_ENABLE_ENGINE -I../../src/api -I../../src/api -I../../src/ccmain -I../../src/ccutil -I../../src/ccstruct -I../../src/lstm -I../../src/arch -I../../src/viewer -I../../src/textord -I../../src/dict -I../../src/classify -I../../src/wordrec -I../../src/cutil -I/usr/local/include/leptonica -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/uuid -I/usr/include/libdrm -g -O2 -std=c++11 -MT boxchar.lo -MD -MP -MF .deps/boxchar.Tpo -c boxchar.cpp -fPIC -DPIC -o .libs/boxchar.o
boxchar.cpp: In member function 'void tesseract::BoxChar::GetDirection(int*, int*) const':
boxchar.cpp:66:42: error: 'U_RIGHT_TO_LEFT_ISOLATE' was not declared in this scope
dir == U_ARABIC_NUMBER || dir == U_RIGHT_TO_LEFT_ISOLATE) {
^
make[1]: *** [boxchar.lo] Error 1
make[1]: Leaving directory `/home/vmuser/ocrd-train-master/tesseract-fd492062d08a2f55001a639f2015b8524c7e9ad4/src/training'
make: *** [training] Error 2
I looked at this Github comment here which states:
http://source.icu-project.org/repos/icu/tags/release-52-1/icu4c/source/common/unicode/uchar.h
http://source.icu-project.org/repos/icu/tags/release-50-1-2/icu4c/source/common/unicode/uchar.h
The training tools need icu version 52 and up. The icu version in RHEL & CentOS 7 is 50.
And from locate uchar.h I found that it resides in /usr/include/uchar.h and
/usr/include/unicode/uchar.h
I am not sure which file to change now. I don't know if it seems like a really stupid question
Thanks in Advance.
So, I finally figured it out myself:
download icu packages from:
http://download.icu-project.org/files/icu4c/
I used this file: http://download.icu-project.org/files/icu4c/59.1/icu4c-59_1-src.tgz
After that
tar zxf (tar file)
cd icu/source
make
sudo make install
After this in the Tesseract Directory
make training
sudo make training-install
I am trying to cross compile the gcc for linux - i686-elf platform from windows PC (cygwin). As per the toolchain steps, I have successfully compiled:
binutils using
/binutils-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
basic gcc 1st step using
gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
linux headers using
make headers_install ARCH=i386 CROSS_COMPILE=i386-linux- INDTALL_HDR_PATH=my/path/
glibc using
CC=${TARGET}-gcc ../glibc-2.29/configure --target=$TARGET --host=i686-pc-linux-gnu --prefix=$PREFIX --with-headers=my/path/
and then, make install-headers
Now, while building 2nd part og GCC using:../gcc-7.4.0/configure --target=$TARGET --prefix=$PREFIX --with-sysroot=$HOME/opt/cross --disable-libssp --disable-libgomp --disable-libmudflap --enable-languages=c,c++ --disable-multilib
I am getting the follwing errors:
make[2]: Entering directory '/home/MyPcUserName/src/build-gcc/i686-elf/libgcc
- If this is the top-level multilib, build all the other multilibs.
ln -s ../../../gcc-7.4.0/libgcc/enable-execute-stack-empty.c enable-execute-stack.c
ln -s ../../../gcc-7.4.0/libgcc/unwind-generic.h unwind.h
ln -s ../../../gcc-7.4.0/libgcc/config/no-unwind.h md-unwind-support.h
ln -s ../../../gcc-7.4.0/libgcc/config/i386/sfp-machine.h sfp-machine.h
ln -s ../../../gcc-7.4.0/libgcc/gthr-single.h gthr-default.h
DEFINES='' HEADERS='' \
../../../gcc-7.4.0/libgcc/mkheader.sh > tmp-libgcc_tm.h
/bin/sh ../../../gcc-7.4.0/libgcc/../move-if-change tmp-libgcc_tm.h libgcc_tm.h
echo timestamp > libgcc_tm.stamp
/home/MyPcUserName/src/build-gcc/./gcc/xgcc -B/home/MyPcUserName/src/build-gcc/./gcc/ -B/home/MyPcUserName/opt/cross/i686-elf/bin/ -B/home/MyPcUserName/opt/cross/i686-elf/lib/ -isystem /home/MyPcUserName/opt/cross/i686-elf/include -isystem /home/MyPcUserName/opt/cross/i686-elf/sys-include -g -O2 -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fpic -I. -I. -I../.././gcc -I../../../gcc-7.4.0/libgcc -I../../../gcc-7.4.0/libgcc/. -I../../../gcc-7.4.0/libgcc/../gcc -I../../../gcc-7.4.0/libgcc/../include -DHAVE_CC_TLS -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c ../../../gcc-7.4.0/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS
In file included from /home/MyPcUserName/opt/cross/usr/include/bits/libc-header-start.h:33:0,
from /home/MyPcUserName/opt/cross/usr/include/stdio.h:27,
from ../../../gcc-7.4.0/libgcc/../gcc/tsystem.h:87,
from ../../../gcc-7.4.0/libgcc/libgcc2.c:27:
/home/MyPcUserName/opt/cross/usr/include/features.h:474:10: fatal error: gnu/stubs.h: No such file or directory
#include <gnu/stubs.h>
^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:491: _muldi3.o] Error 1
make[2]: Leaving directory '/home/MyPcUserName/src/build-gcc/i686-elf/libgcc'
make[1]: *** [Makefile:11875: all-target-libgcc] Error 2
make[1]: Leaving directory '/home/MyPcUserName/src/build-gcc'
make: *** [Makefile:893: all] Error 2
I have tried --disable-multilib to disable the mulilib so as to ignore this gnu issue on 64-bit PC.
I tried to rebuilt all of it again, but still I am facing this issue.
Please let me know if anyone can help. Thanks a lot for your time
After building the glibc, we shouldn't directly start building 2nd part of GCC. Rather, few more steps should be followed for glibc as indicated below:
$ CC=${TARGET}-gcc ../glibc-2.29/configure --target=$TARGET --host=i686-pc-linux-gnu --prefix=$PREFIX --with-headers=my/path/
$ make install-bootstrap-headers=yes install-headers
$ make -j4 csu/subdir_lib
$ install csu/crt1.o csu/crti.o csu/crtn.o /opt/cross/$TARGET/lib
$ $TARGET-gcc -nostdlib -nostartfiles -shared -x c /dev/null -o /opt/cross/$TARGET/lib/libc.so
$ touch /opt/cross/$TARGET/include/gnu/stubs.h
Then, we can start building the 2nd part of GCC.
I am using the cross compile environemt from the Intel Site and have successfully compiled several other libraries using it (libsndfile, alsa, fftw) but when I try to compile portaudio it refuses to link to the proper directories. Here is the error I get:
if test -n " bindings/cpp" ; then for dir in " bindings/cpp"; do make -C $dir all; done ; fi
make[1]: Entering directory '/home/theslat/Downloads/portaudio/bindings/cpp'
Making all in lib
make[2]: Entering directory '/home/theslat/Downloads/portaudio/bindings/cpp/lib'
/bin/sh ../libtool --tag=CXX --mode=link i586-poky-linux-g++ -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mstackrealign -fno-omit-frame-pointer --sysroot=/usr/edison/sysroots/core2-32-poky-linux -O2 -pipe -g -feliminate-unused-debug-types -version-info 0:12:0 -no-undefined -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o libportaudiocpp.la -rpath /usr/local/lib BlockingStream.lo CallbackInterface.lo CallbackStream.lo CFunCallbackStream.lo CppFunCallbackStream.lo Device.lo DirectionSpecificStreamParameters.lo Exception.lo HostApi.lo InterfaceCallbackStream.lo MemFunCallbackStream.lo Stream.lo StreamParameters.lo System.lo SystemDeviceIterator.lo SystemHostApiIterator.lo ../../../lib/libportaudio.la
libtool: link: i586-poky-linux-g++ -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mstackrealign -fno-omit-frame-pointer --sysroot=/usr/edison/sysroots/core2-32-poky-linux -fPIC -DPIC -shared -nostdlib /usr/edison/sysroots/core2-32-poky-linux/usr/lib/crti.o /usr/edison/sysroots/core2-32-poky-linux/usr/lib/i586-poky-linux/4.9.1/crtbeginS.o .libs/BlockingStream.o .libs/CallbackInterface.o .libs/CallbackStream.o .libs/CFunCallbackStream.o .libs/CppFunCallbackStream.o .libs/Device.o .libs/DirectionSpecificStreamParameters.o .libs/Exception.o .libs/HostApi.o .libs/InterfaceCallbackStream.o .libs/MemFunCallbackStream.o .libs/Stream.o .libs/StreamParameters.o .libs/System.o .libs/SystemDeviceIterator.o .libs/SystemHostApiIterator.o -Wl,-rpath -Wl,/home/theslat/Downloads/portaudio/lib/.libs -Wl,-rpath -Wl,/usr/local/lib ../../../lib/.libs/libportaudio.so -L/usr/edison/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux/../../lib/i586-poky-linux/gcc/i586-poky-linux/4.9.1 -L/usr/edison/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux/../../lib/i586-poky-linux/gcc -L/usr/edison/sysroots/core2-32-poky-linux/lib -L/usr/edison/sysroots/core2-32-poky-linux/usr/lib/i586-poky-linux/4.9.1 -L/usr/edison/sysroots/core2-32-poky-linux/usr/lib /usr/lib/libstdc++.so -lm -lc -lgcc_s /usr/edison/sysroots/core2-32-poky-linux/usr/lib/i586-poky-linux/4.9.1/crtendS.o /usr/edison/sysroots/core2-32-poky-linux/usr/lib/crtn.o -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mstackrealign --sysroot=/usr/edison/sysroots/core2-32-poky-linux -O2 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-soname -Wl,libportaudiocpp.so.0 -o .libs/libportaudiocpp.so.0.0.12
/usr/lib/libstdc++.so: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:311: libportaudiocpp.la] Error 1
make[2]: Leaving directory '/home/theslat/Downloads/portaudio/bindings/cpp/lib'
make[1]: *** [Makefile:333: all-recursive] Error 1
make[1]: Leaving directory '/home/theslat/Downloads/portaudio/bindings/cpp'
make: *** [Makefile:251: all-recursive] Error 2
It seems like it is trying to link against my computers normal libstdc++ and I don't know why. I have tried feedin configure a variaty of LDFLAG with the right directories and have reinstalled the toolchain and all my multilibs but no luck.
I also ran into this issue and the easiest way is to source the environment file again after doing a sudo su on the same command line and then do a make install.
Here are the steps I followed to cross compile portaudio for intel edison:
Download the cross compiler edison-toolchain-20150120-linux64.tar.bz2 and the script toolchain-20140724-linux64.sh from this link
Extract the toolchain, run the script (you can put it in your home directory somewhere if you wish) and set up the cross-compile environment
$ tar -xvf edison-toolchain-20150120-linux64.tar.bz2
$ chmod +x toolchain-20140724-linux64.sh
$ ./toolchain-20140724-linux64.sh
$ source /opt/poky-edison/1.6/environment-setup-core2-32-poky-linux
Check the environment on your shell:
$ echo $CC
$ i586-poky-linux-gcc -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mstackrealign -fno-omit-frame-pointer --sysroot=/opt/poky-edison/1.6/sysroots/core2-32-poky-linux
Configure, compile and install portaudio:
$ ./configure
$ make
$ sudo su
# source /opt/poky-edison/1.6/environment-setup-core2-32-poky-linux
# make install
I am suprised that nobody grabbed this but also that it was difficult to find the proper answer anywhere else despite seeing many other people with similar (unresolved issues). The answer is frankly so simple I am embarrased that I overlooked it, but here it is so maybe someone else can find it.
make install required root privilages if the cross-compile SDK is in /opt or somewhere else you do not own. But... sudo does not preserve the environmental variable I had set up for the toolchain! Very simple, also su -m does not work the way I thought it did. Working solutions as follows:
Just install the SDK somewhere in your home directory. you now have write permissions, problem solved.
Run a single command as root while preserving the environment: su -m <yourUserName> -c '$CC main.cpp -lfoo -lbar ...'
The key in numer 2 is the username after -m, at least on my system leaving out the username there produced no errors but failed to preserve my environment.
I am trying to implement a dynamic library(liblog.so) which is going to run on i386 controller.
when i compile that in Host Machine (Ubuntu Machine) it compiles and generates the .so file successfully.
liblog.so is the the file which is put under /usr/lib in target machine.
merom#arunkumar:~/freedcs/freedcs-code1/Controller/src/Controller$ ldd log_client
linux-gate.so.1 => (0xb7707000)
libnative.so.3 => not found
libxenomai.so.0 => not found
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb76cd000)
librt.so.0 => not found
liblog.so => /usr/lib/liblog.so (0xb76c9000)
libcrypto.so.1.0.0 => /lib/i386-linux-gnu/libcrypto.so.1.0.0 (0xb751e000)
libssl.so.1.0.0 => /lib/i386-linux-gnu/libssl.so.1.0.0 (0xb74c7000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb74a9000)
libc.so.0 => not found
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb72f5000)
/lib/ld-uClibc.so.0 => /lib/ld-linux.so.2 (0xb7708000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb72f0000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb72d7000)
merom#arunkumar:~/freedcs/freedcs-code1/Controller/src/Controller$
output at host machine.
Output at target machine:
libnative.so.3 => /usr/lib/libnative.so.3 (0xb78d9000)
libxenomai.so.0 => /usr/lib/libxenomai.so.0 (0xb78d4000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb78c1000)
librt.so.0 => /lib/librt.so.0 (0xb78bd000)
liblog.so => /lib/liblog.so (0xb78b9000)
libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0xb7793000)
libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0xb7752000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7748000)
libc.so.0 => /lib/libc.so.0 (0xb770a000)
libdl.so.0 => /lib/libdl.so.0 (0xb7706000)
libc.so.6 => not found
ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0xb78e2000)
when i send it to Target machine(Currently in VMware), when i run the .\log_client it shows can't load library 'libc.so.6'
Yes i compiled log_client with linked with liblog.so
Compilation Commands
Generating liblog.so
../../../../build/i386/buildroot-2011.11/output/host/usr/bin/i686-unknown-linux-uclibc-gcc -c log.c -o liblog.o
../../../../build/i386/buildroot-2011.11/output/host/usr/bin/i686-unknown-linux-uclibc-gcc -Wcast-align -g -W -Wall -L../../../../build/i386/buildroot-2011.11/output/target/usr/lib -lxenomai -lpthread -lrt -shared -o liblog.so liblog.o -rdynamic -lcrypto -lssl
Generating log_client
cp liblog.so ../../../../build/i386/buildroot-2011.11/output/target/usr/lib
../../../../build/i386/buildroot-2011.11/output/host/usr/bin/i686-unknown-linux-uclibc-gcc -Wcast-align -g -W -Wall -c log_client.c
../../../../build/i386/buildroot-2011.11/output/host/usr/bin/i686-unknown-linux-uclibc-gcc -Wcast-align -g -W -Wall -L../../../../build/i386/buildroot-2011.11/output/target/usr/lib -lxenomai -lpthread -lrt -o log_client log_client.o -llog -rdynamic -lcrypto -lssl
I am using same procedure for an other code that is working, though that code doesn't use this customized library(liblog.so), there were warnings too but i didn't posted here.
Please help me, i am frustrated!!
------------Edited----------
file Output
$ file liblog.so
liblog.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped
$ file log_client
log_client: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
------------Update----------
Some one suggested me use --sysroot while compiling the files, but even that didn't helped me. Same error coming out. :(
I had put sysroot path to target machine's GCC's sysroot path
Generating liblog.so
../../../../build/i386/buildroot-2011.11/output/host/usr/bin/i686-unknown-linux-uclibc-gcc -Wcast-align -g -W -Wall -c log.c -o liblog.o --sysroot=/home/merom/freedcs/build/i386/buildroot-2011.11/output/host/usr/i686-unknown-linux-uclibc/sysroot/
../../../../build/i386/buildroot-2011.11/output/host/usr/bin/i686-unknown-linux-uclibc-gcc -Wcast-align -g -W -Wall -L../../../../build/i386/buildroot-2011.11/output/target/usr/lib -lxenomai -lpthread -lrt -shared -o liblog.so liblog.o -rdynamic -lcrypto -lssl --sysroot=/home/merom/freedcs/build/i386/buildroot-2011.11/output/host/usr/i686-unknown-linux-uclibc/sysroot/
Generating log_client
cp liblog.so ../../../../build/i386/buildroot-2011.11/output/target/usr/lib
../../../../build/i386/buildroot-2011.11/output/host/usr/bin/i686-unknown-linux-uclibc-gcc -Wcast-align -g -W -Wall -c log_client.c --sysroot=/home/merom/freedcs/build/i386/buildroot-2011.11/output/host/usr/i686-unknown-linux-uclibc/sysroot/
../../../../build/i386/buildroot-2011.11/output/host/usr/bin/i686-unknown-linux-uclibc-gcc -Wcast-align -g -W -Wall -L../../../../build/i386/buildroot-2011.11/output/target/usr/lib -lxenomai -lpthread -lrt -o log_client log_client.o -llog -rdynamic -lcrypto -lssl --sysroot=/home/merom/freedcs/build/i386/buildroot-2011.11/output/host/usr/i686-unknown-linux-uclibc/sysroot/
Update
After Running objdump This was the output.
objdump -x log_client | grep NEEDED
NEEDED libnative.so.3
NEEDED libxenomai.so.0
NEEDED libpthread.so.0
NEEDED librt.so.0
NEEDED liblog.so
NEEDED libcrypto.so.1.0.0
NEEDED libssl.so.1.0.0
NEEDED libgcc_s.so.1
NEEDED libc.so.0
objdump -x liblog.so | grep NEEDED
NEEDED libnative.so.3
NEEDED libxenomai.so.0
NEEDED libpthread.so.0
NEEDED librt.so.0
NEEDED libcrypto.so.1.0.0
NEEDED libssl.so.1.0.0
NEEDED libgcc_s.so.1
NEEDED libc.so.0
I had the same problem with an executable. Every tool I tried - ldd, objdump, readelf, strings - indicated depencency with libc.so.0, rather than .6. It turned out that one of its dependent libraries was depending on .6. So I went and fixed that and everything is working now.
The library had the wrong version because it was compiled using the wrong cross-compiler (I used it by mistake), so I recompiled and reuploaded it.
Here's my code.
#include <thread>
#include <iostream>
//#include <ctime>
using namespace std;
void f() {}
int main() {
//struct timespec t;
//clock_gettime(CLOCK_REALTIME, &t);
thread(f).join();
return 0;
}
I have tried to compile this program in the following ways:
1. g++ a.cc -o a -std=c++11 -pthread
2. g++ a.cc -o a -std=c++11 -lpthread
3. g++ -pthread a.cc -o a -std=c++11
4. g++ a.cc -c -std=c++11 && g++ a.o -o a -lpthread
5. g++ a.cc -c -std=c++11 -pthread && g++ a.o -o a -pthread
All of them can output the executable "a". However, none of them seem to link the library "libpthread.so":
./a
terminate called after throwing an instance of 'std::system_error'
what(): Enable multithreading to use std::thread: Operation not permitted
Aborted
ldd ./a
linux-vdso.so.1 => (0x00007fff997fe000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f350f7b5000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f350f59f000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f350f1d6000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f350eed2000)
/lib64/ld-linux-x86-64.so.2 (0x00007f350fad4000)
But, the following way works perfectly:
uncomment all the three lines in the above code(must do this, or the same error appears);
using "g++ a.cc -std=c++11 -o a -lrt".
I'm using ubuntu 13.10. Any reason for this?
This would seem to be a known Ubuntu related bug.
You can (as noted on the linked page) work around it by passing -Wl,--no-as-needed on the command line;
> g++ a.cc -pthread -std=c++11
> ./a.out
terminate called after throwing an instance of 'std::system_error'
what(): Enable multithreading to use std::thread: Operation not permitted
>
> g++ a.cc -pthread -std=c++11 -Wl,--no-as-needed
> ./a.out
>