1

I recently upgraded my Mac OSX from Yosemite to El Capitan and updated Xcode to v7.1. After the upgrades, I found that my C++ application no longer compiles due to a header file that cannot be found:

../../src/dir/sysArea.h:39:10: fatal error: 'boost/thread/tss.hpp' file not found
#include <boost/thread/tss.hpp>

The clang invocation is like this:

clang -g -std=c++11 -fno-inline -Wall -Werror -Wextra -D_LARGEFILE_SOURCE   \
      -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -c                       \
      -o ARCH.darwin_15_i86/debug/file.o file.cpp

I searched my Macintosh using the finder and the file tss.hpp no longer appears to be present. How do I port my application to El Capitan, what is the replacement of Boost's tss.hpp? I tried updating my Boost version from the prior v1.53 to the latest v1.58, but it had no impact, I get the same error when compiling.

export PATH=/usr/local/bin:$PATH
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
sudo chmod o+w /usr/local/opt /usr/local/include /usr/local/lib
brew unlink boost
brew install boost
sudo chmod o-w /usr/local/opt /usr/local/include /usr/local/lib

My C++03 application is including tss.hpp so that it can use the thread_specific_ptr<> feature:

static boost::thread_specific_ptr<Botan::AutoSeeded_RNG> _rng;

for thread local storage (e.g. each thread gets its own version of the static variable.)


The finder was not searching everywhere (would be nice if it did), I do have tss.hpp under /usr/local/include.

I tried adding -stdlib=libc++ and -stdlib=libstdc++ to the clang invocation, but neither got the complier to look in /usr/local/include for the Boost headers. What compiler flags will instruct it to look there other than hardcoding -I/user/local/include?

Note that clang says thread_local is not available as discussed here.

Community
  • 1
  • 1
WilliamKF
  • 41,123
  • 68
  • 193
  • 295
  • Also, are you willing to move to c++11? Then you can forgo boost for this and just use `thread_local` – donkopotamus Oct 27 '15 at 01:04
  • @donkopotamus Yeah, I'm considering that option with `thread_local` at the moment, but would still like the question answered. – WilliamKF Oct 27 '15 at 01:06
  • 1
    Can you confirm that `boost/thread/tss.hpp` is not in `/usr/local/include` ... if not that would seem to be a problem with the `brew` installation. (I don't use `brew`). If it is, then are your compiler flags correct? – donkopotamus Oct 27 '15 at 01:11
  • @donkopotamus Yes the finder was not searching there and misled me into thinking they were not present anymore. How do I instruct the compiler to look in `/usr/local/include` in El Capitan. Note that this was not an issue in Yosemite. – WilliamKF Oct 27 '15 at 01:29
  • Add a `-I/usr/local/include` to your compiler flags, and you'll need to add appropriate `-L` flags to the link stage. – donkopotamus Oct 27 '15 at 01:43
  • @donkopotamus Why were the flags not needed in Yosemite? Shouldn't the compiler be looking there automatically instead of hard coding that? – WilliamKF Oct 27 '15 at 01:52

1 Answers1

0

Doing xcode-select --install as per this answer, seems to have told clang to look in the /usr/local/include directory for headers and resolves the issue.

Community
  • 1
  • 1
WilliamKF
  • 41,123
  • 68
  • 193
  • 295