Failing to Recognize Package Built with SCons

I’m currently attempting to build the software Madagascar, which is used to parse and visualize .rsf files. My derivation is in the repo: https://github.com/Sacolle/nix-madagascar/tree/main .It’s built with gcc13std due to some files using implicit declarations, which was promoted to an error in latter version of gcc. It is packaged with SCons, which is a build tool i’ve never used, but the base mkDerivation worked well. The problem is that the pens, programs to visualize the .vpl files that it writes are not being built. This is show clearly in the nix log of the derivation:

scons: Reading SConscript files ...
/build/source/framework/rsf/path.py:37: SyntaxWarning: invalid escape sequence '\s'
  check = re.match("(?:%s\s+)?datapath=(\S+)" % os.uname()[1],
checking platform ... (cached) posix [unknown]
checking for C compiler ... (cached) gcc
checking if gcc works ... yes
checking if gcc accepts '-x c -std=gnu17 -Wall -pedantic' ... yes
checking for ar ... (cached) ar
checking for rpc ... no
checking complex support ... yes
checking for X11 headers ... (cached) no
checking for OpenGL ... no
checking for sfpen ... (cached) no

  sfpen (for displaying .vpl images) will not be built.
checking for ppm ... no
checking for tiff ... no

  sfbyte2tif, sftif2byte, and tiffpen will not be built.
checking for GD (PNG) ... no

...

Which is due to missing packages.

The problem is even adding the missing packages into the build inputs, native build inputs, etc, SCons still does not recognize them. The script that does that in the package is the file: https://github.com/ahay/src/blob/3cd212fda36aeba82a598e93d162818c49adb385/framework/configure.py
I’ve tried many options, but i’m still a beginner at NixOS and do not know what is going wrong.

So, anyone with knowledge of SCons could help me compile those pens, i’d be grateful.

2 Likes

I don’t know, could you send the complete log?

Ofcourse, the whole file is >4k lines, so i put it on the project’s github.
https://github.com/Sacolle/nix-madagascar/blob/51304f043d394027d4873b08280edf61ec017913/current_derivation_out.log.

I think the relevant part is in the configure step (the first 200 lines of the log), but i don’t know. Does anyone know of a derivation that uses SCons, so that i can see how they did it?

Figured it out

Thanks to @sfomel, from the madagascar package itself, he showed me that i can pass the SCons variables as arguments for the configure. This does not answer why it doesn’t recognize the nix set one’s, but it let’s me get somewhere.

The problem that arose is that, passing " or $ characters as part of the flags broke the config. This was due to the way parsing was passed between nix, bash and scons. After a lot of time, i came to this answer which i cannot find the original post.

preConfigure = ''
        configureFlagsArray+=(
          "CFLAGS=${mkIncludePaths [ libtiff.dev libx11.dev python313 ] }"
          "LIBPATH=${mkLibPaths [ libtiff.out libx11.out ] }"
        )
      '';

As using the configureFlagsArray inside preConfigure circunvents this problem completely.

Why, i do not know, but now it works.