Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

mac mvn build error: thread_local/thread-local #42

Open
ericxsun opened this issue Aug 29, 2018 · 2 comments
Open

mac mvn build error: thread_local/thread-local #42

ericxsun opened this issue Aug 29, 2018 · 2 comments

Comments

@ericxsun
Copy link

ericxsun commented Aug 29, 2018

Error occurred when compile c++ code, ltp/thirdparty/jsoncpp/src/lib_json/json_reader.cpp

For Linux
‘thread_local’ does not name a type

just try to use a compiler that supports c++11

For Mac
thread-local storage is not supported for the current target

ENV

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin14.5.0

how to solve it? Any help will be appreicated

@ericxsun ericxsun changed the title thread_local/thread-local error mvn build error: thread_local/thread-local Aug 29, 2018
@ericxsun ericxsun changed the title mvn build error: thread_local/thread-local mac mvn build error: thread_local/thread-local Aug 29, 2018
@ericxsun
Copy link
Author

ericxsun commented Aug 30, 2018

For mac,

  • first: brew upgrade llvm --with-clang
  • second: replace the default gcc, g++ with newer version

new error occurred

duplicate symbol _main in: ltp4j/target/nar/obj/x86_64-MacOSX-gpp/CMakeCXXCompilerId.d5bef524.o
ld: 1 duplicate symbol for architecture x86_64
```

@hailiang-wang
Copy link

--with-gxx-include-dir=/usr/include/c++/4.2.1

GCC 版本太低了,至少要求4.8

Work around

修改文件thirdparty/jsoncpp/src/lib_json/json_reader.cpp

将 line 49

thread_local static int stackDepth_g = 0;  // see readValue()

修改为:

static __thread int stackDepth_g = 0;  // see readValue()

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants