gnustep / libobjc2

Objective-C runtime library intended for use with Clang.
http://www.gnustep.org/
MIT License
434 stars 118 forks source link

clang 6 on Ubuntu 18.04: error: expected constructor, destructor, or type conversion before ‘objc_method_cache_version’ #73

Closed rwl4 closed 5 years ago

rwl4 commented 6 years ago

Here is the output:

[  7%] Building C object CMakeFiles/objc.dir/properties.m.o
[  7%] Building C object CMakeFiles/objc.dir/blocks_runtime.m.o
[  8%] Building C object CMakeFiles/objc.dir/gc_none.c.o
[  8%] Building CXX object CMakeFiles/objc.dir/objcxx_eh.cc.o
In file included from /home/rwl4/Projects/libobjc2/objc/runtime.h:218:0,
                 from /home/rwl4/Projects/libobjc2/objcxx_eh.cc:6:
/home/rwl4/Projects/libobjc2/objc/slot.h:33:19: error: expected constructor, destructor, or type conversion before ‘objc_method_cache_version’
 _Atomic(uint64_t) objc_method_cache_version;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~
CMakeFiles/objc.dir/build.make:742: recipe for target 'CMakeFiles/objc.dir/objcxx_eh.cc.o' failed
make[2]: *** [CMakeFiles/objc.dir/objcxx_eh.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:99: recipe for target 'CMakeFiles/objc.dir/all' failed
make[1]: *** [CMakeFiles/objc.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

Here's my clang:

$ clang -v
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8.0.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8.0.1
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
davidchisnall commented 6 years ago

It looks as if your clang isn't supporting C11 keywords in C++ mode. That's a bit surprising, because clang does that by default, and clang on FreeBSD, Windows 10, and Ubuntu are doing so for me. Did you set any CXXFLAGS or similar variables to non-default candidates?