nimble
nimble copied to clipboard
nim project complains about missing src/ prefix in hybrid package
What am I doing wrong here?
Prompt: Missing directory /Users/niv/.nimble/pkgs/neverwinter-1.1.1/src/neverwinter. Continue? [y/N]
Package in question: https://github.com/niv/neverwinter.nim
The intent is to have a hybrid package that installs a bunch of binaries, but also ships the library the binaries use for other packages to import.
nimble file
import sequtils, ospaths, strutils
version = "1.1.1"
author = "Bernhard Stöckner <[email protected]>"
description = "Neverwinter Nights 1 data accessor library and utilities"
license = "MIT"
requires "nim >= 0.18.0"
srcDir = "src"
installDirs = @["neverwinter"]
binDir = "bin"
bin = listFiles("src").
mapIt(it.splitFile.name).
filterIt(it.startsWith("nwn_")).
# There appears to be a compiler bug on 0.19.0 that segfaults it when
# compiling nwn_net. So we skip it for 0.19.0.
filterIt(NimVersion != "0.19.0" or it != "nwn_net")
output when installing or using
neverwinter.nim → master • nimble install
Verifying dependencies for [email protected]
Installing [email protected]
Building neverwinter/nwn_resman_pkg using c backend
Building neverwinter/nwn_key_pack using c backend
Building neverwinter/nwn_tlk using c backend
Building neverwinter/nwn_net using c backend
Building neverwinter/nwn_erf using c backend
Building neverwinter/nwn_resman_extract using c backend
Building neverwinter/nwn_twoda using c backend
Building neverwinter/nwn_key_transparent using c backend
Building neverwinter/nwn_gff using c backend
Building neverwinter/nwn_erf_tlkify using c backend
Building neverwinter/nwn_resman_grep using c backend
Building neverwinter/nwn_key_unpack using c backend
Building neverwinter/nwn_resman_cat using c backend
Building neverwinter/nwn_resman_diff using c backend
Building neverwinter/nwn_key_shadows using c backend
Building neverwinter/nwn_resman_stats using c backend
Prompt: [email protected] already exists. Overwrite? [y/N]
Answer: y
Prompt: Missing directory /Users/niv/.nimble/pkgs/neverwinter-1.1.1/src/neverwinter. Continue? [y/N]
Answer: y
Success: neverwinter installed successfully.
nwsync3 → packfiles • nimble build
Verifying dependencies for [email protected]
Info: Dependency on neverwinter@>= 1.1.1 already satisfied
Prompt: Missing directory /Users/niv/.nimble/pkgs/neverwinter-1.1.1/src/neverwinter. Continue? [y/N]
Answer: y
Verifying dependencies for [email protected]
Removing the src/ prefix from everything and storing the binary sources in the repo root, next to the nimble file, seems to work. I think I'm going to go with that for now.
srcDir = "src"
but you've got no src
directory in your package?
Oh, you moved stuff around. Not sure what's going on.
Yes, moving things to the repro root fixed my use case.
The broken one is in git history: https://github.com/niv/neverwinter.nim/tree/c575f5fe8ced15e73ca926fb696ab26dafac20ef
I'm encountering the same error/problem on this branch: https://github.com/iffy/wiish/tree/fix-datafiles
I want to install the wiish
binary as well as all files in the ./src
. Here's what I'm seeing:
$ nimble install
Verifying dependencies for [email protected]
Warning: No .nimble or .nimble-link file found for /Users/matt/.nimble/pkgs/nimx-0.1
...
Installing [email protected]
Building wiish/wiish using c backend
Success: wiish installed successfully.
Prompt: Missing directory /Users/matt/.nimble/pkgs/wiish-0.1.0/src/wiishpkg. Continue? [y/N]
Answer: y
And uninstalling:
$ nimble remove wiish
Looking for wiish (any version)
Warning: No .nimble or .nimble-link file found for /Users/matt/.nimble/pkgs/nimx-0.1
Checking reverse dependencies
Prompt: The following packages will be removed:
... wiish (0.1.0)
... Do you wish to continue? [y/N]
Answer: y
Prompt: Missing directory /Users/matt/.nimble/pkgs/wiish-0.1.0/src/wiishpkg. Continue? [y/N]
Answer: y
Removed wiish (0.1.0)
In the nimble file, I've tried every combination of srcDir
and installDirs
I can think of, but none which installs all the files, and the binary, and doesn't prompt during install.
@iffy Does this not work?
installDirs = @["wiishpkg"]
bin = @["wiish"]
@dom96, yes I finally got it to work (in a different branch), but not if I used srcDir
. Using srcDir
seems to make it not work. But I'm happy putting everything in the root of the repo, so... not a problem for me anymore :)
I ended up with this issue today.
Here's the nimble package directory structure as recommended in the README:
./
├── svvpi.nimble
└── src/
├── includes/
│ └── bar
├── sv/
│ └── foo
├── svvpi/
└── svvpi.nim
Here's the nimble file:
# Package
version = "0.0.1"
author = "Kaushal Modi"
description = "Wrapper for SystemVerilog VPI headers vpi_user.h and sv_vpi_user.h"
license = "MIT"
srcDir = "src"
skipExt = @["bkp"]
installFiles = @["svvpi.nim"]
installDirs = @["svvpi", "includes", "sv"]
# Dependencies
requires "nim >= 1.4.6", "nimterop >= 0.6.13"
When I nimble install
, I get:
Installing [email protected]
Success: svvpi installed successfully.
Prompt: Missing file /home/kmodi/.nimble/pkgs/svvpi-0.0.1/src/svvpi.nim. Continue? [y/N]
Answer: y
Prompt: Missing directory /home/kmodi/.nimble/pkgs/svvpi-0.0.1/src/svvpi. Continue? [y/N]
Answer: y
Prompt: Missing directory /home/kmodi/.nimble/pkgs/svvpi-0.0.1/src/includes. Continue? [y/N]
Answer: y
Prompt: Missing directory /home/kmodi/.nimble/pkgs/svvpi-0.0.1/src/sv. Continue? [y/N]
Answer: y