Project

General

Profile

Actions

Feature #15665

closed

Cannot compile socket extension on Mojave

Added by franklinyu (Franklin Yu) over 5 years ago. Updated almost 5 years ago.

Status:
Closed
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

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #16362: Unable to build Ruby 2.6.5 on Manjaro Linux 18.1.3ClosedActions

Updated by hsbt (Hiroshi SHIBATA) over 5 years 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) over 5 years 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) over 5 years 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) over 5 years 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) over 5 years 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) over 5 years 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) over 5 years 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)
Actions #8

Updated by nobu (Nobuyoshi Nakada) over 5 years ago

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

Updated by nobu (Nobuyoshi Nakada) over 5 years 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) over 5 years 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) over 5 years ago

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

Updated by hsbt (Hiroshi SHIBATA) over 5 years 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) over 5 years 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) over 5 years ago

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

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

I did set the tracker to "feature", since this added the support for "-Wpedantic" option, but will leave this to the branch maintainers.

Updated by naruse (Yui NARUSE) almost 5 years ago

Usually -pedantic is applied automatically ruby core but not passed to extension libraries.
Such "suppress warnings" are usually not considered as a bug because it may cause side effect.

Updated by franklinyu (Franklin Yu) almost 5 years ago

naruse (Yui NARUSE) wrote:

Usually -pedantic is applied automatically ruby core but not passed to extension libraries.
Such "suppress warnings" are usually not considered as a bug because it may cause side effect.

I knew that Ruby was compiled with -pedantic; wasn’t aware that this was for core only. Thanks a lot for the explanation. Look forward to the release in Christmas.

Actions #18

Updated by mame (Yusuke Endoh) almost 5 years ago

  • Related to Bug #16362: Unable to build Ruby 2.6.5 on Manjaro Linux 18.1.3 added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0