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

Native extension won’t compile on macOS 10.16/11.0 Big Sur beta #81

Closed
georgeclaghorn opened this issue Jul 7, 2020 · 0 comments · Fixed by #82
Closed

Native extension won’t compile on macOS 10.16/11.0 Big Sur beta #81

georgeclaghorn opened this issue Jul 7, 2020 · 0 comments · Fixed by #82

Comments

@georgeclaghorn
Copy link
Contributor

georgeclaghorn commented Jul 7, 2020

$ gem install rbtrace
...
rbtrace.c:1097:3: error: implicit declaration of function 'rb_postponed_job_register_one' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  rb_postponed_job_register_one(0, rbtrace__receive, 0);
  ^
2 warnings and 1 error generated.
make: *** [rbtrace.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/george/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rbtrace-0.4.13 for inspection.
Results logged to /Users/george/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-darwin-20/2.7.0/rbtrace-0.4.13/gem_make.out

The proximate cause of this appears to be that clang from the Xcode 12 Beta Command Line Tools now sets -Werror=implicit-function-declaration by default:

Clang now reports an error when you use a function without an explicit declaration when building C or Objective-C code for macOS (-Werror=implicit-function-declaration flag is on). This additional error detection unifies Clang’s behavior for iOS/tvOS and macOS 64-bit targets for this diagnostic. (49917738)

Passing -Wno-implicit-function-declaration fixes:

$ gem install rbtrace -- --with-cflags=-Wno-implicit-function-declaration
Building native extensions with: '--with-cflags=-Wno-implicit-function-declaration'
This could take a while...
Successfully installed rbtrace-0.4.13
1 gem installed

…though it might be unintentional that we’re relying on the implicit declaration of rb_postponed_job_register_one.

@tmm1 tmm1 closed this as completed in #82 Jul 7, 2020
tmm1 pushed a commit that referenced this issue Jul 7, 2020
…one prototype

Avoids relying on the implicit declaration. Fixes compiling with latest Clang from Xcode 12. Closes #81.
ricardohsd added a commit to hoteltonight/trie that referenced this issue Oct 19, 2020
There is an issue when installing this gem on recent MacOs:

Clang now reports an error when you use a function without an explicit declaration when building C or Objective-C code for macOS (-Werror=implicit-function-declaration flag is on). This additional error detection unifies Clang’s behavior for iOS/tvOS and macOS 64-bit targets for this diagnostic. (49917738)

tmm1/rbtrace#81
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 a pull request may close this issue.

1 participant