NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.55k stars 13.04k forks source link

Electron cross-compilation failed #292346

Open avnik opened 4 months ago

avnik commented 4 months ago

Describe the bug

Cross-compilation of electron broken by commit fcdea38355b817b86101b9bb6f717858bc96b4eb (or 9ed4811582532c2b3d3633fff422bd6061ed42f0 if on release-23.11)

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix-build -A pkgsCross.aarch64-multiplatform.electron -j1 --cores 16 It failed with
    [22163/79159] SOLINK host/libffmpeg.so
    FAILED: host/libffmpeg.so host/libffmpeg.so.TOC 
    "python3" "../../build/toolchain/gcc_solink_wrapper.py" --readelf="$READELF_FOR_BUILD" --nm="$NM_FOR_BUILD"  --sofile="host/libffmpeg.so" --tocfile="host/libffmpeg.so.TOC" --output="host/libffmpeg.so" -- $CXX_FOR_BUILD -shared -Wl,-soname="libffmpeg.so" -Wl,-Bsymbolic -L host/gen/third_party/ffmpeg -fuse-ld=lld -Wl,--fatal-warnings -Wl,--build-id=sha1 -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--icf=all -Wl,--color-diagnostics -Wl,--undefined-version -Wl,--no-call-graph-profile-sort -m64 -no-canonical-prefixes -Wl,-O2 -Wl,--gc-sections -rdynamic -Wl,-z,defs -Wl,--as-needed -nostdlib++ -Wl,-rpath=\$ORIGIN -o "host/libffmpeg.so" @"host/libffmpeg.so.rsp"  
    ld.lld: error: /nix/store/x6cavf86yakwzsshlvgbyzilg4rj5j9y-zlib-aarch64-unknown-linux-gnu-1.3/lib/libz.so is incompatible with elf64-x86-64
    clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  2. git revert 9ed4811582532c2b3d3633fff422bd6061ed42f0.
  3. nix-build -A pkgsCross.aarch64-multiplatform.electron -j1 --cores 16 It builds cleanly.

(reproducing done on stable release-23.11 branch (commit 5bf1cadb72ab4e77cb0b700dab76bcdaf88f706b), on master it fail earlier on dependencies, by unrelated issues -- would investigate and report them separately)

Expected behavior

It should cross-compile clean.

Additional context

I have suspicion, that real problem somewhere in order of linkables, but can't proof it. Chromum cross-build looks unaffected, but require additional confirmation (build in progress), only Electron failed.

Notify maintainers

/cc @reedrw as problematic commit author, @yu-re-ka as Electron maintainer and @emilylange as last active contributor to electron/chromium.

Metadata

Reproduced on 9ed4811582532c2b3d3633fff422bd6061ed42f0 if on release-23.11


Add a :+1: reaction to issues you find important.

emilylange commented 4 months ago

Thanks for the report. Makes sense to me.

Will look into fixing this. Should be fairly straight forward and was an oversight from me when I reviewed and merged the commit that broke it.

Sorry for that.

Unfortunately, due to time contrains and especially the lack of chromium maintainers (which electron depends on), we don't have many ressources to throw at always ensuring cross compilation works for chromium and electron.

So not only takes cross-compiling almost twice as much time to compile compared to native builds, it also might break from time to time.

avnik commented 4 months ago

@emilylange I have some time to check/debug, but like to have some hinting as well (some parts of process of chromium/electron build looks pretty cryptic). And yes, full build of electron take ~12 hours for me (using 16-20 cores).

I'll meanwhile check what prevent cross build on master (some depends failed to cross-build -- binlore and yallback, would go fix them to check if problems affect master or not)