-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nimble build
errors on Linux on jtv/v2 branch
#122
Comments
Did you read the con4m doc I sent around yesterday? I wouldn't bother w the dev branch as nothing is the same (including the tests) and that should go away as quickly as we can manage the chalk integration for the v2 branch. |
Yes. And I saw the bit about the new test harness.
OK. Are things in a state where we can work towards getting tests running in CI for the v2 branch? And is it expected that I currently get an error when running $ git log -n1 --oneline
a59a292 (HEAD -> jtv/v2, crashappsec/jtv/v2) Remove the old c4m directory, it's not used.
$ nimble build
...
/tmp/nimble_23954/githubcom_crashappsecnimutils_#1b16dfecc54bda0d6492f96dfe4305bad68ec80d/nimutils/c/strcontainer.c: In function ‘c4str_from_file’:
/tmp/nimble_23954/githubcom_crashappsecnimutils_#1b16dfecc54bda0d6492f96dfe4305bad68ec80d/nimutils/c/strcontainer.c:65:34: error: ‘O_EXLOCK’ undeclared (first use in this function); did you mean ‘O_EXEC’?
65 | int fd = open(name, O_RDONLY|O_EXLOCK);
| ^~~~~~~~
| O_EXEC
/tmp/nimble_23954/githubcom_crashappsecnimutils_#1b16dfecc54bda0d6492f96dfe4305bad68ec80d/nimutils/c/strcontainer.c:65:34: note: each undeclared identifier is reported only once for each function it appears in Edit: same error in CI for PR #121 (which I rebased on top of the v2 branch). |
I updated #120 with crashappsec/nimutils@74130e3 and the latest The next failure for
|
(In my last commit) I did what I could without having time to test on Linux to remove potential linker errors. The problem is, I see no reason why run_0c00l_vm wouldn't have linked, so might need someone else to address since I won't have access to my linux box. |
nimble build
errors on Linux on jtv/v2 branch
For visibility to others: it was because macOS builds enabled LTO, which caused files to be compiled that weren't compiled on Linux. Resolved in #128. |
Before this commit, running `nimble build` on Linux would error at link time with: /usr/bin/ld: /home/runner/.cache/nim/test_r/@Merr@soutput.nim.c.o: in function `customValidationError__errZoutput_u909': @Merr@soutput.nim.c:(.text+0x28c1): undefined reference to `find_string_at' /usr/bin/ld: /home/runner/.cache/nim/test_r/@[email protected]: in function `foreign_z_call': @[email protected]:(.text+0x52d): undefined reference to `run_0c00l_vm' collect2: error: ld returned 1 exit status This happened only when building `test`, and occurred because: - `find_string_at` is defined in codegen.nim - `run_0c00l_vm` is defined in vm.nim and on Linux neither file was compiled when building `test`, which was an item in `bin` in the nimutils nimble file. From the docs [1]: `bin` - A list of files which should be built separated by commas with no file extension required. This option turns your package into a binary package. Nimble will build the files specified and install them appropriately. `nimble build` did work on macOS, but I believe that's only because applyCommonLinkOptions() in nimutils enabled link time optimization (LTO) for macOS only [2]: when defined(macosx): switch("cpu", targetArch) switch("passc", "-flto -target " & targetStr) switch("passl", "-flto -w -target " & targetStr & "-Wl,-object_path_lto,lto.o") elif defined(linux): if staticLink: switch("passc", "-static") switch("passl", "-static") else: discard else: echo "Platform not supported." quit(1) which caused files to be compiled that otherwise wouldn't be. Restructure slightly to allow `nimble build` to succeed without LTO. This is much better than just enabling LTO on Linux, which dramatically increases compilation time with a typical setup. It also wouldn't be ideal for LTO to be _required_, especially for debug builds. Builds would probably be significantly faster with clang, but I tried to get clang builds working on Linux, and was unsuccessful with e.g. CC=clang nimble build \ -f \ --cc:env \ --clang.exe:musl-clang \ --clang.linkerexe:musl-clang \ --passC:-flto \ --passC:-Wno-implicit-function-declaration \ --passC:-Wno-int-conversion \ --passC:-Wno-incompatible-function-pointer-types -d:zippyNoSimd This commit adds a `vm` import in test.nim, and extracts the find_string_at proc to a separate module. It seemed like it wasn't possible to simply add some lines like: import codegen or from codegen import find_string_at due to Nim not supporting mutual imports yet, which is the reason for these importc and exportc in the first place. Closes: #122 [1] https://nim-lang.github.io/nimble/nimble-reference.html#optional [2] https://github.com/crashappsec/nimutils/blob/74130e392d9b/nimutils/nimscript.nim#L76-L89
In the GitHub Actions environment, when trying to run
nimble test
ornim r tests/test.nim
:The text was updated successfully, but these errors were encountered: