Menu

#1201 The configurator ignores the PATH

3.0 Series
open
nobody
None
5
2018-01-02
2017-12-30
No

In my build box, in addition to the system tools, I have a separate folder (/opt/xbb/bin) with newer versions of some tools, including GCC 7.2.

The PATH is adjusted to include this folder, and starting GCC uses this new version of the compiler.

However, the configurator ignores the PATH, and always picks the system GCC, which is 4.4, as it can be seen.

Fortunately in this case the build passes with 4.4, but it would be better to use the new compiler.

PATH=/opt/xbb/bin:/opt/xbb-bootstrap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

CFLAGS=-g -O2 -pipe -ffunction-sections -fdata-sections
CXXFLAGS=-g -O2 -pipe -ffunction-sections -fdata-sections
CPPFLAGS=-I/opt/xbb/include
LDFLAGS=-L/opt/xbb/lib64 -L/opt/xbb/lib  -static-libstdc++ -Wl,--gc-sections -Wl,-rpath -Wl,"/opt/xbb/lib"

LD_LIBRARY_PATH=/opt/xbb/lib64:/opt/xbb/lib:/opt/xbb-bootstrap/lib64:/opt/xbb-bootstrap/lib:
PKG_CONFIG_PATH=/opt/xbb/lib64/pkgconfig:/opt/xbb/lib/pkgconfig:/usr/lib/pkgconfig

+ gcc --version
+ scons --version
gcc (GCC) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

SCons by Steven Knight et al.:
    script: v3.0.1.74b2c53bc42290e911b334a6b44f187da698a668, 2017/11/14 13:16:53, by bdbaddog on hpmicrodog
    engine: v3.0.1.74b2c53bc42290e911b334a6b44f187da698a668, 2017/11/14 13:16:53, by bdbaddog on hpmicrodog
    engine path: ['/opt/xbb/lib/scons-3.0.1/SCons']
Copyright (c) 2001 - 2017 The SCons Foundation

+ scons --help-options
...
+ scons XGCC_W32_PREFIX=x86_64-w64-mingw32- VERSION=3.02.1 PREFIX=/opt/xbb PREFIX_CONF=/opt/xbb/etc 'SKIPUTILS=NSIS Menu' STRIP_CP=false ZLIB_W32=/opt/xbb/x86_64-w64-mingw32 install
scons: Reading SConscript files ...
Mkdir("build/urelease/config")
Delete("nsis-3.02.1")
Delete(".instdist")
Delete(".test")
Using GNU tools configuration
Checking for linker flag $MAP_FLAG... yes
Checking for linker flag $MAP_FLAG... yes
Checking for memcpy requirement... no
Checking for memset requirement... no
Checking for linker flag -pthread... yes
Checking for __BIG_ENDIAN__... no
x86_64-w64-mingw32-gcc --version
x86_64-w64-mingw32-gcc (GCC) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

g++ --version
g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Checking for C library gdi32... no
Checking for C library user32... no
Checking for C library pthread... yes
Checking for C library iconv... no
Checking for C library shlwapi... no
Checking for C library z... yes

scons: warning: Ignoring missing SConscript 'build/urelease/System/x86-ansi/SConscript'
File "/tmp/xbb/xbb-build/nsis-3.02.1-src/SConstruct", line 717, in <module>

scons: warning: Ignoring missing SConscript 'build/urelease/System/x86-unicode/SConscript'
File "/tmp/xbb/xbb-build/nsis-3.02.1-src/SConstruct", line 717, in <module>
Checking for C library iconv... no
Checking for C library z... yes
Checking for C library zdll... no
Checking for C library z... yes
Checking for C library dl... yes
Checking for C library gdi32... no
Checking for C library iconv... no
Checking for C library pthread... yes
Checking for C library user32... no
Checking for C library z... yes
Checking for C++ library cppunit... no
scons: done reading SConscript files.
scons: Building targets ...
Install file: "COPYING" as "/opt/xbb/share/doc/nsis/COPYING"
Install file: "nsisconf.nsh" as "/opt/xbb/etc/nsisconf.nsh"
x86_64-w64-mingw32-gcc -o build/urelease/stub_bzip2-x86-unicode/bgbg.o -c -Os -Wall -xc -fno-strict-aliasing -DNSISCALL="__attribute__((__stdcall__))" -D_UNICODE -DUNICODE -DEXEHEAD -DWIN32_LEAN_AND_MEAN -D_WIN32_IE=0x0500 -DNSIS_COMPRESS_USE_BZIP2 -Ibuild/urelease/config Source/exehead/bgbg.c
x86_64-w64-mingw32-gcc -o build/urelease/stub_bzip2-x86-unicode/components.o -c -Os -Wall -xc -fno-strict-aliasing -DNSISCALL="__attribute__((__stdcall__))" -D_UNICODE -DUNICODE -DEXEHEAD -DWIN32_LEAN_AND_MEAN -D_WIN32_IE=0x0500 -DNSIS_COMPRESS_USE_BZIP2 -Ibuild/urelease/config Source/exehead/components.c
x86_64-w64-mingw32-gcc -o build/urelease/stub_bzip2-x86-unicode/exec.o -c -Os -Wall -xc -fno-strict-aliasing -DNSISCALL="__attribute__((__stdcall__))" -D_UNICODE -DUNICODE -DEXEHEAD -DWIN32_LEAN_AND_MEAN -D_WIN32_IE=0x0500 -DNSIS_COMPRESS_USE_BZIP2 -Ibuild/urelease/config Source/exehead/exec.c
x86_64-w64-mingw32-gcc -o build/urelease/stub_bzip2-x86-unicode/fileform.o -c -Os -Wall -xc -fno-strict-aliasing -DNSISCALL="__attribute__((__stdcall__))" -D_UNICODE -DUNICODE -DEXEHEAD -DWIN32_LEAN_AND_MEAN -D_WIN32_IE=0x0500 -DNSIS_COMPRESS_USE_BZIP2 -Ibuild/urelease/config Source/exehead/fileform.c
x86_64-w64-mingw32-gcc -o build/urelease/stub_bzip2-x86-unicode/Main.o -c -Os -Wall -xc -fno-strict-aliasing -DNSISCALL="__attribute__((__stdcall__))" -D_UNICODE -DUNICODE -DEXEHEAD -DWIN32_LEAN_AND_MEAN -D_WIN32_IE=0x0500 -DNSIS_COMPRESS_USE_BZIP2 -Ibuild/urelease/config Source/exehead/Main.c

Discussion

  • Jason

    Jason - 2017-12-31

    See the command lines for the stubs?

    x86_64-w64-mingw32-gcc -o build/urelease/stub_bzip2-x86-unicode/Main.o -c -Os ...

    You're using a 64bit compiler to compile 32bit stubs.

    This line is also wrong:

    ZLIB_W32=/opt/xbb/x86_64-w64-mingw32

    It should point to a windows specific zlib library. The easy way to fix that is to add zip2exe to the SKIPUTILS variable on the command line: SKIPUTILS='NSIS Menu','zip2exe' (don't use wrapping quotes).

     
  • Liviu Ionescu (ilg)

    yes, you are probably right, but the reported problem is different.

    do you see the following:

    + gcc --version
    gcc (GCC) 7.2.0
    Copyright (C) 2017 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    

    this was an explicit command I added to the script before starting scons.

    later on, in exactly the same environment, the configurator displays:

    g++ --version
    g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
    

    I have no idea how this happens, but if the configurator ignores the PATH and searches only the system folders, it cannot work properly in my environment, since the system folders are from a very old CentOS 6, and all the new tools are in /opt/xbb/bin:/opt/xbb-bootstrap/bin.

     
  • Anders

    Anders - 2017-12-31

    I think that is just how SCons works. We have a SCons parameter called PATH you can try. There are also overrides for TOOLSET, CC and CXX. Run SCons -H to see these options.

     
  • Liviu Ionescu (ilg)

    are you sure -H is the magic option to see the parameters?

    ilg-mini-harlescu:~ ilg$ docker run -t -i ilegeul/centos:6-xbb-v1
    [root@aca42a8f5aa4 ~]# source /opt/xbb/xbb.sh
    [root@aca42a8f5aa4 ~]# xbb_activate
    [root@aca42a8f5aa4 ~]# scons -H
    usage: scons [OPTION] [TARGET] ...
    
    SCons Options:
      -b, -d, -e, -m, -S, -t, -w, --environment-overrides, --no-keep-going,
      --no-print-directory, --print-directory, --stop, --touch
                                  Ignored for compatibility.
      -c, --clean, --remove       Remove specified targets and dependencies.
      -C DIR, --directory=DIR     Change to DIR before doing anything.
      --cache-debug=FILE          Print CacheDir debug info to FILE.
      --cache-disable, --no-cache
                                  Do not retrieve built targets from CacheDir.
      --cache-force, --cache-populate
                                  Copy already-built targets into the CacheDir.
      --cache-readonly            Do not update CacheDir with built targets.
      --cache-show                Print build actions for files from CacheDir.
      --config=MODE               Controls Configure subsystem: auto, force,
                                    cache.
      -D                          Search up directory tree for SConstruct,
                                    build all Default() targets.
      --debug=TYPE                Print various types of debugging information:
                                    count, duplicate, explain, findlibs, includes,
                                    memoizer, memory, objects, pdb, prepare,
                                    presub, stacktrace, time.
      --diskcheck=TYPE            Enable specific on-disk checks.
      --duplicate=DUPLICATE       Set the preferred duplication methods. Must be
                                    one of hard-soft-copy, soft-hard-copy,
                                    hard-copy, soft-copy, copy
      -f FILE, --file=FILE, --makefile=FILE, --sconstruct=FILE
                                  Read FILE as the top-level SConstruct file.
      -h, --help                  Print defined help message, or this one.
      -H, --help-options          Print this message and exit.
      -i, --ignore-errors         Ignore errors from build actions.
      -I DIR, --include-dir=DIR   Search DIR for imported Python modules.
      --implicit-cache            Cache implicit dependencies
      --implicit-deps-changed     Ignore cached implicit dependencies.
      --implicit-deps-unchanged   Ignore changes in implicit dependencies.
      --interact, --interactive   Run in interactive mode.
      -j N, --jobs=N              Allow N jobs at once.
      -k, --keep-going            Keep going when a target can't be made.
      --max-drift=N               Set maximum system clock drift to N seconds.
      --md5-chunksize=N           Set chunk-size for MD5 signature computation to
                                    N kilobytes.
      -n, --no-exec, --just-print, --dry-run, --recon
                                  Don't build; just print commands.
      --no-site-dir               Don't search or use the usual site_scons dir.
      --profile=FILE              Profile SCons and put results in FILE.
      -q, --question              Don't build; exit status says if up to date.
      -Q                          Suppress "Reading/Building" progress messages.
      --random                    Build dependencies in random order.
      -s, --silent, --quiet       Don't print commands.
      --site-dir=DIR              Use DIR instead of the usual site_scons dir.
      --stack-size=N              Set the stack size of the threads used to run
                                    jobs to N kilobytes.
      --taskmastertrace=FILE      Trace Node evaluation to FILE.
      --tree=OPTIONS              Print a dependency tree in various formats: all,
                                    derived, prune, status.
      -u, --up, --search-up       Search up directory tree for SConstruct,
                                    build targets at or below current directory.
      -U                          Search up directory tree for SConstruct,
                                    build Default() targets from local SConscript.
      -v, --version               Print the SCons version number and exit.
      --warn=WARNING-SPEC, --warning=WARNING-SPEC
                                  Enable or disable warnings.
      -Y REPOSITORY, --repository=REPOSITORY, --srcdir=REPOSITORY
                                  Search REPOSITORY for source and target files.
    [root@aca42a8f5aa4 ~]# 
    
     
    • Anders

      Anders - 2018-01-01

      Sorry, must be -h then, I always mix them up.

       
  • Liviu Ionescu (ilg)

    in my setup, scons -h shows the same as scons -H:

    ilg-mini-harlescu:~ ilg$ docker run -t -i ilegeul/centos:6-xbb-v1
    [root@328fa346a32e ~]# source /opt/xbb/xbb.sh
    [root@328fa346a32e ~]# xbb_activate
    [root@328fa346a32e ~]# scons -h
    usage: scons [OPTION] [TARGET] ...
    
    SCons Options:
      -b, -d, -e, -m, -S, -t, -w, --environment-overrides, --no-keep-going,
      --no-print-directory, --print-directory, --stop, --touch
                                  Ignored for compatibility.
      -c, --clean, --remove       Remove specified targets and dependencies.
      -C DIR, --directory=DIR     Change to DIR before doing anything.
    ...
    
     
    • Anders

      Anders - 2018-01-02

      -h works for me but my SCons is old. You can see our options in the root SConstruct file. Those option descriptions are passed to the SCons Help() function but perhaps the way you activate Help has changed.

       
    • Amir Szekely

      Amir Szekely - 2018-01-02

      These are NSIS specific options, but you're not running scons -h or scons -H in the NSIS source code folder. Other projects may add their own options, so it won't work otherwise. You will only see our specific options when you run those commands in the NSIS source code folder.

       
  • Liviu Ionescu (ilg)

    I'm using the latest scons.

     
  • Jason

    Jason - 2018-01-02

    The options start from about line 153 in Sconstruct, just as reference.

     

Log in to post a comment.

MongoDB Logo MongoDB