List Objects of Binary
objdump -T xxx.bin -C | grep "mynamespace::MyClass"
Shared Libraries Dependencies
ldd xxx.so
RPath
objdump -x xxx.bin | grep RPATH
readelf -d run_inferencer |head -20
Static Libraries
ar -t xxx.a
Static Libraries Dependencies
A <- B <- C
(B uses A), when you build A, B, and C as static libraries, and another target uses A, B, C. In the target_link_libraries()
, the order should be target_link_libraries(C, B, A)
.
Compile Static Libs
We want to provide our C++ application as a shared library and support the old version of GCC like 4.x.x.
- Thus, we need to build all static libraries with -fPIC.
- We should add
-D_GLIBCXX_USE_CXX11_ABI=0
.
Protocol Buffers 3.5.1
./configure CFLAGS='-fPIC -D_GLIBCXX_USE_CXX11_ABI=0' CXXFLAGS='-fPIC -D_GLIBCXX_USE_CXX11_ABI=0'
make
make install DESTDIR=/home/zhoun14/Downloads/protobuf-3.5.1/build
JsonCPP 1.8.4
cmake -DCMAKE_CXX_FLAGS='-fPIC -D_GLIBCXX_USE_CXX11_ABI=0' \
-DCMAKE_C_FLAGS='-fPIC -D_GLIBCXX_USE_CXX11_ABI=0' \
-DCMAKE_BUILD_TYPE=Release ..
make
make install DESTDIR=/home/zhoun14/Downloads/jsoncpp-master/build
GTest 1.10.0
cmake -DCMAKE_CXX_FLAGS='-fPIC -D_GLIBCXX_USE_CXX11_ABI=0' \
-DCMAKE_C_FLAGS='-fPIC -D_GLIBCXX_USE_CXX11_ABI=0' \
-DCMAKE_BUILD_TYPE=Release ..
make
make install DESTDIR=/home/zhoun14/Downloads/googletest-release-1.10.0/build