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

Compilation on Windows with msvc #20

Open
dschaadt opened this issue Jul 10, 2018 · 5 comments
Open

Compilation on Windows with msvc #20

dschaadt opened this issue Jul 10, 2018 · 5 comments

Comments

@dschaadt
Copy link

Hi. I noticed a problem when compiling on windows (10) with stable-x86_64-pc-windows-msvc. Cmake works on wabt, but rustc fails during rustc --crate-name wabt_sys ..... It cannot link to wabt.lib since the file is not in the corresponding folder target\debug\build\wabt-sys-....\out where there is wabtshim.lib. After copying it manually there from target\debug\build\wabt-sys...\out\build\Debug, the compilation works. Looks like a -L is missing or the path is somehow incorrect.

@pepyakin
Copy link
Owner

That's interesting, thanks for the report!
I checked the build.rs and it looks reasonable.

Unfortunately, I don't have a windows machine and don't have an ability to debug the issue. Could you post the build log (cargo build --verbose) ?

@dschaadt
Copy link
Author

Here's the output:
Compiling wabt-sys v0.2.0
Running rustc --crate-name wabt_sys C:\user\.cargo\registry\src\github.com-1ecc6299db9ec823\wabt-sys-0.2.0\src\lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=23e155977e582a23 -C extra-filename=-23e155977e582a23 --out-dir X:\test\target\debug\deps -L dependency=X:\test\target\debug\deps --cap-lints allow -L native=X:\test\target\debug\build\wabt-sys-8e3823d7b8812fb5\out\build -L native=X:\test\target\debug\build\wabt-sys-8e3823d7b8812fb5\out -l static=wabt -l static=wabt_shim
error: could not find native static library wabt, perhaps an -L flag is missing?

error: aborting due to previous error

The following warnings were emitted during compilation:

warning: cl : Befehlszeile warning D9002 : Unbekannte Option "-std=c++11" wird ignoriert.
warning: cl : Befehlszeile warning D9002 : Unbekannte Option "-std=c++11" wird ignoriert.

error: Could not compile wabt-sys.

Caused by:
process didn't exit successfully: rustc --crate-name wabt_sys C:\user\.cargo\registry\src\github.com-1ecc6299db9ec823\wabt-sys-0.2.0\src\lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=23e155977e582a23 -C extra-filename=-23e155977e582a23 --out-dir X:\test\target\debug\deps -L dependency=X:\test\target\debug\deps --cap-lints allow -L native=X:\test\target\debug\build\wabt-sys-8e3823d7b8812fb5\out\build -L native=X:\test\target\debug\build\wabt-sys-8e3823d7b8812fb5\out -l static=wabt -l static=wabt_shim (exit code: 101)

The file wabt is located under X:\test\target\debug\build\wabt-sys-8e3823d7b8812fb5\out\build\Debug, so it cannot find it unless moved manually

@nlordell
Copy link

The default output location on Windows with MSVC for wabt.lib is %CMAKE_BINARY_DIR%\%CMAKE_BUILD_TYPE%. In a typical debug build of wabt-sys, this will be %OUT_DIR%\build\Debug but depending on optimizations it can be %OUT_DIR%\build\{Release|MinSizeRel|RelWithDebInfo}.

I think part of the inconsistency comes from the fact that, in the Wabt project, wabt.lib is more of an internal build artifact rather than a proper build target. Aa far as I can tell there is currently no way to configure CMake to build wabt.lib and install it to some install prefix along with the header.

The CMAKE_BUILD_TYPE variable is controlled by the cmake::Config::profile() so one option would be to set that explicitly on Windows MSVC builds and then add a rustc-link-search directive so that it knows where to pick up.

@xmclark
Copy link
Contributor

xmclark commented Dec 16, 2018

Now that there is windows support and appveyor CI, the readme should have an appveyor badge 💯!

The appveyor build history:
https://ci.appveyor.com/project/pepyakin/wabt-rs

@xmclark
Copy link
Contributor

xmclark commented Dec 27, 2018

Maybe a few things missing:

  • mingw builds
  • i686 builds
  • badge on readme

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

No branches or pull requests

4 participants