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

Modify options for darwin platforms #178

Closed
wants to merge 1 commit into from

Conversation

qnighy
Copy link
Contributor

@qnighy qnighy commented Dec 10, 2020

It is known that we need a different set of options for the darwin platforms as seen in:

This patch backports the modifications above, and also fixes #177.

@kou
Copy link
Member

kou commented Dec 10, 2020

cross-ruby.rake is for building Windows binaries by Mingw-w64.
Why do you want to use it for macOS?

@qnighy
Copy link
Contributor Author

qnighy commented Dec 11, 2020

cross-ruby.rake is for building Windows binaries by Mingw-w64.
Why do you want to use it for macOS?

In fact, I'm not sure about the exact reason why google-protobuf, grpc, or nokogiri uses rake-compiler for non-Windows platforms. I made this patch only because I wanted to easily reproduce build environments for google-protobuf.

Nevertheless, I thought it's a common usecase because rake-compiler-dock provides builds for Linux.

@kou
Copy link
Member

kou commented Dec 11, 2020

I wanted to easily reproduce build environments for google-protobuf.

How about using https://github.com/protocolbuffers/protobuf/blob/v4.0.0-rc2/kokoro/release/ruby/macos/ruby/ruby_build_environment.sh#L27-L50 instead of using raw rake-compiler?

Nevertheless, I thought it's a common usecase because rake-compiler-dock provides builds for Linux.

I'm not sure about it's a common use case but cross-ruby.rake isn't for it.

@qnighy
Copy link
Contributor Author

qnighy commented Dec 12, 2020

How about using https://github.com/protocolbuffers/protobuf/blob/v4.0.0-rc2/kokoro/release/ruby/macos/ruby/ruby_build_environment.sh#L27-L50 instead of using raw rake-compiler?

Yeah, that's what I'm doing now. And it took a while to figure out we need the following additional patch:

-    'LDFLAGS=-pipe -s',
+    'LDFLAGS=-pipe',

So I made this PR to share the knowledge with whoever needs it.

I'm not sure about it's a common use case but cross-ruby.rake isn't for it.

I thought rake-compiler-dock shares philosophy with rake-compiler (because they're in the same org), but is it not?

@kou
Copy link
Member

kou commented Dec 13, 2020

Philosophy...?
I'm just the current maintainer not the original author but I don't have philosophy of this project... What do you want to say by it? "You should accept this patch"?
Anyway, we don't list the feature in our feature overview: https://github.com/rake-compiler/rake-compiler#feature-overview

If we add support for building different version Rubies for the current platform, we need to redesign and rename the current cross-ruby.task. It's not "cross-compiling".

We can't accept this patch because this approach is too ad-hoc. MINGW_TARGET =~ /darwin/ is strange. MinGW is "Minimalist GNU for Windows". It's not related to Darwin.

@kou kou closed this Dec 13, 2020
@qnighy qnighy deleted the darwin-options branch December 14, 2020 02:08
@qnighy
Copy link
Contributor Author

qnighy commented Dec 14, 2020

What do you want to say by it? "You should accept this patch"?

Depends on the answer. It's fine if rake-compiler is totally for MinGW only and rake-compiler-dock's Linux builds are only working by chance. Or if Linux is supported but darwin is out of support, then that would be fine too, although unfortunate to me. I wanted to clarify which of them are supported.

If we add support for building different version Rubies for the current platform, we need to redesign and rename the current cross-ruby.task. It's not "cross-compiling".

I agree that the current use-case is not a cross-compilation. However, I think supporting darwin hosts or darwin targets does sometimes imply cross-compilation because darwin runs on several ISAs.

We can't accept this patch because this approach is too ad-hoc.

I'm confused again. Then is there a chance such a change is accepted if cross-ruby.rake is refactored in a non-ad-hoc way? Like renaming MINGW_* into some other names and supporting both .exe and non-.exe files...

@larskanis
Copy link
Member

I'm currently adding support for MacOS to rake-compiler-dock. It mostly works already - I expect to have it ready when ruby-3.0.0 comes out. First I aim to support x86_64-apple-darwin, maybe later arm64-apple-darwin as cross targets.

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

Successfully merging this pull request may close these issues.

Fails on macOS: something wrong with LDFLAGS="-pipe -s"
3 participants