Skip to content

Build failures on Ubuntu 14.04 with clang 3.4 #61

@ms705

Description

@ms705

On a fully up-to-date Ubuntu 14.04 LTS installation, I get the following error when building cpprestsdk (specifically, test_runner) with clang instead of GCC:

$ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
[...]
-- The C compiler identification is Clang 3.4.0
-- The CXX compiler identification is Clang 3.4.0
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.55.0
-- Found the following Boost libraries:
--   random
--   chrono
--   system
--   thread
--   regex
--   filesystem
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so (found suitable version "1.0.1f", minimum required is "1.0.0")
-- Setting clang options
-- websocketpp not found, using the embedded version
-- Added test library httpclient_test
-- Added test library httplistener_test
-- Added test library json_test
-- Added test library pplx_test
-- Added test library streams_test
-- Added test library uri_test
-- Added test library utils_test
-- Added test library websocketclient_test
-- Configuring done
-- Generating done
-- Build files have been written to: /src/cpprestsdk-git/Release/build.release
$
$ make
[  0%] Building CXX object src/CMakeFiles/cpprest.dir/http/client/http_client_msg.cpp.o
[...]
Linking CXX shared library ../Binaries/libcpprest.so
[ 19%] Built target cpprest
[...]
[ 32%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/Posix/TimeHelpers.cpp.o
Linking CXX shared library ../../../Binaries/libunittestpp.so
[ 32%] Built target unittestpp
[ 33%] Building CXX object tests/common/utilities/CMakeFiles/common_utilities.dir/os_utilities.cpp.o
[ 34%] Building CXX object tests/common/utilities/CMakeFiles/common_utilities.dir/stdafx.cpp.o
Linking CXX shared library ../../../Binaries/libcommon_utilities.so
[ 34%] Built target common_utilities
[...]
[ 35%] Building CXX object tests/common/TestRunner/CMakeFiles/test_runner.dir/test_module_loader.cpp.o
[...]
Linking CXX executable ../../../Binaries/test_runner
CMakeFiles/test_runner.dir/test_runner.cpp.o: In function `boost::filesystem::path::path<boost::filesystem::directory_entry>(boost::filesystem::directory_entry const&, boost::enable_if<boost::filesystem::path_traits::is_pathable<boost::decay<boost::filesystem::directory_entry>::type>, void>::type*)':
/src/cpprestsdk-git/Release/tests/common/TestRunner/test_runner.cpp:(.text._ZN5boost10filesystem4pathC2INS0_15directory_entryEEERKT_PNS_9enable_ifINS0_11path_traits11is_pathableINS_5decayIS4_E4typeEEEvE4typeE[_ZN5boost10filesystem4pathC2INS0_15directory_entryEEERKT_PNS_9enable_ifINS0_11path_traits11is_pathableINS_5decayIS4_E4typeEEEvE4typeE]+0xc3): undefined reference to `boost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::codecvt<wchar_t, char, __mbstate_t> const&)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Binaries/test_runner] Error 1
make[1]: *** [tests/common/TestRunner/CMakeFiles/test_runner.dir/all] Error 2
make: *** [all] Error 2

I understand that the documentation recommends using g++4.8 on Linux, but I had hoped that clang would work anyway.

My clang version is Ubuntu clang version 3.4-1ubuntu3, and my Boost version is 1.55, with the libboost-filesystem1.55-dev package installed. Using g++4.8 as CXX, the build succeeds without any problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions