ttsiodras/MiniForth

compile problem on mac with clang 12.0.5

Closed this issue · 1 comments

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: x86_64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

make

This error occurs on many places. Is there an fix?

In file included from myforth.cpp:4:
In file included from ../src/miniforth.h:39:
../src/compiled_node.h:53:11: error: union member '_string' has a non-trivial default constructor
        } _string;

I use Arch Linux - where I just tested with clang++ v12.0.0:

$ clang++ -v
clang version 12.0.0
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-pc-linux-gnu/10.2.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-pc-linux-gnu/11.1.0
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/11.1.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/10.2.0
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/11.1.0
Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/11.1.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64

$ cd src_x86
$ clang++ -g -I. -I ../src -D PROGMEM="" -D __FlashStringHelper=char -D strcasecmp_P=strcasecmp  -o x86_forth ../src/*.cpp myforth.cpp -fsanitize=address 2>/dev/null

$ echo $?
0

...i.e. successful. I don't know what changed in clang between 12.0.0 and 12.0.5, but in the context of this mini-FORTH, I am quite sure I don't want to spend time tracking it down :-)

Either downgrade, or install gcc - from brew, I guess? (sorry, I am not an OSX guy... I do use a 2012 MBair - which proved to be a magnificent machine, still going strong - but the first thing I did was to install Linux on it).