nim-lang / nimble

Package manager for the Nim programming language.
Other
1.25k stars 188 forks source link

error compiling nimble #1248

Open dapiam opened 1 month ago

dapiam commented 1 month ago

Hello,

I am trying to compile nimble on arm64 and I am getting the following error.

(base) root@2894f0eebfa3:/apps# git clone https://github.com/nim-lang/nimble.git && cd nimble/src
Cloning into 'nimble'...
remote: Enumerating objects: 7221, done.
remote: Counting objects: 100% (1870/1870), done.
remote: Compressing objects: 100% (500/500), done.
remote: Total 7221 (delta 1505), reused 1625 (delta 1344), pack-reused 5351
Receiving objects: 100% (7221/7221), 3.30 MiB | 28.18 MiB/s, done.
Resolving deltas: 100% (4678/4678), done.

(base) root@2894f0eebfa3:/apps/nimble/src# nim compile nimble
Hint: used config file '/apps/nim-1.4.6/config/nim.cfg' [Conf]
Hint: used config file '/apps/nim-1.4.6/config/config.nims' [Conf]
Hint: used config file '/apps/nimble/config.nims' [Conf]
Hint: used config file 'nimble.nim.cfg' [Conf]
....................................
/apps/nimble/src/nimble.nim(14, 13) Error: cannot open file: sat/sat

I am following this post to be able to use mosdepth on arm64 https://github.com/brentp/mosdepth/issues/144#issuecomment-840092017

thank you

nealie commented 1 month ago

This is also happening on FreeBSD/amd64. No sign of sat.nim anywhere.

jmgomez commented 1 month ago

You need to compile it with nimNimbleBootstrap nim c -d:nimNimbleBootstrap -d:release src/nimble.nim but make sure you have the deps in dist/sat/src/sat/sat

See how nim does it https://github.com/nim-lang/Nim/blob/925dc5c1319bce935593cc12380feec1538e2ce5/koch.nim#L157

nealie commented 1 month ago

Error: cannot open file: /dist/sat/src/sat/sat

I am packaging nimble for FreeBSD ports and so I build it in isolation, not as part of the nim install. This has always worked in the past. Nevertheless, the sat.nim file does not exist in the nim 2.0.8 release.

dapiam commented 1 month ago

same error

(base) root@2894f0eebfa3:/apps/nimble# nim c -d:nimNimbleBootstrap -d:release src/nimble.nim
Hint: used config file '/apps/nim-1.4.6/config/nim.cfg' [Conf]
Hint: used config file '/apps/nim-1.4.6/config/config.nims' [Conf]
Hint: used config file '/apps/nimble/config.nims' [Conf]
Hint: used config file '/apps/nimble/src/nimble.nim.cfg' [Conf]
....................................
/apps/nimble/src/nimble.nim(12, 29) Error: cannot open file: ../dist/sat/src/sat/sat
dapiam commented 1 month ago

and if I try to compile sat

(base) root@2894f0eebfa3:/apps/sat# nim c src/sat/sat
Hint: used config file '/apps/nim-1.4.6/config/nim.cfg' [Conf]
Hint: used config file '/apps/nim-1.4.6/config/config.nims' [Conf]
......
/apps/sat/src/sat/sat.nim(213, 10) Error: selector must be of an ordinal type, float or string
jmgomez commented 1 month ago

Error: cannot open file: /dist/sat/src/sat/sat

I am packaging nimble for FreeBSD ports and so I build it in isolation, not as part of the nim install. This has always worked in the past. Nevertheless, the sat.nim file does not exist in the nim 2.0.8 release.

Please read my previous reply

@dapiam I dont think you can compile sat with nim 1.4.6 you need a newer version of nim

nealie commented 1 month ago

I read your previous reply and tried the nimNimbleBootstrap flag, but there is still no sat.nim file anywhere. Nim 2.0.8 is already installed, but it looks like I'm going to have to drag the nim source in as well to get it, which is a pain.

jmgomez commented 1 month ago

@nealie if you look at the code there you will see how koch downloads the sat repo from there in order to bootstrap nimble. You dont need the nim sources, you just need the sat one. Follow what the code does

nealie commented 1 month ago

Now you got me worried that I missed yet another one of the git downloads by koch. I've had to strip them all out as they're fundamentally incompatible with the FreeBSD ports system. I'm going to have to go back to the nim port and check that it's not independently downloading stuff. I will then try and add sat into the nimble port, but using the proper ports mechanisms.

Ah well, there goes an easy port update.

jmgomez commented 1 month ago

Cant you just do build_all.sh? It will build nimble for you anyways. Wait for this to be merged https://github.com/nim-lang/Nim/pull/23883 if you want this exact same version

nealie commented 1 month ago

Nope. It pulls in random bits of git without checksumming the code, so it could be anything. Within the FreeBSD ports system, only the infrastructure is allowed to download anything, as it does all the checking needed to ensure a safe and correct build.

dapiam commented 1 month ago

with nim 2.0.8

(base) root@9059dc4438d3:/apps/nim-2.0.8# nim -v
Nim Compiler Version 2.0.8 [Linux: arm64]
Compiled at 2024-07-24
Copyright (c) 2006-2023 by Andreas Rumpf

active boot switches: -d:release
(base) root@9059dc4438d3:/apps/# git clone https://github.com/nim-lang/nimble.git
Cloning into 'nimble'...
remote: Enumerating objects: 7221, done.
remote: Counting objects: 100% (1731/1731), done.
remote: Compressing objects: 100% (495/495), done.
remote: Total 7221 (delta 1369), reused 1492 (delta 1210), pack-reused 5490
Receiving objects: 100% (7221/7221), 3.33 MiB | 30.44 MiB/s, done.
Resolving deltas: 100% (4670/4670), done.

(base) root@9059dc4438d3:/apps# cd nimble/
(base) root@9059dc4438d3:/apps/nimble# nim c -d:nimNimbleBootstrap -d:release src/nimble.nim
Hint: used config file '/apps/nim-2.0.8/config/nim.cfg' [Conf]
Hint: used config file '/apps/nim-2.0.8/config/config.nims' [Conf]
Hint: used config file '/apps/nimble/config.nims' [Conf]
Hint: used config file '/apps/nimble/src/nimble.nim.cfg' [Conf]
.............................................................................................................................................
/apps/nimble/src/nimble.nim(12, 29) Error: cannot open file: ../dist/sat/src/sat/sat
Araq commented 1 month ago

Nope. It pulls in random bits of git without checksumming the code, so it could be anything.

That's not how "git checkout faf1617f44d7632ee9601ebc13887644925dcc01" works...

nealie commented 1 month ago

I see that unless nimNimbleBootstrap is defined, nimble.nim tries to import sat/sat. Does this mean that it should have been installed by nim's koch already? It doesn't seem to be documented anywhere in the system library documentation.

I realise that in the general koch build process, it will fetch sat and nimble and build them together after it's build nim, but just humour me that this is not the way it's done with my ports on FreeBSD, so I have to be able to build nimble standalone with just nim pre-installed, along with all of the standard libraries.

Araq commented 1 month ago

I don't know. Nimble is shipped with Nim and the releases are tied together. You're not supposed to build Nimble yourself. Use koch nimble --latest to get the latest Nimble.

In other words, if your package manager offers "nimble" as a separate entry from "nim", it's broken already, IMO.