Unable to build on Mac OS X

Oct 18, 2015 at 12:06 PM
Edited Oct 18, 2015 at 12:06 PM
Hi,
I am trying to build following the instructions here. The only change I have made is that I use macports instead of homebrew to install the dependencies.

While running cmake on the project, I see this warning
  MACOSX_RPATH is not specified for the following targets:

   common_utilities
   cpprest
   httpclient_test
   httplistener_test
   httptest_utilities
   json_test
   pplx_test
   streams_test
   unittestpp
   uri_test
   utils_test
   websocketclient_test
   websockettest_utilities

This warning is for project developers.  Use -Wno-dev to suppress it.

When building the project (at target cpprest), I end up with a bunch of
cpprestsdk/Release/include/cpprest/details/basic_types.h:42
 unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isUint64 );

expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]

fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
The build aborts at this point. I am doing the build on OSX Yosemite 10.10.5 with XCode 7.0.1 installed. Clang version is Apple LLVM version 7.0.0 (clang-700.0.72). I would appreciate some pointers/assistance in getting cpprestsdk to build on this platform. Thanks

P.S. The source I am using is from the github repo.
Oct 19, 2015 at 7:14 AM
Edited Nov 4, 2015 at 12:15 PM
Hi,
I've gotten it to build after adding the following lines to Release/CMakeLists.txt under the clang section of the cmake file
add_definitions("-Wno-error=unused-local-typedefs")
add_definitions("-Wnounused-local-typedefs")
Googling led me to a simlar issue on a different project on github - https://github.com/OpenImageIO/oiio/issues/1089

Some of the test (like the outside_cnn_dot_com) fails. But, looking at it, the test seems to be expecting code 200 for cnn.com, but, it actually does give a 302.

Hope this helps anyone else who runs into this issue. If there is a better way to fix it, I would love to learn it. Thanks

George
Marked as answer by roschuma on 10/28/2015 at 11:09 PM
Coordinator
Oct 29, 2015 at 6:09 AM
Thanks for the detailed analysis here :).

Your fix will definitely work; the only downside is that you'll need to add similar suppressions to your own project.

I have a similar fix available on the clang-3-6 branch of our GitHub project (https://github.com/Microsoft/cpprestsdk/tree/clang-3-6) but the suppression is done with #pragmas so you won't need to modify your build.

This fix should be available in 2.7.0 when it is released.