-
Notifications
You must be signed in to change notification settings - Fork 178
Description
Hi, i previously reported an issue with compilation of some user code. It ended being a result of some warning being promoted to errors in more recent versions of GCC. Right now, I'm attempting to compile the pens to visualize the generated .rsf data, but with no success.
How do I inject the include path and library path in the SCons build for it to recognize my libraries.
The OS of choice is NixOS, which makes things very reproducible, but for some reason the SCons configure step does not recognize the installed programs. My current attempt is to compile only the tiff pen, as a case study. The problem is that i do not know how SCons searches the system for environment variables in this step. More specifically, where does it load. For example, here follows the tiff code:
def tiff(context):
context.Message("checking for tiff ... ")
LIBS = path_get(context,'LIBS')
text = '''
#include <tiffio.h>
int main(int argc,char* argv[]) {
TIFF *tiffout;
tiffout = TIFFOpen("test.tif","wb");
return 0;
}\n'''
tiff = context.env.get('TIFF','tiff')
LIBS.append(tiff)
res = context.TryLink(text,'.c')
if res:
context.Result(res)
context.env['TIFF'] = tiff
else:
context.Result(context_failure)
context.env['TIFF'] = None
stderr_write('sfbyte2tif, sftif2byte, and tiffpen will not be built.',
'bold')
need_pkg('libtiff', fatal=False)
LIBS.pop()I'm not even sure if it finds the linker file, which i could point out in the config.py file (i think). The problem is that it doesn't even find the header files to include:
scons: Configure: checking for tiff ...
.sconf_temp/conftest_27d86b58ca69c9cbb4cbb2835620d0a2_0.c <-
|
| #include <tiffio.h>
| int main(int argc,char* argv[]) {
| TIFF *tiffout;
| tiffout = TIFFOpen("test.tif","wb");
| return 0;
| }
|
gcc -o .sconf_temp/conftest_27d86b58ca69c9cbb4cbb2835620d0a2_0.o -c -O2 -x c -std=gnu17 -Wall -pedantic .sconf_temp/conftest_27d86b58ca69c9cbb4cbb2835620d0a2_0.c
.sconf_temp/conftest_27d86b58ca69c9cbb4cbb2835620d0a2_0.c:2:14: fatal error: tiffio.h: No such file or directory
2 | #include <tiffio.h>
| ^~~~~~~~~~
compilation terminated.
Which is strange. In the OS, when the libraries are present, it populates the variable NIX_CFLAGS_COMPILE with the flags of the included libs present in the environmente and then injects in the gcc compiler, which is not happening in the SCons build. The problem is that I simply do not know how to add it to the build, because adding it to CFLAGS, `CCFLAGS``, etc; does not change that compilation step.
$> echo $NIX_CFLAGS_COMPILE
-frandom-seed=kyc7aa8m13 -isystem /nix/store/iyff8129iampdw13nlfqalzhxy8y1hi9-python3-3.13.6/include -isystem /nix/store/wnlv4y888lggq0haibpwfzsl2vhlkciv-libtiff-4.7.0-dev/include -isystem /nix/store/iyff8129iampdw13nlfqalzhxy8y1hi9-python3-3.13.6/include -isystem /nix/store/wnlv4y888lggq0haibpwfzsl2vhlkciv-libtiff-4.7.0-dev/includeSimply put, where to add the specific path for the required program for compiling the pens?
I posted this question on the Nix forums to no avail. https://discourse.nixos.org/t/failing-to-recognize-package-built-with-scons/72920
So, how can i inject in the SCons build system for it to find my libraries and packages and build the pens?