I'm trying to bootstrap nim v1.6.x on a RHEL 7 server running on IBM POWER9 ppc64lc hardware. Unfortunately, all I have is gcc 4.8.5. (Ancient, I know.) I'm getting the "undefined reference to __builtin_saddll_overflow" messages at the link step when running "sh build.sh".
I searched the forum a lot and see references to "compiling with -d:nimEmulateOverflowChecks". Or using a newer gcc or clang.
I AM able to successfully build nim-1.2.6 but nothing later.
Does having a running nim-1.2.6 help me get further along? i.e., build a later version?
Any suggestions about how to "compile with -d:nimEmulateOverflowChecks"? I'm unfamiliar with nim but am learning.
Thanks, Matt
Well you need to compile with -d:nimEmulateOverflowChecks. :P
The best idea is probably to use a 1.6 Nim on Linux to generate csources for 1.6 with -d:nimEmulateOverflowChecks and then move the csources to your RHEL 7 machine and bootstrap from these custom csources.
Thanks for the reply.
I downloaded the 1.6.12 source and successfully built it on a RHEL 8 server on x86_64. I then ran this command:
./koch csource -d:nimEmulateOverflowChecks
This was successful.
I then tar-ed up the whole nim-1.6.12 dir, copied it over to my RHEL 7 on ppc64le and tried "sh build.sh" and it still fails with the "__builtin_saddll_overflow" messages at link time.
What steps have I missed or done incorrectly?
Do the following since you have 1.6.12 on RHEL 8 server x86_64. Go to the Nim folder where the .nim compiler source code is and edit the installer.ini file, removing the platforms you don't want. In your case, it should just be linux: powerpc64el, if I'm not wrong.
; This config file holds configuration information about the Nim compiler
; and project.
[Project]
Name: "Nim"
Version: "$version"
Platforms: """
linux: powerpc64el
"""
Authors: "Andreas Rumpf"
Now do: koch csource -d:danger -d:nimEmulateOverflowChecks
Take the output from build/ and bring it to your RHEL 7 ppc64le environment. Just build by build.sh or makefile.
The platform removal part of installer.ini aims to shorten the time to produce csource. I know of no other method other than manual removal.
Thank you for the response. Still no success.
Here's what I did:
Am I misinterpreting your suggestion about copying over output of "koch csource"?
Here I managed to successfully compile on Windows 10, amd64 and gcc 4.8.1. Yes, I did the steps I gave you.
Something that can be checked is the .c files, from csource, if they have #define NIM_EmulateOverflowChecks, because __builtin_saddll_overflow is passed by nimbase.h.
5. Copied over entire ./c_code subdir to target server
I believe that here is your mistake. You are copying the c_code folder, which is already precompiled from the downloaded source code. The C source code created with koch csource -d:danger -d:nimEmulateOverflowChecks lives in the ./build folder. So delete the ./build folder and redo the procedure and copy the ./build folder to the ppc64le destinationThat did it. I copied over the ./build subdir to the ppc64le box and ran the build.sh that had been created inside ./build.
$ nim --version Nim Compiler Version 1.6.12 [Linux: powerpc64el] Compiled at 2023-06-22 Copyright (c) 2006-2023 by Andreas Rumpf
active boot switches: -d:release
Thank you for your help.