Cannot unpack 'ring' crate
morgandri1
HOBBYOP

6 months ago

Hello!
my app can't seem to compile, after updating my nixpacks config (below), this error came out.

[phases.setup] 
nixPkgs = ["...", "postgresql.lib"]

[packages] 
pkgs = ["...", "postgresql.lib"]
$10 Bounty

23 Replies

flamefusion
FREE

6 months ago

do not use both of them the first one is a phase level and 2nd one is top level both do the similar work so use one only

The problem is that you are defining the packages in two different ways in the same file. Nixpacks is likely getting confused by the duplicate declarations. You only need to specify the packages once.

example

# nixpacks.toml

[phases.setup]

# This tells Nixpacks to add the PostgreSQL client library (libpq)

# to the environment before the build starts.

# The "..." ensures that all default packages are still included.

nixPkgs = ["...", "postgresql.lib"]


morgandri1
HOBBYOP

6 months ago

using only the [phases.setup] or [packages] config change returns the CC linker error, whereas using both stops the CC linker error, but halts the build due to not being able to compile Ring. what can i do about this?


6 months ago

This shouldn't be related to the PGSQL package. Could you send the full build log? (the button to download it should be just to the right of the search box)


morgandri1
HOBBYOP

6 months ago

Hey there, sorry i just saw this.
here's the logfile.

1415745645167251518


6 months ago

Try adding postgresql.lib to nixLibs as well.


morgandri1
HOBBYOP

6 months ago

any way for me to test this locally instead of continuing to add commits to my repo?


morgandri1
HOBBYOP

6 months ago

and failed railway builds


6 months ago

You can install Nixpacks locally: https://nixpacks.com/docs/install


morgandri1
HOBBYOP

6 months ago

kk, didnt know if yall used a custom bundler around it


6 months ago

And then use nixpacks build .


morgandri1
HOBBYOP

6 months ago

this did it


6 months ago

Great!


morgandri1
HOBBYOP

6 months ago

@root interestingly, it fixed it when using nixpacks build ., but not when deploying to railway. here's the new logs:

1415749311463034921


morgandri1
HOBBYOP

6 months ago

scratch that, hasn't fixed it on local nixpacks either.


6 months ago

Alright, try adding libpq-dev to your aptPkgs list.


morgandri1
HOBBYOP

6 months ago

still got a massive CC linker error


morgandri1
HOBBYOP

6 months ago

i can send it here if you'd like but im not sure itll be much use


morgandri1
HOBBYOP

6 months ago

note: /nix/store/z91k46jmcm1lz2c3xl6ffaic887r6w3h-binutils-2.43.1/bin/ld: cannot find -lp
q: No such file or directory
8.776           collect2: error: ld returned 1 exit status

morgandri1
HOBBYOP

6 months ago

not sure if this is any use


6 months ago

Could you send your full nixpacks.toml?


Status changed to Open brody 6 months ago


morgandri1
HOBBYOP

6 months ago

[packages] 
pkgs = ["...", "postgresql.lib"]

[phases.setup]
nixLibs = ["...", "postgresql.lib"]

6 months ago

Move pkgs to nixPkgs in phases.setup.


morgandri1
HOBBYOP

6 months ago

8.816 error: linking with `cc` failed: exit status: 1
...
= note: /nix/store/z91k46jmcm1lz2c3xl6ffaic887r6w3h-binutils-2.43.1/bin/ld: cannot find -lp
q: No such file or directory
8.816           collect2: error: ld returned 1 exit status

Loading...