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

grpc doesn't build on M1 Mac (aarch64) with 22.2.0 #2697

Closed
ollym opened this issue Jul 28, 2022 · 9 comments
Closed

grpc doesn't build on M1 Mac (aarch64) with 22.2.0 #2697

ollym opened this issue Jul 28, 2022 · 9 comments
Assignees
Labels

Comments

@ollym
Copy link

ollym commented Jul 28, 2022

gem install grpc
Building native extensions. This could take a while...
ERROR:  Error installing grpc:
	ERROR: Failed to build gem native extension.

Followed by long list of errors, ending with:

29 warnings generated.
linking shared-object grpc/grpc_c.bundle
Stripping grpc_c.bundle
/Users/ollym/.rbenv/versions/truffleruby-22.2.0/lib/llvm-toolchain/bin/llvm-strip: error: option not supported by llvm-objcopy for MachO
make: *** [strip] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/ollym/.rbenv/versions/truffleruby-22.2.0/lib/gems/gems/grpc-1.48.0 for inspection.
Results logged to /Users/ollym/.rbenv/versions/truffleruby-22.2.0/lib/gems/extensions/aarch64-darwin/3.0.3.22.2.0/grpc-1.48.0/gem_make.out
@ollym ollym changed the title grpc doesn't build on M1 Mac with 22.2.0 grpc doesn't build on M1 Mac (aarch64) with 22.2.0 Jul 28, 2022
@eregon eregon added the cexts label Jul 28, 2022
@eregon
Copy link
Member

eregon commented Jul 28, 2022

Thanks for the report.
grpc 1.48.0 should install fine, since it includes the fixes: https://github.com/grpc/grpc/releases/tag/v1.48.0
But apparently it does not work yet for you.

Could you share the gem_make.out and the mkmf.log (somewhere under /Users/ollym/.rbenv/versions/truffleruby-22.2.0/lib/gems/gems/grpc-1.48.0)?

I wonder which option is it which is not supported by llvm-objcopy for MachO.

@eregon
Copy link
Member

eregon commented Jul 28, 2022

I wonder if that option is --keep-section=.llvmbc:

'STRIP' => "#{strip} --keep-section=.llvmbc",

Because https://github.com/grpc/grpc/blob/dd77c67217b10ffeaf766e25eb8b46d2d59de4ff/src/ruby/ext/grpc/extconf.rb#L159 does not seem to add strip options.

@eregon eregon self-assigned this Jul 28, 2022
@eregon eregon added this to the 22.3.0 milestone Jul 28, 2022
@eregon
Copy link
Member

eregon commented Jul 28, 2022

I have a fix and a test for it, it should merge soon. We simply need to not pass --keep-section=.llvmbc on macOS because it is not supported on macOS, but yet macOS keeps the bitcode by default (unlike Linux where the flag is needed).

@ollym
Copy link
Author

ollym commented Jul 28, 2022

gem_make.out
https://gist.github.com/ollym/343869d0573e870d0bceba5dfd8c19b9

I couldn't find mkmf.log

graalvmbot pushed a commit that referenced this issue Jul 29, 2022
…tions on macOS (#2697)

PullRequest: truffleruby/3445
@eregon
Copy link
Member

eregon commented Jul 29, 2022

Fixed in 4a02764. You can try truffleruby-dev and it will be in the next release.

@ollym
Copy link
Author

ollym commented Aug 3, 2022

@eregon I'm still struggling installing grpc with truffleruby-dev (installed via rbenv) also

$ gem install grpc
Building native extensions. This could take a while...
ERROR:  Error installing grpc:
	ERROR: Failed to build gem native extension.

...many errors...

fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [/Users/ollym/.rbenv/versions/truffleruby-dev/lib/gems/gems/grpc-1.48.0/src/ruby/ext/grpc/objs/opt/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.o] Error 1
make: *** Waiting for unfinished jobs....
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/Users/ollym/.rbenv/versions/truffleruby-dev/bin/ruby
log file does not exist

extconf failed, exit code 1

Gem files will remain installed in /Users/ollym/.rbenv/versions/truffleruby-dev/lib/gems/gems/grpc-1.48.0 for inspection.
Results logged to /Users/ollym/.rbenv/versions/truffleruby-dev/lib/gems/extensions/aarch64-darwin/3.0.3.7/grpc-1.48.0/gem_make.out

The contents of gem_make.out are here: https://gist.github.com/ollym/992c273ab98331c5ee1fd2e6652f1ace

@eregon
Copy link
Member

eregon commented Aug 8, 2022

The actual error is:

/Users/ollym/.rbenv/versions/truffleruby-dev/lib/sulong/native/bin/graalvm-native-clang++ -Ithird_party/address_sorting/include -Ithird_party/cares/cares/include -Ithird_party/cares -Ithird_party/cares/cares  -D_DARWIN_C_SOURCE -DTRUFFLERUBY_ABI_VERSION=3.0.3.7  -I/opt/homebrew/opt/openssl@1.1/include  -I/opt/homebrew/opt/openssl@1.1/include -DGPR_BACKWARDS_COMPATIBILITY_MODE -DGRPC_XDS_USER_AGENT_NAME_SUFFIX="\"RUBY\"" -DGRPC_XDS_USER_AGENT_VERSION_SUFFIX="\"1.48.0\"" -g -Wall -Wextra -DOSATOMIC_USE_INLINED=1 -Ithird_party/abseil-cpp -Ithird_party/re2 -Ithird_party/upb -Isrc/core/ext/upb-generated -Isrc/core/ext/upbdefs-generated -Ithird_party/xxhash -O2 -Wframe-larger-than=16384 -fPIC -I. -Iinclude -I/Users/ollym/.rbenv/versions/truffleruby-dev/lib/gems/gems/grpc-1.48.0/src/ruby/ext/grpc/gens -DNDEBUG -DINSTALL_PREFIX=\"/usr/local\"   -std=c++14 -stdlib=libc++   -fno-exceptions -MMD -MF /Users/ollym/.rbenv/versions/truffleruby-dev/lib/gems/gems/grpc-1.48.0/src/ruby/ext/grpc/objs/opt/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.dep -c -o /Users/ollym/.rbenv/versions/truffleruby-dev/lib/gems/gems/grpc-1.48.0/src/ruby/ext/grpc/objs/opt/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.o src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc
In file included from src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc:44:
In file included from third_party/xxhash/xxhash.h:2718:
/Users/ollym/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/lib/clang/14.0.3/include/arm_neon.h:32:2: error: "NEON support not enabled"
#error "NEON support not enabled"
 ^

And so that's a duplicate of oracle/graal#4726, please follow that issue.

@eregon
Copy link
Member

eregon commented Aug 8, 2022

The problem is likely already solved, except that https://github.com/ruby/truffleruby-dev-builder/actions hasn't produced a build recently due to an issue on macOS builders, which should be fixed soon (i.e. I'd guess fixed by Wednesday).

@eregon
Copy link
Member

eregon commented Aug 8, 2022

Correction, the latest dev build even though it is old has that fix, so please follow on oracle/graal#4726

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants