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

Cross compiling from Linux to Windows doesn't work #196

Open
999eagle opened this issue Aug 26, 2019 · 3 comments
Open

Cross compiling from Linux to Windows doesn't work #196

999eagle opened this issue Aug 26, 2019 · 3 comments
Labels

Comments

@999eagle
Copy link

I would like to be able to cross compile mozjs from Linux to Windows, but cargo build --target x86_64-pc-windows-gnu fails with this error:

error: failed to run custom build command for `mozjs_sys v0.61.13`

Caused by:
  process didn't exit successfully: `/home/sophie/temp/minimal-mozjs/target/debug/build/mozjs_sys-fff148f5ad053bb7/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `"x86_64-unknown-linux-gnu"`,
 right: `"x86_64-pc-windows-msvc"`: Only cross-compiling from x64 is supported', /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.13/build.rs:23:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed

This was tried in a minimal project containing only a dependency on mozjs v0.10.1. I have a toolchain set up for cross-compiling and didn't have any problems with cross compiling other -sys libraries.

@jdm
Copy link
Member

jdm commented Aug 26, 2019

You can try commenting out the check in build.rs.

@999eagle
Copy link
Author

Commenting out the check gave me this error:

error: failed to run custom build command for `mozjs_sys v0.61.13`

Caused by:
  process didn't exit successfully: `/home/sophie/temp/minimal-mozjs/target/debug/build/mozjs_sys-fff148f5ad053bb7/build-script-build` (exit code: 101)
--- stderr
makefile.cargo:168: *** recipe commences before first target.  Stop.
thread 'main' panicked at 'assertion failed: result.success()', /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.13/build.rs:136:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

So I've downgraded to mozjs-sys 0.61.8, which didn't have the check and no special configuration for cross-compiling from x64 Windows to x86 Windows. There I'm getting this error:

error: failed to run custom build command for `mozjs_sys v0.61.8`

Caused by:
  process didn't exit successfully: `/home/sophie/temp/minimal-mozjs/target/debug/build/mozjs_sys-341a404da2fa6945/build-script-build` (exit code: 101)
--- stdout
[[ /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/configure -ot /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/configure.in ]] && touch /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/configure || true
[[ /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/old-configure -ot /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/old-configure.in ]] && touch /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/old-configure || true
! [[ /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/configure.in -ot /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/configure ]] && touch /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/configure || true
! [[ /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/old-configure.in -ot /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/old-configure ]] && touch /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/old-configure || true
if [[ /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/configure -nt /home/sophie/temp/minimal-mozjs/target/x86_64-pc-windows-gnu/debug/build/mozjs_sys-07137dbc4f3723bc/out/config.status ]] ; then \
  cd /home/sophie/temp/minimal-mozjs/target/x86_64-pc-windows-gnu/debug/build/mozjs_sys-07137dbc4f3723bc/out && \
  PYTHON="" MOZ_TOOLS="" \
  CC="x86_64-pc-windows-gnu-gcc" CFLAGS="" \
  CPP="x86_64-pc-windows-gnu-gcc -E" CPPFLAGS="" \
  CXX="x86_64-pc-windows-gnu-g++" CXXFLAGS="" \
  AS="" AR="x86_64-pc-windows-gnu-ar" \
  STLPORT_LIBS="" \
  /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/configure --disable-jemalloc --disable-js-shell --disable-tests --disable-shared-js --build-backends=RecursiveMake --target=x86_64-pc-windows-gnu --disable-gold --disable-shared-js || (cat config.log && exit 1) ; \
fi
Creating Python environment
New python executable in /home/sophie/temp/minimal-mozjs/target/x86_64-pc-windows-gnu/debug/build/mozjs_sys-07137dbc4f3723bc/out/_virtualenv/bin/python2.7
Also creating executable in /home/sophie/temp/minimal-mozjs/target/x86_64-pc-windows-gnu/debug/build/mozjs_sys-07137dbc4f3723bc/out/_virtualenv/bin/python
Installing setuptools, pip, wheel...done.
running build_ext
copying build/lib.linux-x86_64-2.7/psutil/_psutil_linux.so -> psutil
copying build/lib.linux-x86_64-2.7/psutil/_psutil_posix.so -> psutil

Error processing command. Ignoring because optional. (optional:packages.txt:comm/build/virtualenv_packages.txt)
Reexecuting in the virtualenv
checking for vcs source checkout... no
checking for a shell... /usr/bin/sh
checking for host system type... x86_64-pc-linux-gnu
checking for target system type... INFO: checking for vcs source checkout...
INFO: no
INFO: checking for a shell...
INFO: /usr/bin/sh
INFO: checking for host system type...
INFO: x86_64-pc-linux-gnu
INFO: checking for target system type...

--- stderr
Invalid configuration `x86_64-pc-windows-gnu': machine `x86_64-pc-windows' not recognized
Traceback (most recent call last):
  File "/home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/../../configure.py", line 127, in <module>
    sys.exit(main(sys.argv))

--- snip ---

  File "/home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/build/moz.configure/init.configure", line 723, in config_sub
    return subprocess.check_output([shell, config_sub, triplet]).strip()
  File "/usr/lib64/python2.7/subprocess.py", line 223, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '[u'/usr/bin/sh', u'/home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/build/moz.configure/../autoconf/config.sub', u'x86_64-pc-windows-gnu']' returned non-zero exit status 1
make: *** [makefile.cargo:173: maybe-configure] Error 1
thread 'main' panicked at 'assertion failed: result.success()', /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/build.rs:114:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

So next I changed the target to x86_64-pc-windows in makefile.cargo and got this error:

error: failed to run custom build command for `mozjs_sys v0.61.8`

Caused by:
  process didn't exit successfully: `/home/sophie/temp/minimal-mozjs/target/debug/build/mozjs_sys-341a404da2fa6945/build-script-build` (exit code: 101)
--- stdout
[[ /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/configure -ot /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/configure.in ]] && touch /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/configure || true
[[ /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/old-configure -ot /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/old-configure.in ]] && touch /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/old-configure || true
! [[ /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/configure.in -ot /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/configure ]] && touch /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/configure || true
! [[ /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/old-configure.in -ot /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/old-configure ]] && touch /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/old-configure || true
if [[ /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/configure -nt /home/sophie/temp/minimal-mozjs/target/x86_64-pc-windows-gnu/debug/build/mozjs_sys-07137dbc4f3723bc/out/config.status ]] ; then \
  cd /home/sophie/temp/minimal-mozjs/target/x86_64-pc-windows-gnu/debug/build/mozjs_sys-07137dbc4f3723bc/out && \
  PYTHON="" MOZ_TOOLS="" \
  CC="x86_64-pc-windows-gnu-gcc" CFLAGS="" \
  CPP="x86_64-pc-windows-gnu-gcc -E" CPPFLAGS="" \
  CXX="x86_64-pc-windows-gnu-g++" CXXFLAGS="" \
  AS="" AR="x86_64-pc-windows-gnu-ar" \
  STLPORT_LIBS="" \
  /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/mozjs/js/src/configure --disable-jemalloc --disable-js-shell --disable-tests --disable-shared-js --build-backends=RecursiveMake --target=x86_64-pc-windows --disable-gold --disable-shared-js || (cat config.log && exit 1) ; \
fi
Reexecuting in the virtualenv
checking for vcs source checkout... no
checking for a shell... /usr/bin/sh
checking for host system type... x86_64-pc-linux-gnu
checking for target system type... INFO: checking for vcs source checkout...
INFO: no
INFO: checking for a shell...
INFO: /usr/bin/sh
INFO: checking for host system type...
INFO: x86_64-pc-linux-gnu
INFO: checking for target system type...
ERROR: Unknown OS: windows

--- stderr
ERROR: Unknown OS: windows
make: *** [makefile.cargo:173: maybe-configure] Error 1
thread 'main' panicked at 'assertion failed: result.success()', /home/sophie/.cargo/registry/src/github.com-1ecc6299db9ec823/mozjs_sys-0.61.8/build.rs:114:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

I'm not sure how to continue with that error message...

@jdm
Copy link
Member

jdm commented Aug 26, 2019

We don't support GNU Windows targets, sorry.

@nox nox added the windows label Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants