Skip to content

Instantly share code, notes, and snippets.

@jpcima
Created May 28, 2019 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpcima/1f9bf0f8808933ed383c1b50ff79fde0 to your computer and use it in GitHub Desktop.
Save jpcima/1f9bf0f8808933ed383c1b50ff79fde0 to your computer and use it in GitHub Desktop.
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