cannot use comma-separated compiler flags as options value in mozconfig
Categories
(Firefox Build System :: General, defect)
Tracking
(firefox76 affected, firefox77 affected, firefox78 affected)
People
(Reporter: u473386, Unassigned)
References
Details
(Keywords: in-triage)
Attachments
(1 file)
|
3.00 KB,
text/plain
|
Details |
Updated•7 years ago
|
I can confirm this is an issue for me and has been for years, I work around it by just returning 1 in _validate_nargs for local builds...this isn't a valid fix for upstream but it at least lets you use the options you want to.
The issue comes down to the split_option() function in python/mozbuild/mozbuild/configure/options.py, where it creates a tuple from the result of splitting the argument by commas. It almost needs a way of respecting an escaped comma, and then remove the escapes after the fact or something.
Thoughts?
Comment 3•3 years ago
|
||
The bug has a release status flag that shows some version of Firefox is affected, thus it will be considered confirmed.
Updated•3 years ago
|
Comment 4•2 years ago
|
||
This is now a problem for Fedora, because as of current Rawhide (what will become Fedora 39), we have a distro default definition of RUSTFLAGS with commas in it:
RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cforce-frame-pointers=yes -Clink-arg=-Wl,-z,relro -Clink-arg=-Wl,-z,now --cap-lints=warn'
Trying to build Firefox with this RUSTFLAGS fails because of this exact problem:
mozbuild.configure.options.InvalidOptionError: RUSTFLAGS takes 1 value
I did try patching nargs to be "+" for RUSTFLAGS instead of "1", but that's not sufficient to fix it, because the split-on-commas that mparnell described means the commas actually get lost when the flags are passed to the compiler, so it gets garbage flags and fails:
0:29.67 error: failed to run rustc to learn about target-specific information
0:29.67 Caused by:
0:29.67 process didn't exit successfully: /usr/bin/rustc - --crate-name ___ --print=file-names -Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cforce-frame-pointers=yes -Clink-arg=-Wl -z relro -Clink-arg=-Wl -z now --cap-lints=warn --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg (exit status: 1)
0:29.67 --- stderr
0:29.68 error: Unrecognized option: 'z'
I note that our CFLAGS and CXXFLAGS defaults also have commas in them, but it looks like those values aren't parsed through the same parser or already have special handling or something?
Comment 5•2 years ago
|
||
btw, I worked around this for RUSTFLAGS -Clink-arg by -Clink-arg=-z -Clink-arg=relro -Clink-arg=-z -Clink-arg=now or something like that.
Comment 7•1 year ago
|
||
Dupe of Bug 1908637 ?
Comment 8•1 year ago
|
||
Yes. Weird how that one got fixed in days while this one has been sitting around for six years. Oh well, at least it's fixed now.
Comment 9•1 year ago
|
||
🤷🏽 It hadn't affected our continuous integration until now. Not weird at all that it suddenly got more visibility and got seen by the right people.
Description
•