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

Can't compile sixel-sys on windows or macOS (works fine in linux) #1

Open
mmulet opened this issue Jan 7, 2021 · 5 comments · May be fixed by #2
Open

Can't compile sixel-sys on windows or macOS (works fine in linux) #1

mmulet opened this issue Jan 7, 2021 · 5 comments · May be fixed by #2

Comments

@mmulet
Copy link

mmulet commented Jan 7, 2021

On Windows: I get this error:

rror: failed to run custom build command for `sixel-sys v0.3.1`

Caused by:
  process didn't exit successfully: `V:\Documents\viuertest\sixel-sys-test\target\debug\build\sixel-sys-f5b3ec906222e763\build-script-build` (exit code: 101)
  --- stdout
  cargo:rustc-link-lib=dylib=sixel
  cargo:rustc-link-search=native=V:\Documents\viuertest\sixel-sys-test\target\debug\build\sixel-sys-060e93a697b4af5b\out\lib

  --- stderr
  thread 'main' panicked at 'Failed to execute ./configure: Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }', C:\Users\micha\.cargo\registry\src\github.com-1ecc6299db9ec823\sixel-sys-0.3.1\build.rs:71:22

On macOS I get this:

--- stderr
thread 'main' panicked at 'Failed to execute ./configure: OS {code: 2, kind: NotFound, message: "No such file or directory" }', /users/michaelmulet/.cargo/registry/src/github.com-1ecc6299db9ec823/sixel-sys-0.3.1/build.rs:71:22
configure: WARNING: unrecognized options: --without-python
configure : WARNING: unrecognized options: --without-python

If I try to build with RUST_BACKTRACE=1, then it says the error is at

build_script_build::main
at ./build.rs:71:9

Tracing it backwards, that just tells us that configure failed.

@mmulet
Copy link
Author

mmulet commented Jan 8, 2021

Found the source of the error. It's a bug with std::proccess::Command.
tldr;
Create a dummy file named configure in the project root directory and everything works.

Actual Explanation:
In the current version of rust (1.49.0 at time of writing) the std::proccess::Command constructor std::process::Command::new takes in a &str as an argument. This argument is then interpreted in a OS dependent way.
On macOS, but not Linux, std::proccess::Command::new will attempt to find the command if it is a relative path. However, this is not the location of the actual command because we use the .current_dir() method to change the current working directory.
So, on macOS, at std::proccess::Command::new the relative path you pass in must be a valid path relative to the working directory of the calling proccess and a valid path relative to the directory passed to .current_dir().

I will create a bug report for the rust standard library, but in the meantime you can fix this with an ease workaround:
Create a dummy file named configure in the project root directory. This way the relative path will be valid in both contexts.

mmulet added a commit to code-relay-io/sixel-sys that referenced this issue Jan 8, 2021
This was referenced Jan 8, 2021
@mmulet
Copy link
Author

mmulet commented Jan 8, 2021

For future reference here is the rust bug report: rust-lang/rust#80819

@mmulet
Copy link
Author

mmulet commented Jan 8, 2021

PR for fix:rust-lang/rust#80537

benjajaja pushed a commit to benjajaja/sixel-sys that referenced this issue Oct 12, 2023
@AdnoC
Copy link
Owner

AdnoC commented Oct 18, 2023

I haven't touched this in a while, but I'll fix when I have the time.

@pjschinske
Copy link

I seem to be getting this bug on Archlinux and FreeBSD, even after creating the configure file as it is in mmulet's commit. Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants