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

Work around a header name collission on util.h #26

Merged
merged 1 commit into from Nov 3, 2020

Conversation

Hugmeir
Copy link
Contributor

@Hugmeir Hugmeir commented Sep 24, 2020

Perl provides a util.h.
openpty() comes from a system util.h in OSX.

The end result is that the system util.h is unreachable,
and so openpty() is never declared.

This commit works around this in a nasty and non-portable
fashiom. First, it adds a second way of including the header
in the XS code:

#ifdef UTIL_H_ABS_PATH
# define UTIL_H_ABS_PATH
#endif

And second, it uses an arcane command to figure out
the exact header that gcc or clang ended up finding.

It's pretty terrible, all things told, but since it'll only
really kick in for OSX, the horror is somewhat contained.

This was previously reported here: #25

Perl provides a util.h.
openpty() comes from a system util.h in OSX.

The end result is that the system util.h is unreachable,
and so openpty() is never declared.

This commit works around this in a nasty and non-portable
fashiom.  First, it adds a second way of including the header
in the XS code:

    #ifdef UTIL_H_ABS_PATH
    # define UTIL_H_ABS_PATH
    #endif

And second, it uses an arcane command to figure out
the exact header that gcc or clang ended up finding.

It's pretty terrible, all things told, but since it'll only
really kick in for OSX, the horror is somewhat contained.
@toddr
Copy link
Member

toddr commented Oct 26, 2020

@haarg indicates that: "upgrading EUMM should allow IO::Tty to work". Can you clarify what version? should we require it or is that not worth it given it's only an OSX issue?

@haarg
Copy link

haarg commented Oct 26, 2020

The new XCode has enabled errors for "implicit declaration of function", which is why this started failing. ExtUtils::MakeMaker 7.49_04 works around this by disabling those errors.

But the util.h problem is still worth addressing IMO. The workaround in this PR is ugly, but I'm not aware of any easy fixes.

It may be worth addressing this in perl core. Having a util.h header is rather unfortunate, and likely could be renamed.

@toddr toddr merged commit 5c91c1e into cpan-authors:master Nov 3, 2020
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.

None yet

3 participants