mercredi 1 avril 2015

Can a C++ text app compiled on OS X 10.8 be expected to work on 10.9 and 10.10?

TL;DR: Text-based C++11/Boost/Openssl application built on OS X 10.8. Should that same compiled binary also work unchanged on 10.9 and 10.10? Or must I compile it for every release?




Details:


C++11 application and static library which uses openssl, and boost::regex, boost::asio, and boost::system. I'm using cmake (since this is a port from Linux + Windows) and everything builds and runs fine on 10.8.2 [Mountain Lion].


But when the application is installed on a newer OS X such as 10.9, we're seeing this error:



dyld: Symbol not found: __ZTISt16invalid_argument
Referenced from: /usr/bin/myapp
Expected in: /usr/local/lib/libboost_regex-mt.dylib
in /usr/bin/myapp
Trace/BPT trap: 5


libboost_regex-mt.dylib did not find __ZTISt16invalid_argument. I'm guessing std::invalid_argument should be in libc++, so something has gone wrong. (Is this part of the libstdc++ versus libc++ problem I keep hearing about?)


This is how I find my library dependencies in cmake:



SET ( Boost_DEBUG 0 )
SET ( Boost_USE_STATIC_LIBS OFF )
SET ( Boost_USE_MULTITHREADED ON )
SET ( Boost_USE_STATIC_RUNTIME OFF ) # also tried "ON"
FIND_PACKAGE ( Boost REQUIRED COMPONENTS regex system date_time )
FIND_PACKAGE ( OpenSSL REQUIRED )
FIND_PACKAGE ( Threads REQUIRED )


These are the flags I set to build:



SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic -std=c++11 -stdlib=libc++ -DMAC_OS_X_VERSION_MIN_REQUIRED=1000" )


When I first run cmake it displays the following:



-- The C compiler identification is AppleClang 5.1.0.5030040
-- The CXX compiler identification is AppleClang 5.1.0.5030040
...
-- Check for working CXX compiler: /Applications/http://ift.tt/1qM1lu4 -- works
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features - done

Aucun commentaire:

Enregistrer un commentaire