Skip to content
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

nim project complains about missing src/ prefix in hybrid package #582

Open
niv opened this issue Nov 13, 2018 · 8 comments
Open

nim project complains about missing src/ prefix in hybrid package #582

niv opened this issue Nov 13, 2018 · 8 comments

Comments

@niv
Copy link

niv commented Nov 13, 2018

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 <niv@nwnx.io>"
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 neverwinter@1.1.1
 Installing neverwinter@1.1.1
   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: neverwinter@1.1.1 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 nwsync3@0.1.3
      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 neverwinter@1.1.1
@niv
Copy link
Author

niv commented Nov 13, 2018

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.

@dom96
Copy link
Collaborator

dom96 commented Nov 13, 2018

srcDir = "src" but you've got no src directory in your package?

@dom96
Copy link
Collaborator

dom96 commented Nov 13, 2018

Oh, you moved stuff around. Not sure what's going on.

@niv
Copy link
Author

niv commented Nov 13, 2018

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

@iffy
Copy link
Contributor

iffy commented Nov 20, 2018

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 wiish@0.1.0
   Warning: No .nimble or .nimble-link file found for /Users/matt/.nimble/pkgs/nimx-0.1
...
 Installing wiish@0.1.0
   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.

@dom96
Copy link
Collaborator

dom96 commented Nov 22, 2018

@iffy Does this not work?

installDirs   = @["wiishpkg"]
bin = @["wiish"]

@iffy
Copy link
Contributor

iffy commented Nov 24, 2018

@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 :)

@kaushalmodi
Copy link
Contributor

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 svvpi@0.0.1
   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

kaushalmodi added a commit to kaushalmodi/nim-svvpi that referenced this issue May 13, 2021
This is necessary as I am planning to add Nim sub-modules like
svvpi/dpi in future commits.

I cannot keep all the source code under an src/ directory, otherwise I
run into this issue -->
nim-lang/nimble#582 (comment)
. Thus I am moving all source code to the root of this git repo.
stoneface86 added a commit to stoneface86/libtrackerboy that referenced this issue Aug 10, 2022
see nim-lang/nimble#582
fix nimble file not installing library modules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants