Skip to content

Commit

Permalink
No dynamic link with libstdc++.so
Browse files Browse the repository at this point in the history
  • Loading branch information
pawsten committed Oct 15, 2024
1 parent e735085 commit fa1e40a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,5 @@ add_custom_target(run-tests COMMAND ${CMAKE_CTEST_COMMAND} -T Test --no-compress
add_subdirectory(bpf_program)
add_subdirectory(bpf_generic)
add_subdirectory(libnettracer)
add_subdirectory(nettracer)
#add_subdirectory(nettracer)
add_subdirectory(nettracersrv)
4 changes: 3 additions & 1 deletion libnettracer/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ set(SOURCES
connection_test.cpp
connections_printing_test.cpp
mock_bpf_maps_test.cpp
netstat_test.cpp
#netstat_test.cpp
proc_tcp_test.cpp
tuple_utils_test.cpp
)
Expand All @@ -41,6 +41,7 @@ set(HEADERS
PREPEND(HEADERS_FULL "${CMAKE_CURRENT_LIST_DIR}/cpp" ${HEADERS})

add_executable(libnettracer_test ${SOURCES_FULL} ${HEADERS_FULL})

target_include_directories(libnettracer_test
PRIVATE
"${PROJECT_SOURCE_DIR}/libnettracer/src"
Expand All @@ -49,6 +50,7 @@ target_include_directories(libnettracer_test
target_link_libraries(libnettracer_test libnettracer)
target_link_libraries(libnettracer_test -lpthread)
target_link_libraries(libnettracer_test -lz)

if(DEFINED GITHUB_GTEST)
target_link_libraries(libnettracer_test gmock_main)
target_link_libraries(libnettracer_test gtest_main)
Expand Down
7 changes: 7 additions & 0 deletions nettracersrv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ set(HEADERS
PREPEND(HEADERS_FULL "${CMAKE_CURRENT_LIST_DIR}" ${HEADERS})

add_executable(nettracersrv ${SOURCES_FULL} ${HEADERS_FULL})

if(CMAKE_VERSION VERSION_GREATER "3.13")
target_link_options(nettracersrv PRIVATE -static-libgcc -static-libstdc++)
else()
target_link_libraries(nettracersrv -static-libgcc -static-libstdc++)
endif()

target_include_directories(nettracersrv
PRIVATE
"${PROJECT_SOURCE_DIR}/libnettracer/src"
Expand Down

0 comments on commit fa1e40a

Please sign in to comment.