Building current Nim 1.2.0 on OpenBSD AMD64. I'm hoping to get Nim 1.2 included into OpenBSD packages.
But when I run build.sh, it eventually dies with this error:
ld: error: undefined symbol: __builtin_saddll_overflow
It seems to be from the end of c_code/nimbase.h
Here's the full context: https://gist.github.com/sivers/a9786ddcca4d2f0f9feb497d13f2311a
If anyone can suggest a patch, I'm happy to help test to get this working.
What's the gcc version?
This is a builtin introduced in GCC7 https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html and Clang 4 (?). Not sure if it has been backported.
We might need a switch for old GCCs.
This is the default on the newest OpenBSD 6.7-BETA :
gcc (GCC) 4.2.1 20070719
… and this is the clang version in OpenBSD 6.7-BETA:
OpenBSD clang version 8.0.1 (tags/RELEASE_801/final) (based on LLVM 8.0.1) Target: amd64-unknown-openbsd6.7 Thread model: posix InstalledDir: /usr/bin
I hope that helps. Thanks for looking into it. Sorry I don't know how to help more directly.
For GCC versions < 5, you must add the -d:nimEmulateOverflowChecks switch.
I'm not sure how to do it with buil_all.sh
Adding it to koch directly works well.
./Koch -d:release -d:nimEmulateOverflowChecks boot
I'm not sure if it is in 1.2
It is.
No need for the old-GCC patch. Instead just have OpenBSD builds use clang. It worked!
$ bin/nim --version
Nim Compiler Version 1.2.0 [OpenBSD: amd64]
Compiled at 2020-04-03
Copyright (c) 2006-2020 by Andreas Rumpf
git hash: 7e83adff84be5d0c401a213eccb61e321a3fb1ff
active boot switches: -d:release
** build.sh ** added line 92:
*openbsd* )
myos="openbsd"
CC="clang"
config/nim.cfg added line 202:
@if freebsd or openbsd or netbsd:
cc = clang
That's all it took! Works great.
Could someone please help make this change (add the cc = clang to build.sh and nim.cfg openbsd lines) as described above?
I thought I'd do it as a pull request at https://github.com/nim-lang/Nim but I don't see where it would go. (Sorry!)
I've also put through the request for OpenBSD to add 1.2.0 to Ports/Packages.