WolframResearch / wolfram-library-link-rs

Safe, efficient, and ergonomic bindings to Wolfram LibraryLink and the Wolfram Language
Apache License 2.0
52 stars 5 forks source link

build failed on linux #56

Open eric-stokes-architect opened 1 year ago

eric-stokes-architect commented 1 year ago

Hi, I'm trying to build an otherwise empty crate to test this out and the build fails. I'm on ubuntu 22.04 LTS. I have Mathematica 13.2 installed and confirmed working.

error: failed to run custom build command for `wolfram-library-link-sys v0.2.9`

Caused by:
  process didn't exit successfully: `/home/eric/proj/netidx-wolfram/target/debug/build/wolfram-library-link-sys-08fae24c8dfa08ef/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=RUST_WOLFRAM_LOCATION
  cargo:rerun-if-env-changed=WOLFRAM_APP_DIRECTORY
  cargo:rerun-if-env-changed=WOLFRAM_LIBRARY_LINK_C_INCLUDES_DIRECTORY
  cargo:rerun-if-env-changed=WOLFRAM_C_INCLUDES

  --- stderr
  thread 'main' panicked at 'unable to get LibraryLink C includes directory: Error(Undiscoverable { resource: "LibraryLink C includes directory", environment_variable: Some("WOLFRAM_LIBRARY_LINK_C_INCLUDES_DIRECTORY") })', /home/eric/.cargo/registry/src/github.com-1ecc6299db9ec823/wolfram-library-link-sys-0.2.9/build.rs:61:14
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `wstp-sys v0.2.7`

Caused by:
  process didn't exit successfully: `/home/eric/proj/netidx-wolfram/target/debug/build/wstp-sys-c95420de765c9c9f/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=RUST_WOLFRAM_LOCATION
  cargo:rerun-if-env-changed=WOLFRAM_APP_DIRECTORY
  cargo:rerun-if-env-changed=WSTP_COMPILER_ADDITIONS_DIRECTORY
  cargo:rerun-if-env-changed=WSTP_COMPILER_ADDITIONS

  --- stderr
  thread 'main' panicked at 'unable to get WSTP static library path: Error(Undiscoverable { resource: "WSTP CompilerAdditions directory", environment_variable: Some("WSTP_COMPILER_ADDITIONS_DIRECTORY") })', /home/eric/.cargo/registry/src/github.com-1ecc6299db9ec823/wstp-sys-0.2.7/build.rs:206:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
eric-stokes-architect commented 1 year ago

I got this to build by setting the following environment variables,

WOLFRAM_LIBRARY_LINK_C_INCLUDES_DIRECTORY=/usr/local/Wolfram/Mathematica/13.2/SystemFiles/IncludeFiles/C
WSTP_COMPILER_ADDITIONS_DIRECTORY=/usr/local/Wolfram/Mathematica/13.2/SystemFiles/Links/WSTP/DeveloperKit/Linux-x86-64/CompilerAdditions

Not sure why the build script couldn't figure those out automatically given that

MATHEMATICA_HOME=/usr/local/Wolfram/Mathematica/13.2

was definitely set.