I've update to 1.6.8 (which I had tried in the past, while in devel) and unfortunately I've been welcomed with an error:
error: invalid argument '-std=gnu++14' not allowed with 'Objective-C'
Error: execution of an external compiler program 'clang++ -c -std=gnu++14 -funsigned-char -w -ferror-limit=3 -DNDEBUG -fvisibility=hidden -I"/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras/mimalloc/include" -I/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras -DWEBVIEW_COCOA=1 -O3 -framework Foundation -framework AppKit -x objective-c -I/Users/drkameleon/.choosenim/toolchains/nim-1.6.8/lib -I/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras -I/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras -I/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src -o /Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/.cache/window.cc.o /Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras/window/window.cc' failed with exit code: 1
The file that triggers the error is here: https://github.com/arturo-lang/arturo/blob/master/src/extras/webview/webview-unix.cc
Apparently, the problem is this -std=gnu++14 coming from here: https://github.com/nim-lang/Nim/blob/devel/compiler/extccomp.nim#L94 (here, it's set to -std=gnu++17, but apparently that has changed).
Since this is a 3rd-party module that I have literally struggled to - finally - get to compile, is there any way I can "unset" it, on-demand, so that I can try the freshly released 1.6.8?
If you consider that worthy of an issue/PR @ GitHub, I'll definitely do it.
It didn't get backported to 1.6.8
Bummer.
I think I will agree... I believe the culprit is this PR you mentioned:
https://github.com/nim-lang/Nim/pull/19938
The problem is... the project is written purely in Nim + C (and Arturo), with literally one .cc file, which - as I said previously - I struggled to get it to compile (without changing the main compiler to a C++ mode).
So, this PR sounds like a bit of a disaster for my case...
You can find the entire project here: https://github.com/arturo-lang/arturo
I build with ./build.nims install
The resulting compilation command+flags for the above test are:
nim c --skipUserCfg:on --colors:off -d:danger --panics:off --mm:orc -d:useMalloc --checks:off -d:ssl --cincludes:extras --nimcache:.cache --path:src --embedsrc:on -d:DEV --listCmd --verbosity:1 --hints:on --warning:ProveInit:off --passL:"-lpthread -lm" -o:bin/arturo src/arturo.nim
The file in question (webview-unix.cc: https://github.com/arturo-lang/arturo/blob/master/src/extras/webview/webview-unix.cc) is being compiled here:
https://github.com/arturo-lang/arturo/blob/master/src/extras/webview.nim#L26-L44
The relevant portion (for macOS, where I'm testing it) is:
{.compile("webview/webview-unix.cc","-std=c++11").}
{.passC: "-DWEBVIEW_COCOA=1".}
{.passL: "-lstdc++ -framework WebKit".}
When compiling with Nim 1.6.6, the actual command is:
clang -c -w -ferror-limit=3 -DNDEBUG -fvisibility=hidden -I"/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras/mimalloc/include" -I/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras -DWEBVIEW_COCOA=1 -O3 -std=c++11 -I/Users/drkameleon/.choosenim/toolchains/nim-1.6.6/lib -I/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras -I/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras -I/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src -o /Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/.cache/webview-unix.cc.o /Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras/webview/webview-unix.cc
For 1.6.8, the command becomes:
clang++ -c -std=gnu++14 -funsigned-char -w -ferror-limit=3 -DNDEBUG -fvisibility=hidden -I"/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras/mimalloc/include" -I/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras -DWEBVIEW_COCOA=1 -O3 -std=c++11 -I/Users/drkameleon/.choosenim/toolchains/nim-1.6.8/lib -I/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras -I/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras -I/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src -o /Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/.cache/webview-unix.cc.o /Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras/webview/webview-unix.cc
It should be worth noting that:
Any ideas to make this work somehow?
P.S. Since this injection is apparently based solely on the {.compile... file extension, I decided to change this specific file's extension to .c (as a hack, obviously) - but then, it's Clang that expects a C-file and finds options that don't go with C...
Error: execution of an external compiler program 'clang++ -c -std=gnu++14 -funsigned-char -w -ferror-limit=3 -DNDEBUG -fvisibility=hidden -I"/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras/mimalloc/include" -I/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras -DWEBVIEW_COCOA=1 -O3 -framework Foundation -framework AppKit -x objective-c -I/Users/drkameleon/.choosenim/toolchains/nim-1.6.8/lib -I/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras -I/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras -I/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src -o /Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/.cache/window.cc.o /Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras/window/window.cc' failed with exit code: 1
Looking at this command line, the problem here is not clang++ - it's rather -x objective-c - basically, the command line is telling the compiler to treat the file as an objective-c file when in reality it's a C++ file - this looks like it needs a fix on the arturo side so that the correct flags are passed to the compiler.
The change from gnu++14 to gnu++17
This significantly bumps the version requirement for the C++ compiler on which nim is used - ie it will break quite a bit of existing systems
The issue seems to be fixed after converting -x objective-c to -x objective-c++ for Mac builds.
I'll update you on the issue! :)
It would be really nice if we could use -std=c++14
it would be even nicer if no flags were needed for the nim-generated code, such that projects could use whatever flags they want and nim only generated very conservative stuff (ie c++11 at this point)