Configure should check that linking wasm modules works
Categories
(Firefox Build System :: General, defect, P3)
Tracking
(firefox-esr102- fixed, firefox110 fixed, firefox111 fixed)
People
(Reporter: Sylvestre, Assigned: glandium)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
48 bytes,
text/x-phabricator-request
|
pascalc
:
approval-mozilla-beta+
RyanVM
:
approval-mozilla-esr102+
|
Details | Review |
48 bytes,
text/x-phabricator-request
|
pascalc
:
approval-mozilla-beta+
RyanVM
:
approval-mozilla-esr102+
|
Details | Review |
using apt.llvm.org packages:
sudo debootstrap bullseye bullseye.dir
sudo mount -t proc /proc bullseye.dir/proc
sudo mount -t proc /dev/pts bullseye.dir/dev/pts
sudo mount -t tmpfs tmpfs bullseye.dir/dev/shm
sudo chroot bullseye.dir
apt install mercurial wget lsb-release wget software-properties-common gnupg2 python3-distutils python3-pip
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
./llvm.sh 14
hg clone https://hg.mozilla.org/mozilla-central/
cd mozilla-central
echo "export CC=clang-14
export CXX=clang++-14
ac_add_options --enable-bootstrap
" > .mozconfig
./mach bootstrap
./mach build
0:11.90 /usr/bin/clang++-14 -std=gnu++17 --target=wasm32-wasi --sysroot=/root/.mozbuild/sysroot-wasm32-wasi -o rlbox.wasm -Wl,--export-all -Wl,--stack-first -Wl,-z,stack-size=262144 -Wl,--no-entry -Wl,--growable-table ogg_alloc.wasm ogg_bitwise.wasm ogg_framing.wasm xmlparse.wasm xmlrole.wasm xmltok.wasm wasm2c_sandbox_wrapper.wasm mozHunspellRLBoxSandbox.wasm affentry.wasm affixmgr.wasm csutil.wasm hashmgr.wasm hunspell.wasm phonet.wasm replist.wasm suggestmgr.wasm GraphiteExtra.wasm CmapCache.wasm Code.wasm Collider.wasm Decompressor.wasm Face.wasm FeatureMap.wasm FileFace.wasm Font.wasm GlyphCache.wasm GlyphFace.wasm Intervals.wasm Justifier.wasm NameTable.wasm Pass.wasm Position.wasm Segment.wasm Silf.wasm Slot.wasm Sparse.wasm TtfUtil.wasm UtfCodec.wasm call_machine.wasm gr_char_info.wasm gr_face.wasm gr_features.wasm gr_font.wasm gr_logging.wasm gr_segment.wasm gr_slot.wasm json.wasm RLBoxWOFF2Sandbox.wasm table_tags.wasm variable_length.wasm woff2_common.wasm woff2_dec.wasm woff2_out.wasm -lwasi-emulated-process-clocks
0:11.93 clang: error: unable to execute command: Executable "wasm-ld" doesn't exist!
0:11.93 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Reporter | ||
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
wasm-ld is supposed to come with clang. There's a case to be made that we should check in configure rather than failing later, but there's a problem in your packages if wasm-ld is not there.
Reporter | ||
Comment 2•2 years ago
|
||
ok,
it is:
lld-14: /usr/bin/wasm-ld-14
lld has it:
lld:amd64: /usr/bin/lld
lrwxrwxrwx 1 root root 6 Oct 6 17:55 /usr/bin/lld -> lld-14
it is possible to provide it like CXX=clang++-14
?
Assignee | ||
Comment 3•2 years ago
|
||
It's clang that is calling it.
Assignee | ||
Comment 4•2 years ago
|
||
Reporter | ||
Comment 5•2 years ago
|
||
Cool, I will tell the debian packager. thanks ;)
Assignee | ||
Comment 6•2 years ago
|
||
Workaround: use /usr/lib/llvm-14/bin/clang
as CC
(you can unset CXX, it's simpler than also setting it to /usr/lib/llvm-14/bin/clang++
)
which fails on the same command, but with a different error:
wasm-ld: error: unable to find library -lgcc
Assignee | ||
Comment 7•2 years ago
|
||
With llvm-11, the error was:
wasm-ld: error: cannot open /usr/lib/llvm-11/lib/clang/11.1.0/lib/wasi/libclang_rt.builtins-wasm32.a: No such file or directory
I suspect it's actually the same problem, but when it doesn't find the clang runtime, it falls back to libgcc. As a matter of fact, if I switch to clang-13, which gives the same unable to find library -lgcc
error and copy libclang_rt.builtins-wasm32.a from the mozilla clang into /usr/lib/llvm-13/lib/clang/13.0.1/lib/wasi, it succeeds.
So as far as the error itself is concerned, this is RESOLVED INVALID, but we should definitely emit an error during configure.
Assignee | ||
Comment 8•2 years ago
|
||
(sidenote: we'll need that wasi clang runtime to enable rlbox in Debian too ; I thought I had filed a bug, but I can't find it so maybe I didn't)
Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Reporter | ||
Comment 9•2 years ago
|
||
ok, thanks
For people facing this issue, as workaround just add:
ac_add_options --without-wasm-sandboxed-libraries
Reporter | ||
Updated•2 years ago
|
Reporter | ||
Comment 10•2 years ago
|
||
here is the ugly patch I made for Debian:
https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/blob/13/debian/patches/wasm-ld-path.diff
Comment 12•2 years ago
|
||
[Tracking Requested - why for this release]: this caused me build bustage on ESR 102.
Comment 13•2 years ago
|
||
I'll take a patch on ESR102 to make life easier for downstream embedders, but I don't see a need to track this either.
Assignee | ||
Comment 14•1 year ago
|
||
Updated•1 year ago
|
Updated•1 year ago
|
Comment 15•1 year ago
|
||
Pushed by mh@glandium.org: https://hg.mozilla.org/integration/autoland/rev/b5d3998c113c Add more configure checks for the wasm toolchain setup. r=firefox-build-system-reviewers,ahochheiden
Comment 16•1 year ago
|
||
Assignee | ||
Comment 17•1 year ago
|
||
(as opposed to host or wasm)
Comment 18•1 year ago
|
||
Pushed by mh@glandium.org: https://hg.mozilla.org/integration/autoland/rev/2cd1b61ddd24 Only apply stlport flags to configure compiler executions for target. r=firefox-build-system-reviewers,andi https://hg.mozilla.org/integration/autoland/rev/3be300874393 Add more configure checks for the wasm toolchain setup. r=firefox-build-system-reviewers,ahochheiden
Comment 19•1 year ago
|
||
Backed out 3 changesets (Bug 1747145, Bug 1810627) for causing mochitest failures in /test_webassembly_compile.html
Log: https://treeherder.mozilla.org/logviewer?job_id=402747935&repo=autoland&lineNumber=2975
Backout: https://hg.mozilla.org/integration/autoland/rev/3057a2275d31d605e8cade763c03d08fca0806e5
Assignee | ||
Updated•1 year ago
|
Comment 20•1 year ago
|
||
Pushed by mh@glandium.org: https://hg.mozilla.org/integration/autoland/rev/b1326c01f28f Only apply stlport flags to configure compiler executions for target. r=firefox-build-system-reviewers,andi https://hg.mozilla.org/integration/autoland/rev/6c47d6018555 Add more configure checks for the wasm toolchain setup. r=firefox-build-system-reviewers,ahochheiden
Comment 21•1 year ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/b1326c01f28f
https://hg.mozilla.org/mozilla-central/rev/6c47d6018555
Assignee | ||
Comment 22•1 year ago
|
||
Comment on attachment 9312536 [details]
Bug 1747145 - Add more configure checks for the wasm toolchain setup.
ESR Uplift Approval Request
- If this is not a sec:{high,crit} bug, please state case for ESR consideration: Build-only change that is a no-op in practice for most builds. It is preliminary to bug 1810627, which allows downstreams like Debian to enable wasm sandboxing with their packaged wasi SDK.
- User impact if declined: See above
- Fix Landed on Version: 111
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): See above
Beta/Release Uplift Approval Request
- User impact if declined: See ESR request
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: Bug 1810627
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): See ESR request
- String changes made/needed: N/A
- Is Android affected?: No
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Comment 23•1 year ago
|
||
Comment on attachment 9312762 [details]
Bug 1747145 - Only apply stlport flags to configure compiler executions for target.
Beta/Release Uplift Approval Request
- User impact if declined: See other request in the same bug
- Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: Yes
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky):
- String changes made/needed:
- Is Android affected?: Yes
Comment 24•1 year ago
|
||
Comment on attachment 9312536 [details]
Bug 1747145 - Add more configure checks for the wasm toolchain setup.
Approved for 110 beta 4, thanks.
Updated•1 year ago
|
Comment 25•1 year ago
|
||
bugherder uplift |
https://hg.mozilla.org/releases/mozilla-beta/rev/022726db3a2c
https://hg.mozilla.org/releases/mozilla-beta/rev/3a6ceb29e56b
Comment 26•1 year ago
|
||
Comment on attachment 9312536 [details]
Bug 1747145 - Add more configure checks for the wasm toolchain setup.
Approved for 102.8esr.
Updated•1 year ago
|
Comment 27•1 year ago
|
||
bugherder uplift |
https://hg.mozilla.org/releases/mozilla-esr102/rev/76878dedfc38
https://hg.mozilla.org/releases/mozilla-esr102/rev/ecb52b4afec3
Description
•