Closed Pebaz closed 11 months ago
Does the meson build not work right now on windows? I tried it a while ago but haven't build with meson on windows in a while.
Ah I didn't try it with a VS command prompt, sorry. It does go a little further but fails with:
$ cargo build
Compiling janet-rs-sys v0.1.0 (C:\code\janet-rs-sys)
error: failed to run custom build command for `janet-rs-sys v0.1.0 (C:\code\janet-rs-sys)`
Caused by:
process didn't exit successfully: `C:\code\janet-rs-sys\target\debug\build\janet-rs-sys-6ce412a2cb724763\build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=janet
cargo:rustc-link-search=native=C:\code\janet-rs-sys\target\debug\build\janet-rs-sys-dfe8c56509892a93\out\build
The Meson build system
Version: 1.0.1
Source dir: C:\code\janet-rs-sys\janet
Build dir: C:\code\janet-rs-sys\target\debug\build\janet-rs-sys-dfe8c56509892a93\out\build
Build type: native build
Project name: janet
Project version: 1.31.0
C compiler for the host machine: cl (msvc 19.34.31937 "Microsoft (R) C/C++ Optimizing Compiler Version 19.34.31937 for x64")
C linker for the host machine: link link 14.34.31937.0
Host machine cpu family: x86_64
Host machine cpu: x86_64
Library m found: NO
Library dl found: NO
Library android-spawn found: NO
Run-time dependency threads found: YES
Configuring janetconf.h using configuration
Compiler for C supports arguments -fvisibility=hidden: NO
Build targets in project: 8
Found ninja-1.11.1 at C:\soft\Ninja\ninja.EXE
WARNING: Running the setup command as `meson [options]` instead of `meson setup [options]` is ambiguous and deprecated.
[1/54] Compiling C object janet-boot.exe.p/src_core_emit.c.obj
[2/54] Compiling C object janet-boot.exe.p/src_core_cfuns.c.obj
[3/54] Compiling C object janet-boot.exe.p/src_core_debug.c.obj
[4/54] Compiling C object janet-boot.exe.p/src_core_gc.c.obj
[5/54] Compiling C object janet-boot.exe.p/src_core_bytecode.c.obj
[6/54] Compiling C object janet-boot.exe.p/src_core_inttypes.c.obj
[7/54] Compiling C object janet-boot.exe.p/src_core_asm.c.obj
[8/54] Compiling C object janet-boot.exe.p/src_core_capi.c.obj
[9/54] Compiling C object janet-boot.exe.p/src_core_compile.c.obj
[10/54] Compiling C object janet-boot.exe.p/src_core_io.c.obj
[11/54] Compiling C object janet-boot.exe.p/src_core_corelib.c.obj
[12/54] Compiling C object janet-boot.exe.p/src_core_fiber.c.obj
[13/54] Compiling C object janet-boot.exe.p/src_core_buffer.c.obj
[14/54] Compiling C object janet-boot.exe.p/src_core_abstract.c.obj
[15/54] Compiling C object janet-boot.exe.p/src_core_array.c.obj
[16/54] Compiling C object janet-boot.exe.p/src_core_ffi.c.obj
[17/54] Compiling C object janet-boot.exe.p/src_core_marsh.c.obj
[18/54] Compiling C object janet-boot.exe.p/src_core_ev.c.obj
[19/54] Compiling C object janet-boot.exe.p/src_core_math.c.obj
[20/54] Compiling C object janet-boot.exe.p/src_core_net.c.obj
[21/54] Compiling C object janet-boot.exe.p/src_core_run.c.obj
[22/54] Compiling C object janet-boot.exe.p/src_core_os.c.obj
[23/54] Compiling C object janet-boot.exe.p/src_core_peg.c.obj
[24/54] Compiling C object janet-boot.exe.p/src_core_regalloc.c.obj
[25/54] Compiling C object janet-boot.exe.p/src_core_strtod.c.obj
[26/54] Compiling C object janet-boot.exe.p/src_core_state.c.obj
[27/54] Compiling C object janet-boot.exe.p/src_core_parse.c.obj
[28/54] Compiling C object janet-boot.exe.p/src_core_struct.c.obj
[29/54] Compiling C object janet-boot.exe.p/src_core_string.c.obj
[30/54] Compiling C object janet-boot.exe.p/src_core_pp.c.obj
[31/54] Compiling C object janet-boot.exe.p/src_core_symcache.c.obj
[32/54] Compiling C object janet-boot.exe.p/src_core_tuple.c.obj
[33/54] Compiling C object janet-boot.exe.p/src_core_table.c.obj
[34/54] Compiling C object janet-boot.exe.p/src_core_specials.c.obj
[35/54] Compiling C object janet-boot.exe.p/src_core_util.c.obj
[36/54] Compiling C object janet-boot.exe.p/src_core_vector.c.obj
[37/54] Compiling C object janet-boot.exe.p/src_core_value.c.obj
[38/54] Compiling C object janet-boot.exe.p/src_boot_array_test.c.obj
[39/54] Compiling C object janet-boot.exe.p/src_core_wrap.c.obj
[40/54] Compiling C object janet-boot.exe.p/src_boot_boot.c.obj
[41/54] Compiling C object janet-boot.exe.p/src_boot_buffer_test.c.obj
[42/54] Compiling C object janet-boot.exe.p/src_boot_number_test.c.obj
[43/54] Compiling C object janet-boot.exe.p/src_boot_table_test.c.obj
[44/54] Compiling C object janet-boot.exe.p/src_boot_system_test.c.obj
[45/54] Compiling C object janet-boot.exe.p/src_core_vm.c.obj
[46/54] Linking target janet-boot.exe
Creating library janet-boot.lib and object janet-boot.exp
[47/54] Compiling C object janet.exe.p/src_mainclient_shell.c.obj
[48/54] Generating janetc with a custom command (wrapped by meson to set PATH, to capture output)
[49/54] Compiling C object janet.exe.p/meson-generated_.._janet.c.obj
[50/54] Compiling C object janet-1.31.dll.p/meson-generated_.._janet.c.obj
[51/54] Linking static target libjanet.a
[52/54] Linking target janet.exe
FAILED: janet.exe janet.pdb
"link" /MACHINE:x64 /OUT:janet.exe janet.exe.p/meson-generated_.._janet.c.obj janet.exe.p/src_mainclient_shell.c.obj "/nologo" "/release" "/nologo" "/DEBUG" "/PDB:janet.pdb" "/SUBSYSTEM:CONSOLE" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "comdlg32.lib" "advapi32.lib"
Creating library janet.lib and object janet.exp
LINK : fatal error LNK1104: cannot open file 'janet.exp'
[53/54] Linking target janet-1.31.dll
Creating library janet.lib and object janet.exp
ninja: build stopped: subcommand failed.
--- stderr
thread 'main' panicked at 'assertion failed: status.success()', C:\Users\pebaz\.cargo\registry\src\index.crates.io-6f17d22bba15001f\meson-1.0.0\src\lib.rs:72:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Is there any way to not require windows users to use the VS command prompt? I think Nim and and older versions of Rust find the installed version of cl.exe
and link.exe
. Does Meson have something like this?
This looks like it may be issue with your meson setup. The stack trace implies meson version 1.0.1 which is not the latest version afaict.
Ok, so testing locally, the issue is that meson does not like having the executable and the library having the same name, as it creates extra files that conflict. The solution is to rename janet's shared library.
Awesome thanks @bakpakin ill give this a shot today! :)
Thanks @bakpakin, renaming the shared library worked!
@bakpakin Thanks for your help with this I got a Windows build working for Rust bindings to Janet: https://crates.io/crates/janet-rs-sys
Although Windows, MacOS, and Linux Meson builds worked, I can't currently figure out how to get them to work with Rust bindgen, they won't compile except on Windows. I couldn't figure out why but I uploaded the working Windows version to recoup some of my time investment.
I'm trying to create a Rust crate that has bindings to the Janet C API and I've got it working great on Nix platforms but since I'm using Meson, I don't currently have support for Windows.
Is there any chance the Meson build script could be modified to support Windows? That way it would all be within a single build system.