Skip to content

EU::MM doesn't link $Config{libs} into dynamic extensions on Cygwin #17805

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

Closed
tonycoz opened this issue May 26, 2020 · 1 comment · Fixed by Perl-Toolchain-Gang/ExtUtils-MakeMaker#353

Comments

@tonycoz
Copy link
Contributor

tonycoz commented May 26, 2020

Module: ExtUtils::MakeMaker

Description

This appears to be a EU::MM issue, but has caused problems in core.

EU::MM doesn't link $Config{libs} into dynamic extensions on Cygwin, but does on Win32, which means anything that happens to call inline functions that use functions imported from those libraries fails to link.

On Win32, LDLOADLIBS is intialized from $Config{libs} in EU::MM_Win32::init_others():

sub init_others {
    my $self = shift;

    $self->{LD}     ||= 'link';
    $self->{AR}     ||= 'lib';

    $self->SUPER::init_others;

    $self->{LDLOADLIBS} ||= $Config{libs};

and then used in the link step in xs_make_dynamic_lib(), GCC:

      push @m, _sprintf562 <<'EOF', $exportlist, $ldfrom;
	$(LD) %1$s -o $@ $(LDDLFLAGS) %2$s $(OTHERLDFLAGS) $(MYEXTLIB) "$(PERL_ARCHIVE)" $(LDLOADLIBS) -Wl,--enable-auto-image-base

and MSVC:

      push @m, sprintf <<'EOF', $ldfrom, $exportlist;
	$(LD) -out:$@ $(LDDLFLAGS) %s $(OTHERLDFLAGS) $(MYEXTLIB) "$(PERL_ARCHIVE)" $(LDLOADLIBS) -def:%s

but this doesn't happen on Cygwin, and since Cygwin uses Win32's dynamic linking mechanism (names are resolved at link time) linking will fail.

Note that this is currently only a problem in a core build with -Dusequadmath, but would also have been a problem if Cygwin had a separate libm, or if a debug string handling library was linked in (references to strlen() in inline would refer to the wrong library).

Steps to Reproduce

Prior to 1888563, try to build perl on Cygwin with -Dusequadmath.

Note that with some work on the ext/POSIX Makefile.PL this would allow ext/POSIX not have to explicitly link to libquadmath.

Expected behavior
$Config{libs} is linked into extensions by default.

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

Successfully merging a pull request may close this issue.

2 participants