How to solve the linking error in libwebsockets - c

I use libwebsockets for a client program in C. Therefore I build the library for the libwebsocktes locally on my machine (ubuntu). After I want to Build the Project in Eclipse, I get the following output:
14:58:40 **** Incremental Build of configuration Build (GNU) for project ClientA ****
make all
cc -o clientA ifaddrs.o mo.o misc.o dm.o ws.o -lcurl -lrt -lxml2 -ljson-c -lssl -lcrypto -lpthread -Wl,-Bstatic -L/home/vps/src/libwebsockets/build/lib -lwebsockets -Wl,-Bdynamic
/usr/bin/ld: /home/bla/libwebsockets/build/lib/libwebsockets.a(ssl.c.o): undefined reference to symbol 'SSL_get_fd##OPENSSL_1.0.0'
/usr/lib/gcc/i686-linux-gnu/4.7/../../../i386-linux-gnu/libssl.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [clientA] Error 1
14:58:41 Build Finished (took 1s.223ms)
It seems to be a problem with the libwebsockets.a. But how I can solve it ?

Related

Build of guile-2.0.11 on macOS Sierra fails: Undefined symbols for architecture x86_64

I am not an experienced programmer/developer/software engineer, but I need to get this older version of guile-2.0.11 built "by hand" rather than using home-brew (which installs the latest version of guile). I downloaded the tarball for guile-2.0.11 from the GitHub repository, extracted it and ran the shell script autogen.sh. This produced a configure executable which ran to completion and generated a Makefile. When I run make, the build continues until I get the this error:
Undefined symbols for architecture x86_64:
"_clock_getcpuclockid", referenced from:
_scm_init_stime in libguile_2.0_la-stime.o
"_ffi_call", referenced from:
_scm_i_foreign_call in libguile_2.0_la-foreign.o
and 16 more "ffi" similar messages. Then the error messages finishes
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [libguile-2.0.la] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
The linker apparently can't find these symbols. The explicit link command is quite extensive..it shows all the options, include and library paths if I use "make V=1". Here is the beginning, showing the options and paths:
Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
/bin/sh ../libtool --tag=CC --mode=link gcc - I/usr/local/opt/gettext/include -I/usr/local/include - I/usr/local/opt/readline/include - I/usr/local/Cellar/gettext/0.19.8.1/include -D_THREAD_SAFE -Wall - Wmissing-prototypes -Wdeclaration-after-statement -Wpointer-arith -Wswitch- enum -fno-strict-aliasing -fwrapv -fvisibility=hidden - I/usr/local/Cellar/bdw-gc/7.6.0/include -g -O2 -L/usr/local/Cellar/bdw- gc/7.6.0/lib -lgc -L/usr/local/opt/libffi/lib -liconv - L/usr/local/opt/gettext/lib -lintl -R/usr/local/opt/gettext/lib -Wl,- framework -Wl,CoreFoundation -L/usr/local/lib -lunistring -R/usr/local/lib -version-info 29:2:7 -export-dynamic -no-undefined -L/usr/local/opt/gettext/lib -L/usr/local/lib -L/usr/local/opt/readline/lib -L/usr/local/Cellar/gettext/0.19.8.1/lib -o libguile-2.0.la -rpath /usr/local/lib
Then there is libtool.
libtool: link: gcc -dynamiclib -o .libs/libguile-2.0.22.dylib .libs/libguile_2.0_la-alist.o .libs/libguile_2.0_la-arbiters.o .libs/libguile_2.0_la-array-handle.o
and many many more xxxx.o
then
-Wl,-force_load,../lib/.libs/libgnu.a -L/usr/local/Cellar/bdw- gc/7.6.0/lib -lgc -L/usr/local/opt/libffi/lib -L/usr/local/opt/gettext/lib -L/usr/local/lib -L/usr/local/opt/readline/lib - L/usr/local/Cellar/gettext/0.19.8.1/lib -lintl -lunistring -liconv -lgmp - lltdl -lm -g -O2 -Wl,-framework -Wl,CoreFoundation -install_name /usr/local/lib/libguile-2.0.22.dylib -compatibility_version 30 - current_version 30.2 -Wl,-single_module
The up-to-date version of ffilib is in the symlink /usr/local/opt/libffi/lib which is in the ld path, so I would think that the linker could find it. Any help would be greatly appreciated.
This problem is really two problems: (1) the undefined symbol "_clock_getcpuclockid" and (2) all the "ffi" undefined symbols. The answer to the second problem is here and the answer to the first problem is here. There may be other solutions but these resulted in the installation of guile-2.0.11 on my macOS Sierra (10.12.5),

Error while trying to create shared library

I am trying to create the shared library (.so) so that I can call it using .External command from R for the lassoshooting package:
https://cran.r-project.org/web/packages/lassoshooting/
Basically, I have downloaded the package source from the above website. However, when I go the the correct directory (.../lassoshooting/src) and use the command
R CMD SHLIB -o ccd_r.so ccd_r.c
I get the following error:
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined
dynamic_lookup -single_module -multiply_defined suppress
-L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o ccd_r.so ccd_r.o -L/Library/Frameworks/R.framework/Resources/lib
-lRblas -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [ccd_r.so] Error 1
Why is this happening?

What openGL package am I missing?

I am trying to resurrect on old OpenGL program on a Linux Mint system. I installed freeglut3-dev using Synaptic Package Manager. The compiler does not complain about not being able to find the glut include file anymore, but now I have other problems:
cc -Wall -o gears main.c draw_gears.c gl_drawing.c load_data.c normal.c prep_data.c -lglut
/usr/bin/ld: /tmp/ccfNsT0O.o: undefined reference to symbol 'glNewList'
//usr/lib/i386-linux-gnu/mesa/libGL.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [gears] Error 1
Try this:
cc -Wall -o gears main.c draw_gears.c gl_drawing.c load_data.c normal.c prep_data.c -lglut -lGLU -lGL

Why I obtain "cannot find -ljvm" error message when I try to compile a C project?

I have the following problem compiling a C project into Linux Ubuntu 12.04 shell
I first execute:
make clean
and it work well
Thene I execute:
make all
and then I obtain the following error message:
gcc -L/usr/local/default/jre/lib/i386/client -o "atmosfs" ./bbfs.o ./cimeparser.o ./settingsparser.o ./log.o ./hashtable.o ./jniHelper.o ./decodeError.o -lpthread -lxml2 -lfuse -ljvm -lrt -ldl
/usr/bin/ld: cannot find -ljvm
collect2: ld returned 1 exit status
make: *** [atmosfs] Errore 1
As you can see the error is:
/usr/bin/ld: cannot find -ljvm
What can I do to try to solve this issue?
Tnx

How to build Gotoblas2 on Opensuse 12.2

While building GotoBlas2 on my x86_64 by using the default make file, I encounter the following build error:
gcc -O2 -DEXPRECISION -m128bit-long-double -Wall -m64
-DF_INTERFACE_GFORT -fPIC -DSMP_SERVER -DMAX_CPU_NUMBER=8 -DASMNAME= -DASMFNAME=_ -DNAME=_ -DCNAME= -DCHAR_NAME=\"_\" -DCHAR_CNAME=\"\" -I.. -w -o linktest linktest.c ../libgoto2_nehalemp-r1.13.so -L/usr/lib64/gcc/x86_64-suse-linux/4.7 -L/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/lib
-L/usr/lib64/gcc/x86_64-suse-linux/4.7/../../.. -l -l -lgfortran -lm -lquadmath -lm -lc && echo OK. /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld:
cannot find -l-l collect2: error: ld returned 1 exit status make[1]:
* [../libgoto2_nehalemp-r1.13.so] Error 1 make[1]: Leaving directory `/home/ken/bin/build/GotoBLAS2/exports' make: * [shared] Error 2
In an attempt to remedy the problem I searched my package manager for a library to satisfy -l-l, looking for things like libl, liblex, libflex, etc but I can't find anything to satisfy the link.
Any ideas?
To fix this, edit line 298 in f_check to
"print MAKEFILE "FEXTRALIB=$linker_L -lgfortran -lm -lquadmath -lm $linker_a\n";"

Resources