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

CCVERSION / CXXVERSION ignore prior setting of CC / CXX #1723

Closed
bdbaddog opened this issue Jan 2, 2018 · 0 comments
Closed

CCVERSION / CXXVERSION ignore prior setting of CC / CXX #1723

bdbaddog opened this issue Jan 2, 2018 · 0 comments

Comments

@bdbaddog
Copy link
Contributor

bdbaddog commented Jan 2, 2018

This issue was originally created at: 2007-09-04 08:58:58.
This issue was reported by: quaestor.
quaestor said at 2007-09-04 08:58:58

I am trying to specify which compiler to use (as I have multiple versions of gcc
installed) by doing

env = Environment(tools=..., toolpath=..., CXX='g++-4.2')

This uses the correct compiler for the actual compilation; however I'm also
using env['CXXVERSION'] to selectively enable features, but this is returning
the version of the default g++ rather than the one I selected.

It looks to me like this line in g++.py...

env['CXX'] = env.Detect(compilers)

...overrides the prior setting, and it then goes on to use that value instead of
mine to determine CXXVERSION (amongst other things). The same thing happens in
gcc.py with env['CC']

Am I using the wrong method to choose a compiler? I couldn't find any reference
to this in the documentation, but I'd think it's a fairly common requirement.
Either way, shouldn't gcc.py and g++.py honour any pre-set value of CC/CXX?

Thanks
Ben

gregnoel said at 2008-06-05 17:46:54

Bug party triage: part of revamping platform and toolchain configuration;
setting CC or CXX does not specify the compile to be selected.

gregnoel said at 2008-07-27 03:44:59

Change all toolchain issues to enhancements scheduled for future p1.

gregnoel said at 2008-11-21 16:38:26

Consolidate toolchain issues as 2.x p3.

gregnoel said at 2008-12-26 13:20:23

Adjust triage of issues.

haubi said at 2014-05-07 08:23:26

Created an attachment (id=934)
Eventually something like this patch would help here?

haubi said at 2014-05-13 01:13:55

Created an attachment (id=935)
test/CC/CCVERSION.py to test for proper CCVERSION variable

haubi said at 2014-05-13 01:20:39

Created an attachment (id=936)
test/CXX/CXXVERSION.py to test for proper CXXVERSION variable

haubi said at 2014-05-13 01:23:45

Erm, attachment#934 leads test/CC/CC.py to hang on AIX.
Ok then, attachment#935 and attachment#936 are testcases for this bug.

haubi said at 2014-05-13 04:23:01

Provided as pull-request#137.

haubi said at 2014-05-15 01:25:58

Re-submitted as pull-request#138.

dirkbaechle said at 2014-05-18 10:37:49

*** Issue 2016 has been marked as a duplicate of this issue. ***

j_ff said at 2016-01-31 12:42:04

Please can give someone a statment about this bug?

Many thanks

Jörg Frings-Fürst
Maintainer of scons at Debian

bdbaddog said at 2016-01-31 13:48:05

Fixed in SCons 2.3.2
Merged to default branch on : 2014-05-18

See:
https://bitbucket.org/scons/scons/pull-requests/138/issue-1723-respect-users-cc-cxx-values-in/diff

For details.

haubi attached scons-issue1723.diff at 2014-05-07 08:23:26.

Eventually something like this patch would help here?

haubi attached CCVERSION.py at 2014-05-13 01:13:55.

test/CC/CCVERSION.py to test for proper CCVERSION variable

haubi attached CXXVERSION.py at 2014-05-13 01:20:38.

test/CXX/CXXVERSION.py to test for proper CXXVERSION variable

dirkbaechle said this issue is duplicated by #2016 at 2014-05-18 10:37:49.

@bdbaddog bdbaddog added this to the 3.x milestone Jan 2, 2018
@bdbaddog bdbaddog closed this as completed Jan 2, 2018
bjornfor pushed a commit to NixOS/nixpkgs that referenced this issue Aug 19, 2022
Prior to this commit, builds of `pkgsCross.*.gpsd` were failing.

`gpsd` expects `CCVERSION` to be set, and fails if it is not set.
Scons does not guarantee that `CCVERSION` will be set, nor does it
specify under what circumstances it will or will not be set: "This may
or may not be set, depending on the specific C compiler being used."

  https://scons.org/doc/production/HTML/scons-man.html#cv-CCVERSION

Apparently cross-compilation triggers one of those unspecified
circumstances.  There are several bug reports to scons relating to
this:

  SCons/scons#1723
  https://github.com/SCons/scons/issues?q=is%3Aissue+ccversion+is%3Aclosed

`gpsd` does not use `CCVERSION` for any purpose other than printing a
log message at the start of the build:

  https://gitlab.com/gpsd/gpsd/-/commit/d0558636038e18d90eb886f668ff5004538f7839

This commit modifies the log message, replacing `env['CCVERSION']`
with `env['CC']`, since `CC` is always set when using nixpkgs'
standard builder.

With this commit, `pkgsCross.mips64el-linux-gnuabi64.gpsd` and
`pkgsCross.powernv.gpsd` build correctly on x86_64.  Prior to this
commit, they would fail with:

```
scons: Reading SConscript files ...
scons version: 4.1.0
scons is running under Python version: 3.10.5.final.0
gpsd version: 3.23.1
This system is: linux
KeyError: 'CCVERSION':
  File "/build/gpsd-3.23.1/SConstruct", line 69:
    SConscript('SConscript',
  File "/nix/store/0vmqv6f2s8bj2a50gk8g05jcb5scnifb-scons-4.1.0/lib/python3.10/site-packages/SCons/Script/SConscript.py", line 654:
    return method(*args, **kw)
  File "/nix/store/0vmqv6f2s8bj2a50gk8g05jcb5scnifb-scons-4.1.0/lib/python3.10/site-packages/SCons/Script/SConscript.py", line 591:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/nix/store/0vmqv6f2s8bj2a50gk8g05jcb5scnifb-scons-4.1.0/lib/python3.10/site-packages/SCons/Script/SConscript.py", line 280:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/build/gpsd-3.23.1/gpsd-3.23.1/SConscript", line 883:
    announce("cc is %s, version %s" % (env['CC'], env['CCVERSION']))
  File "/nix/store/0vmqv6f2s8bj2a50gk8g05jcb5scnifb-scons-4.1.0/lib/python3.10/site-packages/SCons/Environment.py", line 388:
    return self._dict[key]
```
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

1 participant