rb-sys icon indicating copy to clipboard operation
rb-sys copied to clipboard

Would be nice to not have to deal with makefile

Open dsisnero opened this issue 2 years ago • 19 comments

When trying to use on windows - using the rake-compiler toolchain requires you to use ridk enable or ridk exec when trying to build. It would be nice to not need a Makefile to build a rust gem when cargo doesn't need it. Maybe steal some ideas from maturin https://github.com/PyO3/maturin which does the whole thing in rust. Otherwise, needs to document how to develop on windows machines.

dsisnero avatar Oct 12 '22 15:10 dsisnero

I don't personally use windows for development, so I'm a bit handicapped here. But your concern is totally valid. The idea (for now) is not to diverge from Ruby's standard way of building extensions (i.e. extconf.rb, mkmf, etc.).

That being said, the documentation on Windows can definitely be better. @MSP-Greg Are there good resources out there for developing native extensions on Windows that we can re-purpose here?

ianks avatar Oct 14 '22 22:10 ianks

requires you to use ridk enable or ridk exec when trying to build.

Adding code to mkmf to enable the MSYS2 toolchains was brought up recently, but since the code it would call is not part of the Ruby org, I don't think there was much interest.

When building from Bundler/RubyGems, it is enabled via the rubygems/defaults/operating_system.rb file provided by RubyInstaller2.

Ruby MSVC/mswin builds are not part of that, so they need to be enabled, typically by running vcvars64.bat.

When using GitHub Actions, all of that is done by setup-ruby.

Are there good resources out there for developing native extensions on Windows that we can re-purpose here?

Not that I'm aware of. I suspect most people review extension gems that are known to support Windows.

build a rust gem

Any examples? I'd like to take a look at them. I'm not very familiar with Rust, but I'd like to be.

MSP-Greg avatar Oct 15 '22 19:10 MSP-Greg

Examples of rust - ruby libraries https://rubygems.org/gems/rb_sys/reverse_dependencies

dsisnero avatar Oct 18 '22 17:10 dsisnero

On windows for ruby you can run ridk enable to set the paths to use the msys environment paths and this gives you msys2 tools. However, I still cannot get any rust ruby extensions to build on windows. I think when I do "ridk enable" it is still trying to use msvc tools on windows instead of trying to build with a cargo gnu environment

dsisnero avatar Dec 13 '22 22:12 dsisnero

rb-sys supports both msvc and the gnu toolchains on windows (at least on github actions). you may need to explicitly set the toolchain if you want to use gnu? I'm not entirely sure because I don't run Windows personally. But something like export RUSTUP_TOOLCHAIN="x86_64-pc-windows-gnu might do the trick?

ianks avatar Dec 14 '22 03:12 ianks

I did the following bundle gem rust_uuid --ext rust

like in this https://blog.katsyoshi.org/blog/2022/08/12/how-to-use-rust-in-ruby-gems/

I add rust-toolchain.toml to use windows-gnu

On windows - have to use ridk enable to get the environment set up.

ridk enable

make > build.log 2>&1

build.log

dsisnero avatar Feb 07 '23 21:02 dsisnero

Can you try CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=gcc bundle exec rake compile?

PS: Thanks for bearing with me here, the only way I have to test windows currently is through CI so your help in debugging is greatly appreciated!

ianks avatar Feb 07 '23 22:02 ianks

I ran ridk enable set CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=gcc bundle exec rake compile

partial output

   Compiling nom v7.1.3
   Compiling uuid v1.3.0
   Compiling regex v1.7.1
   Compiling cexpr v0.6.0
   Compiling magnus-macros v0.3.0
   Compiling rb-sys-build v0.9.64
   Compiling rb-sys v0.9.64
   Compiling rb-allocator v0.9.6
   Compiling rust_uuid v0.1.0 (F:\programming\source\repos\ruby\magnus_examples\rust_uuid\ext\rust_uuid)
error: linking with `gcc` failed: exit code: 1
  |
  = note: "gcc" "-Wl,C:\\Users\\DOMINI~1\\AppData\\Local\\Temp\\rustcLgO91P\\list.def" "C:\\Users\\DOMINI~1\\AppData\\Local\\Temp\\rustcLgO91P\\symbols.o" "f:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\rust_uuid.rust_uuid.19aa8dff-cgu.
0.rcgu.o" "f:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\rust_uuid.rust_uuid.19aa8dff-cgu.1.rcgu.o" "f:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\rust_u
uid.rust_uuid.19aa8dff-cgu.10.rcgu.o" "f:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\rust_uuid.rust_uuid.19aa8dff-cgu.11.rcgu.o" "f:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\
target\\release\\deps\\rust_uuid.rust_uuid.19aa8dff-cgu.12.rcgu.o" "f:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\rust_uuid.rust_uuid.19aa8dff-cgu.13.rcgu.o" "f:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-m
ingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\rust_uuid.rust_uuid.19aa8dff-cgu.14.rcgu.o" "f:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\rust_uuid.rust_uuid.19aa8dff-cgu.2.rcgu.o" "f:\\programming\\source\\repos\\ruby\\magnus_exa
mples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\rust_uuid.rust_uuid.19aa8dff-cgu.3.rcgu.o" "f:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\rust_uuid.rust_uuid.19aa8dff-cgu.4.rcgu.o" "f:\\programming\\sour
ce\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\rust_uuid.rust_uuid.19aa8dff-cgu.5.rcgu.o" "f:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\rust_uuid.rust_uuid.19aa8dff-cgu.6.rcg
u.o" "f:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\rust_uuid.rust_uuid.19aa8dff-cgu.7.rcgu.o" "f:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\rust_uuid.r
ust_uuid.19aa8dff-cgu.8.rcgu.o" "f:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\rust_uuid.rust_uuid.19aa8dff-cgu.9.rcgu.o" "f:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\
\release\\deps\\rust_uuid.1ajgdmbegyyauvsv.rcgu.o" "-L" "F:/windows/tools/ruby/Ruby3.2/lib" "-L" "f:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps" "-L" "F:/windows/tools/ruby/Ruby3.2/lib" "-L" "F:/windows/tools/ruby/Ruby3.2/lib" "-L" "F:\
\windows\\tools\\rust\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "-lshell32" "-lws2_32" "-liphlpapi" "-limagehlp" "-lshlwapi" "-lbcrypt" "-lx64-ucrt-ruby320" "-Wl,-Bstatic" "F:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rus
t_uuid\\3.2.0\\target\\release\\deps\\libuuid-a993b3f3b665afc5.rlib" "F:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\libgetrandom-198e06f03e159242.rlib" "F:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-u
crt\\rust_uuid\\3.2.0\\target\\release\\deps\\libcfg_if-9ff9512c3b140ff3.rlib" "F:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\librb_allocator-11c4430ae1a30ea1.rlib" "F:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp
\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\libmagnus-dbbe16252d812c3f.rlib" "F:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\librb_sys-220c17bc799fbc9a.rlib" "F:\\windows\\tools\\rust\\.rustup\\toolchains\\stable-x86_64-p
c-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-d948d7ba3a1428f8.rlib" "F:\\windows\\tools\\rust\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-160203b957826e76.rlib" "F:\\windows\\tools\\rust\\.rustup\\toolchains\\stable-x86_64-pc-wi
ndows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-b24bd95fe5d36805.rlib" "F:\\windows\\tools\\rust\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_detect-0e9d70f22be1c0d7.rlib" "F:\\windows\\tools\\rust\\.rustup\\toolchains\\stable-x86_64-
pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-b095d6ec0de2c748.rlib" "F:\\windows\\tools\\rust\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libminiz_oxide-fb910d16a05b94c5.rlib" "F:\\windows\\tools\\rust\\.rustup\\toolchains\\stable-x86_64
-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libadler-3a4bfb6892558bf2.rlib" "F:\\windows\\tools\\rust\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-a9e6a5964ad33a4c.rlib" "F:\\windows\\tools\\rust\\.rustup\\toolchains\\st
able-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-213bb51833c43573.rlib" "F:\\windows\\tools\\rust\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-4140ea5b1ce3650e.rlib" "F:\\windows\\tools\\rust\\.rustup\\toolchains\\stable-x8
6_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-9a1df03c8e50ccf9.rlib" "F:\\windows\\tools\\rust\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-860856f6a77183a1.rlib" "F:\\windows\\tools\\rust\\.rustup\\toolchains\\stable-x86_64-pc-wi
ndows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-d38e1b9df5cea3b4.rlib" "F:\\windows\\tools\\rust\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-b993f6ac479af571.rlib" "F:\\windows\\tools\\rust\\.rustup\\toolchains\\stable-x86
_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-3f0eed38bcc54ffc.rlib" "-Wl,-Bdynamic" "-lbcrypt" "-lx64-ucrt-ruby320" "-lshell32" "-lws2_32" "-liphlpapi" "-limagehlp" "-lshlwapi" "-lbcrypt" "-lx64-ucrt-ruby320" "-lshell32" "-lws2_32" "-liphlpapi" "-limagehlp" "-lshlwapi" "-lbcry
pt" "-lkernel32" "-ladvapi32" "-luserenv" "-lkernel32" "-lws2_32" "-lbcrypt" "-lmsvcrt" "-llegacy_stdio_definitions" "-Wl,--eh-frame-hdr" "-Wl,--nxcompat" "-L" "F:\\windows\\tools\\rust\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "-o" "f:\\programming\\source\\repo
s\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\rust_uuid.dll" "-shared" "-Wl,--out-implib=f:\\programming\\source\\repos\\ruby\\magnus_examples\\rust_uuid\\tmp\\x64-mingw-ucrt\\rust_uuid\\3.2.0\\target\\release\\deps\\rust_uuid.dll.lib" "-pipe" "-fstack-protector-s
trong" "-Wl,--enable-auto-image-base,--enable-auto-import" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-static-libgcc"
  = note: Non-UTF-8 output: c:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find \xff\xfe: No such file or directory\r\ncollect2.exe: error: ld returned 1 exit status\n

error: could not compile `rust_uuid` due to previous error
make: *** [Makefile:569: target/release/rust_uuid.dll] Error 101
rake aborted!
Command failed with status (2): [c:\msys64\usr\bin/make.exe...]

Tasks: TOP => compile => compile:x64-mingw-ucrt => compile:rust_uuid:x64-mingw-ucrt => copy:rust_uuid:x64-mingw-ucrt:3.2.0 => tmp/x64-mingw-ucrt/rust_uuid/3.2.0/rust_uuid.so
(See full trace by running task with --trace)

dsisnero avatar Feb 07 '23 23:02 dsisnero

I tried installing rust_uuid with gem install. That didn't work.

From above msg, I noticed that commonmarker was Rust (just the most recent release). After forking the repo, it installed fine using bundle exec rake compile, and all the tests passed.

Also, I believe I was using the MSYS2 mingw-w64-ucrt-x86_64-rust package. I also have Rust installed separate from MSYS2, but after ridk enable, the MSYS2 version was loaded, I.think.

I'm also using Ruby head/master. Not sure if this helps...

EDIT: I did not have CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER set.

And, just ran gem install commonmarker:1.0.0.pre7 --platform=ruby, and it also installed...

MSP-Greg avatar Feb 08 '23 00:02 MSP-Greg

Per the note in the rust-uuid README, I tried cargo build --release from the gem folder. The following error:

   Compiling interfaces v0.0.1
The following warnings were emitted during compilation:

warning: src\constants.c:4:10: fatal error: sys/ioctl.h: No such file or directory
warning:     4 | #include <sys/ioctl.h>
warning:       |          ^~~~~~~~~~~~~
warning: compilation terminated.

error: failed to run custom build command for `interfaces v0.0.1`

I think ioctl.h isn't available with MSYS2. Or, rust-uuid may not compile on Windows.

MSP-Greg avatar Feb 08 '23 03:02 MSP-Greg

this looks like some sort of encoding issue:

cannot find \xff\xfe: No such file or directory

I believe that code is a byte-order mark, and it is being treated as a literal value here. Can you confirm that the BOM is in the Makefile, or is it coming from somewhere else?

ianks avatar Feb 08 '23 15:02 ianks

I also saw this commit which explicitly marks the coding of Ruby's mkmf. I wonder if rbsys should do the same?

ianks avatar Feb 08 '23 15:02 ianks

@dsisnero can you test this patch out?

Update your gemfile to be:

gem "rb_sys", github: "oxidize-rb/rb-sys", branch: "binwrite"

Then:

rm -rf tmp
bundle install
bundle exec rake compile

ianks avatar Feb 08 '23 16:02 ianks

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>rake compile mkdir -p tmp/x64-mingw-ucrt/rust_uuid/3.2.0 cd tmp/x64-mingw-ucrt/rust_uuid/3.2.0 F:/windows/tools/ruby/Ruby3.2/bin/ruby.exe -I. -r.rake-compiler-siteconf.rb ../../../../ext/rust_uuid/extconf.rb cd - cd tmp/x64-mingw-ucrt/rust_uuid/3.2.0 rake aborted! Couldn't find a suitable make tool. Use MAKE env to set an alternative.

Tasks: TOP => compile => compile:x64-mingw-ucrt => compile:rust_uuid:x64-mingw-ucrt => copy:rust_uuid:x64-mingw-ucrt:3.2.0 => tmp/x64-mingw-ucrt/rust_uuid/3.2.0/rust_uuid.so (See full trace by running task with --trace)

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>ridk enable

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>set "RI_DEVKIT=c:\msys64"

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>set "MSYSTEM=UCRT64"

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>set "PKG_CONFIG_PATH=/ucrt64/lib/pkgconfig:/ucrt64/share/pkgconfig"

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>set "ACLOCAL_PATH=/ucrt64/share/aclocal:/usr/share/aclocal"

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>set "MANPATH=/ucrt64/share/man"

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>set "MINGW_PACKAGE_PREFIX=mingw-w64-ucrt-x86_64"

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>set "MSYSTEM_PREFIX=/ucrt64"

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>set "MSYSTEM_CARCH=x86_64"

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>set "MSYSTEM_CHOST=x86_64-w64-mingw32"

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>set "MINGW_CHOST=x86_64-w64-mingw32"

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>set "MINGW_PREFIX=/ucrt64"

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>set "LANG=en_US.UTF-8"

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>set "PATH=F:\windows\tools\ruby\Ruby3.2\bin;c:\msys64\ucrt64\bin;c:\msys64\usr\bin;C:\Oracle\product\11.2.0\client_1\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Tumbleweed\Desktop V alidator;C:\Program Files\Tumbleweed\Desktop Validator\x86;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\Mana gementStudio;C:\Program Files (x86)\HID Global\ActivClient;C:\Program Files\HID Global\ActivClient;C:\Program Files (x86)\Pulse Secure\VC142.CRT\X64;C:\Program Files (x86)\Pulse Secure\VC142.CRT\X86;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;F:\windows\tools\nvm;F:\windows\tools\bin\node;C:\WINDOWS\s ystem32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files\dotnet;C:\Program Files (x86)\Avitru\MasterWorks;C:\Program Files (x86)\Novus;C:\Program Files (x86)\Common Fil es\Pulse Secure\TNC Client Plugin;C:\Program Files (x86)\dotnet-core-uninstall;F:\windows\scoop\apps\python\current\Scripts;F:\windows\scoop\apps\python\current;C:\Users\Dominic E Sisneros\go\bin;F:\windows\scoop\apps\openjdk\current\bin;F:\windows\scoop\apps\elixir\current\bin;F:\windows\scoop\apps\gpg\current\bi n;F:\windows\scoop\apps\luarocks\current\rocks\bin;F:\windows\scoop\apps\yarn\current\global\node_modules.bin;F:\windows\scoop\apps\yarn\current\bin;F:\windows\tools\ruby\Ruby3.2\bin;F:\msys64\mingw64\bin;bin;F:\windows\tools\vscode\bin;F:\windows\scoop\shims;C:\Oracle\product\11.2.0\client_1\bin;C:\Program Files ( x86)\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Tumbleweed\Desktop Validator;C:\Program Files\Tumbleweed\Desktop Validator\x86;C:\Program Files\Git\cmd;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\O DBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio;C:\Program Files\Microsoft VS Code\bin;C:\Program Files (x86)\HID Global\ActivClient;C:\Program Files \HID Global\ActivClient;C:\Program Files (x86)\Pulse Secure\VC142.CRT\X64;C:\Program Files (x86)\Pulse Secure\VC142.CRT\X86;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files\dotnet;C:\Users\Do;F:\windows\tools\GnuWin32\bin ;F:\windows\tools\rust.cargo\bin;C:\Users\Dominic E Sisneros.dotnet\tools;C:\Oracle\instantclient_19_5;F:\windows\tools\bin;F:\windows\tools\nvm;F:\windows\tools\bin\node;f:\msy64;C:\Users\Dominic E Sisneros\AppData\Local\Microsoft\WindowsApps;F:\windows\tools\tarql-1.2\bin;C:\Users\Dominic E Sisneros.dotnet\tool s;C:\Users\Dominic E Sisneros\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin;C:\Users\Dominic E Sisneros.dotnet\tools;C:\Users\Dominic E Sisneros.dotnet\tools;c:\users\dominic e sisneros\appdata\roaming\python\python311\scripts;c:\users\dominic e sisneros.local\bin"

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>rake compile 2>&1 | gh gist create -d "rake compile"

  • Creating gist... ✓ Created gist https://gist.github.com/60d3a6ad63b71524ac5f9f357f1d70fe

rake compile

dsisnero avatar Feb 09 '23 17:02 dsisnero

We need to hunt down this rogue BOM that appearing. I'm not sure where its sneaking in, can you help track it down?

  1. What is you default external encoding? (ruby -e 'p Encoding.default_external')

  2. As well as internal encoding (ruby -e 'p Encoding.default_internal')

  3. Also, can you try running again with this patch?

    gem "rb_sys", github: "oxidize-rb/rb-sys", commit: "f2e2adc4ba2fb972e1cea14d595d04a12699b3bf"
    

ianks avatar Feb 09 '23 20:02 ianks

FWIW: I tried to get into a windows VM to expedite this, but I'm stuck on https://github.com/oneclick/rubyinstaller2/issues/308

ianks avatar Feb 09 '23 22:02 ianks

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>ruby -e 'p Encoding.default_external' #Encoding:UTF-8

f:\programming\source\repos\ruby\magnus_examples\rust_uuid>ruby -e 'p Encoding.default_internal' nil

rake compile

Gemfile

# frozen_string_literal: true

source "https://rubygems.org"

# Specify your gem's dependencies in rust_uuid.gemspec
gemspec

gem "rake", "~> 13.0"

gem "rake-compiler"
gem "rb_sys", github: "oxidize-rb/rb-sys", commit: "f2e2adc4ba2fb972e1cea14d595d04a12699b3bf"
gem "minitest", "~> 5.0"

gem "standard", "~> 1.3"

dsisnero avatar Feb 13 '23 15:02 dsisnero

I've experimented with Justfiles. I believe they could make the process more solid. They are more statically checked, and also have a language embedded to manipulated data in a more solid way than makefiles and where that would be cruft code in ruby. Also, the ability to support any shell would make it perhaps easier on windows.

But, sure, it's one dependency more... sooooooo....

gl-yziquel avatar May 30 '24 11:05 gl-yziquel

I'd love to drop Make dependency here, but unfortunately it's fairly entrenched in the Ruby ecosystem and opting-out is non-trivial. At the very least, we'd need to change rake-compiler and maybe rubygems :/

ianks avatar May 30 '24 18:05 ianks