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

Setting CC variable results in weird option names #1797

Open
berniyh opened this Issue Jan 10, 2019 · 1 comment

Comments

3 participants
@berniyh
Copy link

berniyh commented Jan 10, 2019

commit 9e71ec and commit e6081d introduced the usage of the CC variable to get the compiler, which is a good idea, however the way it's currently implemented I get some odd behavior.
Previously, it was possible to set the compiler using something like
./configure --gcc=foo

After the aforementioned commits, I get an error that this option is unknown.
A look at the configure output reveals why:
./configure --help ... --cp=PROG [/usr/host/bin/cp] --/usr/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc=PROG [/usr/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc] --gmake=PROG [/usr/host/bin/make] ...
where everything between the '--' and '=' is obviously the content of the $CC.
Now that path is correct (/usr/host is a link to /usr/x86_64-pc-linux-gnu), but shouldn't it only be on the right side inside the brackets and not end up on the left?
Of course I can use something like this (and it does actually work)
./configure --/usr/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc=/usr/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc
but I'm not sure if this is what you intended with the option, hence wanted to report it.

The attached patch fixes this by reordering the entries at the downside that (as far as I understood) it probes for gcc first and then tries $CC, so if you have gcc but $CC points somewhere else you would have to set it manually using --gcc=$CC, which should be ok.

On another note, the problem mentioned above also leads to another issue, actually failing the configure, if you set both --cross and --gcc (or whatever option $CC creates). Note that x86_64-pc-linux-gnu is a valid cross host:
./configure --cross=x86_64-pc-linux-gnu probe: host tuple...(pass) x86_64-pc-linux-gnu compute: available architectures...(pass) x86_64 ... find: /usr/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc...(pass) /usr/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc ... find: x86_64-pc-linux-gnu-/usr/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc...(fail) not found : name[0] = x86_64-pc-linux-gnu-/usr/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc ERROR: unable to continue; configure stop.

Same if you set CC to only the program name and not an absolute path. If you unset $CC, then it works properly.
Unfortunately, I'm not firm in python, so I don't know how to fix this one properly.

0001-build-reorder-entries-for-gcc-to-ensure-consistent-o.txt

@bradleysepos

This comment has been minimized.

Copy link
Member

bradleysepos commented Jan 10, 2019

Unfortunately, your patch would break on some systems.

We will look at the build system makefiles and try to fix $CC conflict.

@bradleysepos bradleysepos added the Bug label Jan 10, 2019

@bradleysepos bradleysepos added this to the 1.2.1 milestone Jan 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment