Project

General

Profile

Feature #15665

Cannot compile socket extension on Mojave

Added by franklinyu (Franklin Yu) 4 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:91824]

Description

The mkmf.log is reporting that it cannot find netinet6/in6.h. I guess that previously it’s finding it in /usr/include, but as we all know Apple removed that path since Mojave. On my machine the current path is:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/

The C compiler seems fine if I’m using it stand-alone. I tried compiling following snippet:

#include <netinet/in.h>
int main() {}
int t(struct in6_addr *addr) {
    return IN6_IS_ADDR_UNSPECIFIED(addr);
}

And it works, although I have no idea which header it included. I tried both compiling it with cc test.c, and with the actual command in mkmf.log:

clang -I../../.ext/include/x86_64-darwin18 -I../.././include -I../.././ext/socket -I../.. -I../../. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wall -Wextra -Wpedantic -Wshadow -pipe -D__APPLE_USE_RFC_3542 -Werror

Both works without any warning/error.

note

This only happens to 2.6.0 and 2.6.1. Releases in 2.5.x or below are not affected.


Files

mkmf.log (143 KB) mkmf.log franklinyu (Franklin Yu), 05/23/2019 05:10 AM

Associated revisions

Revision fe3ff5af
Added by nobu (Nobuyoshi Nakada) about 2 months ago

Suppress paranoid warnings for external/3rd-party libraries

[Feature #15665]

History

Updated by hsbt (Hiroshi SHIBATA) 4 months ago

  • Status changed from Open to Rejected

I couldn't reproduce this with Mojave.

~ > ls /usr/include/netinet6/in6.h
/usr/include/netinet6/in6.h

It seems your development environment issue.

Updated by franklinyu (Franklin Yu) 2 months ago

  • Status changed from Rejected to Open

hsbt (Hiroshi SHIBATA) That location has been deprecated:

The command line tools will search the SDK for system headers by default. However, some software may fail to build correctly against the SDK and require macOS headers to be installed in the base system under /usr/include. If you are the maintainer of such software, we encourage you to update your project to work with the SDK or file a bug report for issues that are preventing you from doing so. As a workaround, an extra package is provided which will install the headers to the base system. In a future release, this package will no longer be provided.

Please be future-proof. It’s totally possible that Ruby 2.6 will break in macOS 10.15.

hsbt (Hiroshi SHIBATA) wrote:

I couldn't reproduce this with Mojave.

~ > ls /usr/include/netinet6/in6.h
/usr/include/netinet6/in6.h

It seems your development environment issue.

Updated by hsbt (Hiroshi SHIBATA) 2 months ago

  • Status changed from Open to Rejected

Do not change status field.

Maybe you can resolve this with sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

Updated by nobu (Nobuyoshi Nakada) 2 months ago

  • Status changed from Rejected to Feedback

That check is necessary only for very old, 6 years ago, header.
It is strange that IN6_IS_ADDR_UNSPECIFIED code cannot compile.
Could you show how it failed in mkmf.log?

Updated by franklinyu (Franklin Yu) about 2 months ago

hsbt (Hiroshi SHIBATA) wrote:

Do not change status field.

Maybe you can resolve this with sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

That is a workaround. It will break in the future. Please read the bold text in the quote. If by your definition my environment is broken, then maybe next year all macOS user will have broken environment.

nobu (Nobuyoshi Nakada) wrote:

That check is necessary only for very old, 6 years ago, header.
It is strange that IN6_IS_ADDR_UNSPECIFIED code cannot compile.
Could you show how it failed in mkmf.log?

I’m busy now but I will provide the log in 48 hours. Thanks for this information.

Updated by franklinyu (Franklin Yu) about 2 months ago

nobu (Nobuyoshi Nakada) wrote:

That check is necessary only for very old, 6 years ago, header.
It is strange that IN6_IS_ADDR_UNSPECIFIED code cannot compile.
Could you show how it failed in mkmf.log?

Please find attached. I was trying to install 2.6.3 version.

Updated by nobu (Nobuyoshi Nakada) about 2 months ago

From where -Werror and -Wunused-parameter came?

"clang -I../../.ext/include/x86_64-darwin18 -I../.././include -I../.././ext/socket -I../.. -I../../.  -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -Wall -Wextra -Wpedantic -Wshadow -pipe -D__APPLE_USE_RFC_3542  -Werror -c conftest.c"
In file included from conftest.c:1:
In file included from ../.././include/ruby.h:33:
../.././include/ruby/ruby.h:2186:35: error: unused parameter 'allow_transient' [-Werror,-Wunused-parameter]
rb_array_ptr_use_end(VALUE a, int allow_transient)
#8

Updated by nobu (Nobuyoshi Nakada) about 2 months ago

  • Backport deleted (2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN)
  • ruby -v deleted (2.6.0)
  • Tracker changed from Bug to Feature
#9

Updated by nobu (Nobuyoshi Nakada) about 2 months ago

  • Status changed from Feedback to Closed

Applied in changeset git|fe3ff5afb07e171fd950623c69abfbabbb2762a3.


Suppress paranoid warnings for external/3rd-party libraries

[Feature #15665]

Updated by franklinyu (Franklin Yu) about 2 months ago

nobu (Nobuyoshi Nakada) wrote:

Applied in changeset git|fe3ff5afb07e171fd950623c69abfbabbb2762a3.


Suppress paranoid warnings for external/3rd-party libraries

[Feature #15665]

I have verified that the changeset works for 2.6 on my machine. It is currently in trunk, which would go to 2.7 eventually; would it be backported to 2.6 branch?

Updated by franklinyu (Franklin Yu) about 1 month ago

Hello? Any update? Would it be included in 2.6.4?

Updated by hsbt (Hiroshi SHIBATA) about 1 month ago

I'm not sure nobu's changesets are bug or feature.

But this issue was marked with "Feature" by nobu. We never backport the new feature to stable versions.

Updated by franklinyu (Franklin Yu) about 1 month ago

nobu (Nobuyoshi Nakada) This should be a bug, not feature. Please mark it as a bug and backport it into 2.6 branch.

Updated by franklinyu (Franklin Yu) about 1 month ago

nobu (Nobuyoshi Nakada) Please update, or is there any reason that this should be a feature instead of a bug?

Also available in: Atom PDF