Linker error "undefined reference to SSL_get_peer_certificate" when building PostgreSQL - linux

I'm trying to compile the PCL 1.8 and get the following error:
/usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_get_peer_certificate#OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.10.1: undefined reference to `TIFFReadDirectory#LIBTIFF_4.0'
If i list the dependencies of /usr/lib/x86_64-linux-gnu/libpq.so.5 I get libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0, which is readelf -h /lib/x86_64-linux-gnu/libssl.so.1.0.0 | grep Class\|File\|Machine':
Class: ELF64
Machine: Advanced Micro Devices X86-64
However, I seem to have more libpq versions installed:
/home/t/anaconda2/lib/libssl.so.1.0.0
/home/t/anaconda2/pkgs/openssl-1.0.2j-0/lib/libssl.so.1.0.0
/home/t/matlab/R2015a/bin/glnxa64/libssl.so.1.0.0
/lib/i386-linux-gnu/libssl.so.1.0.0
/lib/x86_64-linux-gnu/libssl.so.1.0.0
with /lib/i386-linux-gnu/libssl.so.1.0.0 being
Class: ELF32
Machine: Intel 80386
And:
[ 12%] Linking CXX executable ../../bin/pcl_convert_pcd_ascii_binary
cd /pcl/build/io/tools && /usr/bin/cmake -E cmake_link_script CMakeFiles/pcl_con
vert_pcd_ascii_binary.dir/link.txt --verbose=1
/usr/bin/c++ -std=c++11 -pthread -fopenmp -Wno-deprecated -O2 -g -DNDEB
UG CMakeFiles/pcl_convert_pcd_ascii_binary.dir/convert_pcd_ascii_binary.cpp.o
-o ../../bin/pcl_convert_pcd_ascii_binary -rdynamic -lboost_system -lboost_fil
esystem -lboost_thread -lboost_date_time -lboost_iostreams -lboost_chrono -lboos
t_atomic -lboost_regex -lpthread -lpthread -lm ../../lib/libpcl_io.so.1.8.0 ../.
./lib/libpcl_common.so.1.8.0 ../../lib/libpcl_io_ply.so.1.8.0 -lboost_system -lb
oost_filesystem -lboost_thread -lboost_date_time -lboost_iostreams -lboost_chron
o -lboost_atomic -lboost_regex -lpthread /usr/lib/libvtkGenericFiltering.so.5.10
.1 /usr/lib/libvtkGeovis.so.5.10.1 -lm /usr/lib/libvtkCharts.so.5.10.1 /usr/lib/
libvtkViews.so.5.10.1 /usr/lib/libvtkInfovis.so.5.10.1 /usr/lib/libvtkWidgets.so
.5.10.1 /usr/lib/libvtkVolumeRendering.so.5.10.1 /usr/lib/libvtkHybrid.so.5.10.1
/usr/lib/libvtkParallel.so.5.10.1 /usr/lib/libvtkRendering.so.5.10.1 /usr/lib/l
ibvtkImaging.so.5.10.1 /usr/lib/libvtkGraphics.so.5.10.1 /usr/lib/libvtkIO.so.5.
10.1 /usr/lib/libvtkFiltering.so.5.10.1 /usr/lib/libvtkCommon.so.5.10.1 -lm /usr
/lib/libvtksys.so.5.10.1 -ldl /anaconda2/lib/libpng.so /anaconda2/lib/libz.so -l
usb-1.0 -Wl,-rpath,/pcl/build/lib:/usr/lib/openmpi/lib:/anaconda2/lib: -Wl,-rpat
h-link,/usr/lib/openmpi/lib
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_get_peer_cert
ificate#OPENSSL_1.0.0'
Guess the /anaconda2/lib shouldn't be there?
How I can make sure that CMake links to the correct version (and remove the wrong version)?

I managed to compile it removing anaconda from the PATH, and changing all values having a path to anaconda to lib/x86_64-linux-gnu/ in cmake-gui

I had this problem but I to compile it removing anaconda from the PATH, and delete build file, then redo cmake, then make.

Related

Converting Makefile to CMake cannot find linked shared object

I am attempting to convert a working Makefile into a CMake and need a little assistance. I am trying to cross compile a small program for a yocto device from a Ubuntu20 machine that is trying to link to the devices shared object file with cmake. I have a working Makefile that builds a working program. However, when I try and do this with a CMakeList file it fails at the make stage linking to the shared objects linker flag.
The file structure of the code is as follows;
Parent
- include/
- file1.h
- file2.h
- xxx.h
- lib/
- libOBD2.so
- src/
- test.c
- CMakeLists.txt # Not working
- Makefile. # working
The shared object is being linked from within the program parent directory but I have also tried with it in the /usr/lib and /usr/local/lib from here but with no change.
The working Makefile
.prevent_execution:
exit 0
#remove # for no make command prints
DEBUG = #
APP_DIR = .
BUILD_DIR := $(APP_DIR)/build
SRC_DIRS := $(APP_DIR)/src
HEADER_DIR := $(APP_DIR)/include
APP_LIBRARY_DIR = $(APP_DIR)/lib
APP_NAME = test
# Locate all the source c and cpp files to be built
APP_SRC_FILES := $(shell find $(SRC_DIRS) -name '*.cpp' -or -name '*.c')
INC_DIRS := $(shell find $(HEADER_DIR) -type d)
# Add a prefix to INC_DIRS. So moduleA would become -ImoduleA. GCC understands this -I flag
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
CFLAGS+=-fPIC
PATH1 = /opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/include/
PATH2 = /opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/include/libxml2/
PATH3 = /opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/lib/
MAKE_CMD = -g -O0 -s -o $(BUILD_DIR)/$(APP_NAME) $(INC_FLAGS) $(APP_SRC_FILES) - I$(PATH1) -I$(PATH2) -L$(APP_LIBRARY_DIR) -lz -lOBD2 -lssl -lcrypto -lcurl -lxml2 -L$(PATH3) -lm -ldl -lpthread -lrt
all:
$(DEBUG) $(CC) $(CFLAGS) $(MAKE_CMD)
clean:
rm -f $(BUILD_DIR)/$(APP_NAME)
The CmakeLists.txt
cmake_minimum_required( VERSION 3.5 )
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR ARM)
# -fPIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
project(iwtest)
set(PATH1 "/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/include/")
set(PATH2 "/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/include/libxml2/")
set(PATH3 "/opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/lib")
set(LIB_DIR "${CMAKE_SOURCE_DIR}/lib")
include_directories(${PROJECT_NAME} PRIVATE ${PATH1})
include_directories(${PROJECT_NAME} PRIVATE ${PATH2})
include_directories(${PROJECT_NAME} PRIVATE "${PROJECT_SOURCE_DIR}/include")
set(SOURCE_FILES src/test.c)
add_definitions("-g")
add_definitions("-O0")
add_definitions("-s")
# Connect the libOBD2 library to the project
add_library(libOBD2 SHARED IMPORTED)
set_target_properties(libOBD2 PROPERTIES IMPORTED_LOCATION ${LIB_DIR}/libOBD2.so)
include_directories(libOBD2 INTERFACE ${CMAKE_SOURCE_DIR}/lib)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
# target_link_libraries(${PROJECT_NAME} PRIVATE ${PATH3})
target_link_libraries(${PROJECT_NAME} PUBLIC libOBD2)
target_link_options(${PROJECT_NAME} PRIVATE -lz -lOBD2 -lssl -lcrypto -lcurl -lxml2 -L$(PATH3) -lm -ldl -lpthread -lrt)
# target_link_options(${PROJECT_NAME} PRIVATE -I$(PATH1) -I$(PATH2) -L$(LIB_DIR) -lz -lOBD2 -lssl -lcrypto -lcurl -lxml2 -L$(PATH3) -lm -ldl -lpthread -lrt)
The output of cmake
-- Toolchain file defaulted to '/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/share/cmake/OEToolchainConfig.cmake'
-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dev/Workspace/build/cmakebuild
The output of make VERBOSE=1
/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -S/home/dev/Development/iwave-test-code -B/home/dev/Workspace/build/cmakebuild --check-build-system CMakeFiles/Makefile.cmake 0
/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E cmake_progress_start /home/dev/Workspace/build/cmakebuild/CMakeFiles /home/dev/Workspace/build/cmakebuild//CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/dev/Workspace/build/cmakebuild'
make -f CMakeFiles/iwtest.dir/build.make CMakeFiles/iwtest.dir/depend
make[2]: Entering directory '/home/dev/Workspace/build/cmakebuild'
cd /home/dev/Workspace/build/cmakebuild && /opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/dev/Development/iwave-test-code /home/dev/Development/iwave-test-code /home/dev/Workspace/build/cmakebuild /home/dev/Workspace/build/cmakebuild /home/dev/Workspace/build/cmakebuild/CMakeFiles/iwtest.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/dev/Workspace/build/cmakebuild'
make -f CMakeFiles/iwtest.dir/build.make CMakeFiles/iwtest.dir/build
make[2]: Entering directory '/home/dev/Workspace/build/cmakebuild'
[ 50%] Building C object CMakeFiles/iwtest.dir/src/test.c.o
/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi --sysroot=/opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi -I/home/dev/Development/iwave-test-code/iwtest -I/home/dev/Development/iwave-test-code/PRIVATE -I/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/include -I/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/include/libxml2 -I/home/dev/Development/iwave-test-code/include -I/home/dev/Development/iwave-test-code/libOBD2 -I/home/dev/Development/iwave-test-code/INTERFACE -I/home/dev/Development/iwave-test-code/lib -O2 -pipe -g -feliminate-unused-debug-types -fPIE -g -O0 -s -o CMakeFiles/iwtest.dir/src/test.c.o -c /home/dev/Development/iwave-test-code/src/test.c
In file included from /opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/include/bits/libc-header-start.h:33,
from /opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/include/stdio.h:27,
from /home/dev/Development/iwave-test-code/src/test.c:1:
/opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/include/features.h:382:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
382 | # warning _FORTIFY_SOURCE requires compiling with optimization (-O)
| ^~~~~~~
[100%] Linking C executable iwtest
/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E cmake_link_script CMakeFiles/iwtest.dir/link.txt --verbose=1
/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi --sysroot=/opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi -O2 -pipe -g -feliminate-unused-debug-types -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -lz -lOBD2 -lssl -lcrypto -lcurl -lxml2 "-L\$$(PATH3)" -lm -ldl -lpthread -lrt CMakeFiles/iwtest.dir/src/test.c.o -o iwtest -Wl,-rpath,/home/dev/Development/iwave-test-code/lib /home/dev/Development/iwave-test-code/lib/libOBD2.so
/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.2.0/real-ld: cannot find -lOBD2
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/iwtest.dir/build.make:104: iwtest] Error 1
make[2]: Leaving directory '/home/dev/Workspace/build/cmakebuild'
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/iwtest.dir/all] Error 2
make[1]: Leaving directory '/home/dev/Workspace/build/cmakebuild'
make: *** [Makefile:103: all] Error 2
Any help is much appreciated. Thanks in advance.
Thanks to Tsyvarev comment the solution was to remove the -lOBD2 from the target_link_options. As per Tsyvarev suggestion now all the linker options are linked through target_link_libraries.
The solution to the CMakeLists.txt
# remove the target_link_options line
# target_link_options(${PROJECT_NAME} PRIVATE -lz -lOBD2 -lssl -lcrypto -lcurl -lxml2 -L$(PATH3) -lm -ldl -lpthread -lrt)
# replace with
target_link_libraries(${PROJECT_NAME} PUBLIC libOBD2 pthread ssl crypto curl xml2 m dl rt)
On a side note, as i was cross-compiling for a yocto device the libOBD2.so was located in a different directory to the cross-compile pc of ${CMAKE_SOURCE_DIR}/lib. To fix this I copied libOBD2.so to the same directory seen on the device, in this case it was /usr/lib and change LIB_DIR to set(LIB_DIR "/usr/lib").
There's an easier way to do all this. I happen to be using the same toolchain, and likely the exact same iWave telematic device that you are. My CMakeLists.txt file is generic, nothing toolchain-specific in it at all (except the platform-specific library)...
cmake_minimum_required(VERSION 3.0.0)
project(testapp VERSION 0.1.0)
add_executable(testapp src/testapp.cpp)
target_include_directories(testapp PUBLIC include)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_directories(testapp PUBLIC lib)
target_link_libraries(testapp PRIVATE Threads::Threads libOBD2.so)
Once I have this file in my project folder, I run the following commands from the terminal:
source /opt/fsl-imx-x11/5.4-zeus/environment-setup-cortexa7t2hf-neon-poky-linux-gnueabi
mkdir build
cd build
cmake ..
make
CMake will now automatically detect the toolchain, and generate the appropriate makefiles to actually build your project. The nice thing is, if you're not linking in platform-specific libraries (such as the libOBD2.so file provided by iWave), you can easily retarget the build to another environment - I've successfully switched to a Raspberry Pi, or native Ubuntu. It all depends on what toolchain CMake detects when you run it. The "source" command sets that up, and CMake takes it all from there...
Regards,
David

Unable to cross-compile dropbear for uclibc

I am trying to cross-compile Dropbear for an x86 machine where glibc is missing and instead, uclibc is being used. For that aim, I have cross-compiled zlib for this same instruction set using a custom crosstool-ng toolchain and installed it to a custom location.
msainz#ubuntu:~$ ls Projects/zlib_install/lib
libz.a libz.so libz.so.1 libz.so.1.2.11 pkgconfig
I have copied Projects/zlib_install/include/zlib.h and Projects/zlib/include/zconf.h to Projects/dropbear/zlibincludes/.
I've set my env variables this way:
msainz#ubuntu:~$ echo $PATH
usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:
/usr/local/games:/snap/bin:/home/msainz/x-tools/x86_64-multilib-linux-uclibc/bin
msainz#ubuntu:~/Projects/dropbear$ echo $LDFLAGS
/home/msainz/Projects/zlib_install/lib/libz.a
msainz#ubuntu:~/Projects/dropbear$ echo $CFLAGS
-Izlibincludes -I../zlibincludes
I launch the configure script this way: ./configure --prefix=/home/msainz/Projects/tmp_top_dir --host=x86
The execution terminates with the following error:
configure:4851: x86_64-multilib-linux-uclibc-gcc -o conftest -Izlibincludes -I../zlibincludes -Wno-
pointer-sign -fno-strict-overflow -fPIE -fstack-protector-strong -D_FORTIFY_SOURCE=2 -mfunction-
return=thunk -mindirect-branch=thunk /home/msainz/Projects/zlib_install/lib/libz.a -pie -Wl,-z,now -
Wl,-z,relro conftest.c -lz >&5
/home/msainz/x-tools/x86_64-multilib-linux-uclibc/bin/../lib/gcc/x86_64-multilib-linux-
uclibc/8.3.0/../../../../x86_64-multilib-linux-uclibc/bin/ld.bfd: cannot find -lz
collect2: error: ld returned 1 exit status
Any ideas to solve this? Thanks in advance.
Solved the problem adding --with-zlib=/home/msainz/Projects/zlib_install/ to the ./configure call.

Use only local library with cross compiler

I'm trying to build one application with cross compiler on linux. Application is based on OpenEmbedded project. Compiler and all cross compiled libraries are located in build folder. But for one package build script is trying to use a library from my linux environment.
Command which is called from make script at the end:
/bin/sh ./arm-ABC-linux-gnueabi-libtool --tag=CXX --mode=link
arm-ABC-linux-gnueabi-g++ -march=armv7-a -mtune=cortex-a8
-mfpu=neon -mfloat-abi=softfp -g --std=c++0x -pthread -L/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/opt/my/lib
-Wl,-rpath-link,/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/opt/my/lib
-Wl,-O1 -Wl,--hash-style=gnu -L/opt/my/lib -o modbus_server_test modbus_server_test.o Serial.o SerialUtil.o Crc.o RtuFramer.o Pdu.o
SerialMaster.o
/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/usr/local/apr/lib/libapr-2.la
-lcrypt -luuid -lrt -lcrypt -lpthread -ldl -lexpat -lstdc++
Most important from here that is use -lexpat flag for libexpat.so.1.5.2 library. This library is cross compiled and located in the build folder, and at the same time, we have one in my linux environment.
As result I recieve the next error:
| arm-ABC-linux-gnueabi-libtool: link:
arm-ABC-linux-gnueabi-g++ -march=armv7-a -mtune=cortex-a8
-mfpu=neon -mfloat-abi=softfp -g --std=c++0x -pthread -Wl,-rpath-link -Wl,/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/opt/my/lib
-Wl,-O1 -Wl,--hash-style=gnu -o .libs/modbus_server_test modbus_server_test.o Serial.o SerialUtil.o Crc.o RtuFramer.o Pdu.o
SerialMaster.o
-L/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/opt/my/lib
-L/opt/my/lib /usr/local/apr/lib/libapr-2.so -L/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib
/usr/lib/x86_64-linux-gnu/libexpat.so
/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib/libuuid.so
-lrt -lcrypt -lpthread -ldl /home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib/libexpat.so
/home/ABC/build/build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib/libstdc++.so
-lm -pthread -Wl,-rpath -Wl,/usr/local/apr/lib -Wl,-rpath -Wl,/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib
| /usr/lib/x86_64-linux-gnu/libexpat.so: file not recognized: File
format not recognized
| collect2: ld returned 1 exit status
| make[2]: *** [modbus_server_test] Error 1
From output I can see that it include two libraries: one from linux environment (/usr/lib/x86_64-linux-gnu/libexpat.so which is x86) and one from the build folder (build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib/libexpat.so which is for ARM).At the end it complains about x86 type.
How can I exclude this library from searching in global environment? Why it even trying to use both of them?

eureka-1.11: DSO missing from command line

I've been trying to install eureka-1.11 program (DooM map editor for Linux) and when I ran make command, I got the error:
user_nout#linux-u90c:~/eureka-1.11-source> sudo make
root's password:
g++ obj_linux/editloop.o obj_linux/e_basis.o obj_linux/e_checks.o obj_linux/e_checks2.o obj_linux/e_cutpaste.o obj_linux/e_linedef.o obj_linux/e_loadsave.o obj_linux/e_nodes.o obj_linux/e_path.o obj_linux/e_sector.o obj_linux/e_things.o obj_linux/e_vertex.o obj_linux/im_arrows.o obj_linux/im_color.o obj_linux/im_img.o obj_linux/levels.o obj_linux/lib_adler.o obj_linux/lib_file.o obj_linux/lib_util.o obj_linux/main.o obj_linux/m_bitvec.o obj_linux/m_config.o obj_linux/m_files.o obj_linux/m_game.o obj_linux/m_keys.o obj_linux/m_select.o obj_linux/m_strings.o obj_linux/objects.o obj_linux/r_grid.o obj_linux/r_render.o obj_linux/sys_debug.o obj_linux/ui_about.o obj_linux/ui_browser.o obj_linux/ui_canvas.o obj_linux/ui_default.o obj_linux/ui_dialog.o obj_linux/ui_file.o obj_linux/ui_hyper.o obj_linux/ui_infobar.o obj_linux/ui_linedef.o obj_linux/ui_menu.o obj_linux/ui_misc.o obj_linux/ui_nombre.o obj_linux/ui_nodes.o obj_linux/ui_pic.o obj_linux/ui_prefs.o obj_linux/ui_replace.o obj_linux/ui_sector.o obj_linux/ui_scroll.o obj_linux/ui_sidedef.o obj_linux/ui_thing.o obj_linux/ui_tile.o obj_linux/ui_vertex.o obj_linux/ui_window.o obj_linux/w_loadpic.o obj_linux/w_flats.o obj_linux/w_sprite.o obj_linux/w_texture.o obj_linux/w_wad.o obj_linux/x_hover.o obj_linux/x_loop.o obj_linux/x_mirror.o obj_linux/glbsp/analyze.o obj_linux/glbsp/blockmap.o obj_linux/glbsp/glbsp.o obj_linux/glbsp/level.o obj_linux/glbsp/node.o obj_linux/glbsp/reject.o obj_linux/glbsp/seg.o obj_linux/glbsp/system.o obj_linux/glbsp/util.o obj_linux/glbsp/wad.o -o eureka -L /lib64 -lfltk_images -lfltk_gl -lfltk -lX11 -lXext -lXft -lfontconfig -lXinerama -lpng -ljpeg -lGL -lz -lm
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: /usr/local/lib64/libfltk.a(Fl_Native_File_Chooser.o): undefined reference to symbol 'dlsym##GLIBC_2.2.5'
/lib64/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:158: recipe for target 'eureka' failed
make: *** [eureka] Error 1
I was searching a lot about this type of error, but in each topic it was something different comparing to my problem.
For note: there is no configure file; also I tried to put another LDFLAGS in make file.
System: linux openSUSE Leap 42.1
The part of the makefile, if needed:
INSTALL_DIR=$(PREFIX)/share/eureka
CXXFLAGS=$(OPTIMISE) -Wall -D$(OS) \
-Iglbsp_src \
-D_THREAD_SAFE -D_REENTRANT
LDFLAGS=-L/usr/X11R6/lib
LIBS= \
-lfltk_images -lfltk_gl -lfltk \
-lX11 -lXext -lXft -lfontconfig -lXinerama \
-lpng -ljpeg -lGL -lz -lm
Any ideas how to overcome this issue?
The question can be closed - Knud Larsen has published an answer in the comment above.
All the thing was in not valid fltk on my system.
For reading the full answer to my question, see the comment, as I have already mentioned.
Thanks for help!
Testing eureka-111 with OpenSuse Leap 42.1 :
# zypper in gcc-c++ fltk-devel fltk-devel-static libXft-devel libjpeg8-devel libpng12-devel xdg-utils
cd eureka-1.11-source/ && make ... and the executable eureka is created.
P.S. : Reason for a difference with a manual build of fltk : The Suse 42.1 fltk packages were built with a different configure file ( Line 2685 edited ) :
- DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$# \$(LDLIBS) -shared -fPIC $DEBUGFLAG -o"
+ DSOCOMMAND="\$(CXX) -Wl,--as-needed -Wl,--no-undefined \$(DSOFLAGS) -Wl,-soname,\$# \$(LDLIBS) -shared -fPIC $DEBUGFLAG -o"
Ref. the patch fltk-1.3.2-underlinking.patch in the source SRPM, fltk-1.3.2-9.2.src.rpm

Error dynamic link library in Firefox /bin/sh: symbol lookup error

I'm trying to load a library to Firefox, and I get the following error in the terminal:
http://pastebin.com/ZLryd20D,
gcc -Wall -fPIC -c 11.cpp ,
gcc -shared -o libshared.so 11.o -ldl ,
LD_PRELOAD=$PWD/libshared.so firefox ,
/bin/sh: symbol lookup error: /home/enigma/Desktop/compilacionproceso/libshared.so: undefined symbol: __gxx_personality_v0
gcc -shared -o libshared.so 11.o -ldl -lstdc++
That's the wrong solution, that happens to work on Linux by accident.
The correct command line to build your shared library is:
g++ -shared -o libshared.so 11.o
(contrary to popular belief, gcc and g++ are not the same thing).
Answer from the OP himself, taken from a revision of the question:
I solved the problem adding a flag -lstdc++ for create the library
thanks to this post
What is __gxx_personality_v0 for?
cd /directory
gcc -Wall -fPIC -c 11.cpp
gcc -shared -o libshared.so 11.o -ldl -lstdc++
LD_PRELOAD=$PWD/libshared.so program

Resources