Hi All,
I just want to give Nim a go on Mac, but I am struggling to pass the build process. I am not very familiar with clang environment, which does not help, but I am willing to push further...
In my environment, I got the latest Xcode command line tools for Mavericks (10.9) which seem to go up to clang 3.4.
I did install LLVM 3.4 via $ brew install llvm34 and also modified the csources build.sh to use (for darwin)
CC="clang++-3.4"
COMP_FLAGS="$COMP_FLAGS -I/usr/local/opt/llvm34/lib/llvm-3.4/include/c++/v1"
which seems to solve the issue I had with modules.map.
I am now getting
- c_code/3_2/msgs.c:1833:15: error: no matching function for call to 'readline_12889'
- LOC15 = readline_12889(f_198142, &res_198144);
- ^~~~~~~~~~~~~~
c_code/3_2/msgs.c:364:21: note: candidate function not viable: 2nd argument ('NimStringDesc *volatile *') would lose volatile qualifier
which seems to relate to a macro expansion using "volatile" and then the compiler complaining that the qualifier will be lost.
Any guidance to move forward would be much appreciated.
Kind regards
I haven't had any problems building the dev version from source. Are you building the dev version? I'm on 10.10.2 now, but I had no problems with 10.9 either. It all built with the instructions provided.
The Xcode I have is based off of LLVM 3.5. You sure you have the latest? You shouldn't need to brew install clang. You may want to unlink the LLVM stuff you installed and just get the Xcode clang going. This should be very straightforward.
Thanks Brian
I got Xcode 6.1.1, on Mavericks - latest latest 6.3 requires Yosemite, which I am not willing to install just now
I followed instructions initially and got module.map error:
carlos-mac:csources carlos$ sh build.sh
clang -w -O3 -fno-strict-aliasing -Ic_code -c c_code/3_2/compiler_nim.c -o c_code/3_2/compiler_nim.o
/usr/include/module.map:36:14: error: header 'float.h' not found
- header "float.h" // note: supplied by compiler
- ^
/usr/include/module.map:81:14: error: header 'stdarg.h' not found
- header "stdarg.h" // note: supplied by the compiler
- ^
/usr/include/module.map:113:14: error: header 'tgmath.h' not foundheader "tgmath.h" // note: supplied by the compiler
As clang --version reported 3.4, then I installed LLVM 3.4.
Maybe I should upgrade my Mac to Yosemite... sniff. I will give a try to XCode 6.2 Beta 5 (latest on Mavericks), as some complained about 6.1 being broken and so... otherwise will update the OS.
Thanks!!
I can install Nim from scratch, both master and devel version, on both Snow Leopard (with Xcode 5.1.1) and Yosemite.
The way you do it in your first post cannot work, because you're using a C++ compiler to compile C code. If you want to go that route, use CC="clang-3.4", not CC="clang++-3.4".
That said, there should be no need to install llvm via homebrew. Xcode provides clang by default, and the Xcode clang version should work just fine. The error in your second post is due to clang for some reason not finding header files that are not in /usr/include (they're in /usr/lib/clang/<clang-version>/include instead). This would indicate either a broken Xcode install or a broken local installation of clang.
Solved...
I had a broken development environment from an old project in my $PATH that I didn't even remembered... 'til today.
xcodebuild -find clang and which clang point me to the answer :)
Thanks a lot!