Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Haiku shredder 1 hrev53167 May 26 2019 19:04:45 x86_64 x86_64 Haiku
gcc version 8.3.0 (2019_05_24)
### Linker error notes ###
## Reduced test case with c++ program
hello.cc
--------------------------------------------------------
#include <iostream>
int main()
{
std::cout << "Hello, World!" << std::endl;
}
--------------------------------------------------------
## List of packages installed
libsdl2_devel-2.0.9-1
libsdl2-2.0.9-1
libuv_debuginfo-1.29.1-1
libuv_devel-1.29.1-1
libuv-1.29.1-1
uchardet_devel-0.0.6-2
uchardet-0.0.6-2
libiconv_devel-1.15-4
libiconv-1.15-4
--------------------------------------------------------------------------------
## TEST CASE 1: Build with some linked libs
g++ -std=c++11 -o hello hello.cc -lSDL2 -luv -lpthread -lposix_error_mapper -lbsd -lnetwork -luchardet -liconv && ./hello
--> WORKING
# List of libs (readelf -d hello)
0x0000000000000001 (NEEDED) Shared library: [libSDL2-2.0.so.0]
0x0000000000000001 (NEEDED) Shared library: [libuv.so.1]
0x0000000000000001 (NEEDED) Shared library: [libbsd.so]
0x0000000000000001 (NEEDED) Shared library: [libnetwork.so]
0x0000000000000001 (NEEDED) Shared library: [libuchardet.so.0]
0x0000000000000001 (NEEDED) Shared library: [libiconv.so.2]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libroot.so]
--------------------------------------------------------------------------------
## TEST CASE 2: Build with some linked libs + link path options
(added -L flags as indicated by pkg-config of these libs)
g++ -std=c++11 -o hello hello.cc -L/packages/libsdl2-2.0.9-1/.self/develop/lib -L/packages/libuv-1.29.1-1/.self/develop/lib -L/packages/uchardet-0.0.6-2/.self/develop/lib -lSDL2 -luv -lpthread -lposix_error_mapper -lbsd -lnetwork -luchardet -liconv && ./hello
--> CRASH
# List of libs (readelf -d hello)
0x0000000000000001 (NEEDED) Shared library: [libSDL2-2.0.so.0]
0x0000000000000001 (NEEDED) Shared library: [libuv.so.1]
0x0000000000000001 (NEEDED) Shared library: [libbsd.so]
0x0000000000000001 (NEEDED) Shared library: [libnetwork.so]
0x0000000000000001 (NEEDED) Shared library: [libuchardet.so.0]
0x0000000000000001 (NEEDED) Shared library: [libiconv.so.2]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libroot.so]
REMARK : libstdc++.so.6 now MISSING from link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.