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

Support generation of Windows executables (code-signed) #27

Closed
Tracked by #90
ronaldtse opened this issue Oct 5, 2021 · 6 comments · Fixed by #150
Closed
Tracked by #90

Support generation of Windows executables (code-signed) #27

ronaldtse opened this issue Oct 5, 2021 · 6 comments · Fixed by #150
Assignees
Labels
enhancement New feature or request

Comments

@ronaldtse
Copy link
Contributor

ronaldtse commented Oct 5, 2021

Tebako now supports Linux + macOS, we just need to add Windows support.

e.g. codebykevin/ocra@9f9836d

@ronaldtse ronaldtse added the enhancement New feature or request label Jan 10, 2022
@ronaldtse ronaldtse added this to Tebako Jan 10, 2022
@maxirmx maxirmx added this to the 0.4.0 milestone Jan 14, 2022
@maxirmx maxirmx removed this from the 0.4.0 milestone Apr 3, 2022
@maxirmx
Copy link
Member

maxirmx commented Jun 17, 2022

Depends on:

@maxirmx maxirmx linked a pull request Jul 17, 2022 that will close this issue
@maxirmx
Copy link
Member

maxirmx commented Oct 9, 2022

I was able package tebako memfs into Ruby and resolve all issues related to filesystem access.
However, it looks like an option to link MinGW version of Ruby statically is broken in all recent versions (2.7, 3.0, 3.1, 3.2)

I made an experiment with original Ruby (without any tebako patches) as follows:

  1. I use the code from https://github.com/ruby/ruby/tree/ruby_3_1 and GHA workflow at https://github.com/ruby/ruby/blob/ruby_3_1/.github/workflows/mingw.yml as a baseline

  2. I alter configure command in the workflow from

- name: configure
  run: >
    ../src/configure --disable-install-doc --prefix=/.
    --build=$CHOST --host=$CHOST --target=$CHOST
   to
- name: configure
  run: >
     ../src/configure --disable-install-doc --with-static-linked-ext --disable-shared --without-gmp -- prefix=/.
      --build=$CHOST --host=$CHOST --target=$CHOST

and uncomment option nodynamic in ext/Setup

  1. The first failure I observe is:
C:\msys64\ucrt64\bin\dllwrap.exe: WARNING: C:\msys64\ucrt64\bin\dllwrap.exe is deprecated, use gcc -shared or ld -shared instead
C:\msys64\ucrt64\bin\dllwrap.exe: no export definition file provided.
Creating one, but that may not be what you want
x86_64-w64-mingw32-cc: error: unrecognized command-line option '-mno-cygwin'; did you mean '-mno-clwb'?
C:\msys64\ucrt64\bin\dllwrap.exe: x86_64-w64-mingw32-cc exited with status 1
make: *** [GNUmakefile:73: ruby.exp] Error 1
 In order to resolve it I comment out ``` DLLWRAP += -mno-cygwin``` in ```cygwin/GNUmakefile.in```
  1. Then I get the second failure:
creating ruby.exp
C:\msys64\ucrt64\bin\dllwrap.exe: WARNING: C:\msys64\ucrt64\bin\dllwrap.exe is deprecated, use gcc -shared or ld -shared instead

C:\msys64\ucrt64\bin\dllwrap.exe: no export definition file provided.
Creating one, but that may not be what you want
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: warning: cannot find entry symbol _DllMainCRTStartup@12; defaulting to 0000000063981000
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: warning: cannot find entry symbol _DllMainCRTStartup@12; defaulting to 0000000063981000
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: warning: cannot find entry symbol _DllMainCRTStartup@12; defaulting to 0000000063981000
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ruby.o:ruby.c:(.text+0x54f5): undefined reference to `Init_enc'
collect2.exe: error: ld returned 1 exit status
make: *** [GNUmakefile:74: ruby.exp] Error 1

I believe that when GNUMakefile is generated disable-shared flag is ignored silently

@maxirmx
Copy link
Member

maxirmx commented Oct 9, 2022

@ronaldtse
Copy link
Contributor Author

Thanks @maxirmx ! I'm not sure if Ruby static build on MinGW is officially supported but hope we get a reply. We might consider contributing that portion if necessary.

@maxirmx
Copy link
Member

maxirmx commented Jan 4, 2023

@ronaldtse
UPD
There was no reply from Ruby team regarding staic build on MinGW
I think we need to implement it ourselves if want to continue with an options to contribute it to the mainline.
My preliminate estimate is 2-3 weeks to implement it in a private branch.
If we want to contribute it we will need to support Ruby 3.x while tebako uses Ruby 2.x. It may require some extra effort. Probably another 2-3 weeks.

@ronaldtse
Copy link
Contributor Author

Thanks @maxirmx . We do have to upgrade Tebako to work with Ruby 3 anyway, so it is unavoidable. Let’s do this first. We should allow building different Ruby versions.

For the MinGW static build, we should proceed as well, with the goal to contribute back to Ruby mainline.

@ronaldtse ronaldtse added this to the 0.4.0 milestone Jan 10, 2023
@ronaldtse ronaldtse changed the title Support generation of Windows code-signed executables Support generation of Windows executables (code-signed) Jan 10, 2023
@ronaldtse ronaldtse moved this to 📋 Backlog in Tebako Jan 10, 2023
@ronaldtse ronaldtse moved this from 📋 Backlog to 🏗 In progress in Tebako Jan 10, 2023
maxirmx added a commit that referenced this issue Feb 14, 2023
- MSys packaging for gems without native extensions (partial implementation #27)
- Ruby version upgrade to 2.7.7
- Bundler version upgrade to 2.3.22 -- we can address lutaml/expressir#106 now 
- Packaging optimization - Ruby extensions are not reconfigured on each tabako execution anymore (adresses #91)
@maxirmx maxirmx modified the milestones: 0.4.0, 0.4.1 Feb 25, 2023
@maxirmx maxirmx modified the milestones: 0.4.2, 0.6.0, 0.5.0 Jun 11, 2023
@maxirmx maxirmx modified the milestones: 0.6.0, 0.5.5 Nov 29, 2023
@maxirmx maxirmx linked a pull request May 22, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Tebako Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants