Skip to content

Compiling tests and examples fails on OS X due to "missing" librt #261

@kliron

Description

@kliron

Hi,
I'm trying to build cpp-netlib v 0.10.0 on OS X 10.8.4. The linker fails to find librt (which is linux specific and doesn't exist on OS X). Editing out the 'rt' in all target_link_libraries directives in all CMakeList.txt files corrects the error and the build finishes successfully.

Here is the output of make:

Linking CXX executable ../../../example/fileserver
cd /Users/kliron/Downloads/cpp-netlib-0.10.0/libs/network/example && /opt/local/bin/cmake -E cmake_link_script CMakeFiles/fileserver.dir/link.txt --verbose=1
/usr/bin/clang++   -g -Wl,-search_paths_first -Wl,-headerpad_max_install_names   CMakeFiles/fileserver.dir/http/fileserver.cpp.o  -o ../../../example/fileserver  /opt/local/lib/libboost_thread-mt.a /opt/local/lib/libboost_system-mt.a /opt/local/lib/libboost_date_time-mt.a /opt/local/lib/libboost_program_options-mt.a /opt/local/lib/libboost_filesystem-mt.a /opt/local/lib/libboost_chrono-mt.a /opt/local/lib/libboost_filesystem-mt.a ../src/libcppnetlib-server-parsers.a -lrt /opt/local/lib/libboost_chrono-mt.a -lrt 
ld: library not found for -lrt
clang: error: linker command failed with exit code 1 (use -v to see invocation) 
make[2]: *** [example/fileserver] Error 1
make[1]: *** [libs/network/example/CMakeFiles/fileserver.dir/all] Error 2
make: *** [all] Error 2

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions