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

Allow options to be passed to prelink in Windows #12453

Closed
p5pRT opened this issue Oct 2, 2012 · 16 comments
Closed

Allow options to be passed to prelink in Windows #12453

p5pRT opened this issue Oct 2, 2012 · 16 comments

Comments

@p5pRT
Copy link

p5pRT commented Oct 2, 2012

Migrated from rt.perl.org#115100 (status was 'resolved')

Searchable as RT115100$

@p5pRT
Copy link
Author

p5pRT commented Oct 2, 2012

From @ikegami

Created by @ikegami

Hi,

When using MS's compiler, symbols aren't exported by DLLs unless
they are explicitly declared to be exported. One way of doing
this is through a .def file.

prelink() builds this .def file. It supports options that allow
one to specify symbols to export, and :​:Base​::link() will forward
these options to prelink(), but the forwarding is missing in
:​:Windows​::link().

Patch forthcoming.

Thanks,
Eric

Perl Info

Flags:
    category=library
    severity=low
    module=ExtUtils::CBuilder

Site configuration information for perl 5.14.2:

Configured by ikegami at Fri Feb  3 19:26:41 PST 2012.

Summary of my perl5 (revision 5 version 14 subversion 2) configuration:
   
  Platform:
    osname=linux, osvers=2.6.32.45-grsec-2.2.2-r2, archname=x86_64-linux
    uname='linux twins 2.6.32.45-grsec-2.2.2-r2 #7 smp tue sep 13 22:11:17 pdt 2011 x86_64 gnulinux '
    config_args='-de -Dprefix=/home/ikegami/usr/perlbrew/perls/5.14.2 -DPERL_SUB_DEPTH_WARN=1000'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.4.5', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib/../lib /usr/lib/../lib /lib /usr/lib /lib64 /usr/lib64
    libs=-lnsl -lgdbm -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.11.3.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.11.3'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'

Locally applied patches:
    


@INC for perl 5.14.2:
    /home/ikegami/usr/perlbrew/perls/5.14.2/lib/site_perl/5.14.2/x86_64-linux
    /home/ikegami/usr/perlbrew/perls/5.14.2/lib/site_perl/5.14.2
    /home/ikegami/usr/perlbrew/perls/5.14.2/lib/5.14.2/x86_64-linux
    /home/ikegami/usr/perlbrew/perls/5.14.2/lib/5.14.2
    .


Environment for perl 5.14.2:
    HOME=/home/ikegami
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LC_COLLATE=C
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/ikegami/usr/perlbrew/bin:/home/ikegami/usr/perlbrew/perls/5.14.2/bin:.:/home/ikegami/bin:/home/ikegami/.gems/bin:/usr/lib/ruby/gems/1.8/bin/:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
    PERLBREW_BASHRC_VERSION=0.41
    PERLBREW_HOME=/home/ikegami/.perlbrew
    PERLBREW_MANPATH=/home/ikegami/usr/perlbrew/perls/5.14.2/man
    PERLBREW_PATH=/home/ikegami/usr/perlbrew/bin:/home/ikegami/usr/perlbrew/perls/5.14.2/bin
    PERLBREW_PERL=5.14.2
    PERLBREW_ROOT=/home/ikegami/usr/perlbrew
    PERLBREW_VERSION=0.41
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Oct 2, 2012

From @ikegami

Patch attached. Not sure what to do about the file versions.

@p5pRT
Copy link
Author

p5pRT commented Oct 2, 2012

From @ikegami

0001-Allow-a-list-of-symbols-to-export-to-be-passed-to-li.patch
From 7376a39ef4f98e8cc890df640408d0a863f0f001 Mon Sep 17 00:00:00 2001
From: Eric Brine <ikegami@adaelis.com>
Date: Mon, 1 Oct 2012 19:30:04 -0700
Subject: [PATCH] Allow a list of symbols to export to be passed to link() when on Windows, as on other OSes.

---
 .../lib/ExtUtils/CBuilder/Platform/Windows.pm      |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows.pm
index 20fabf7..32bf482 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows.pm
@@ -212,7 +212,8 @@ sub link {
 
   (my $def_base = $spec{def_file}) =~ tr/'"//d;
   $def_base =~ s/\.def$//;
-  $self->prelink( dl_name => $args{module_name},
+  $self->prelink( %args,
+                  dl_name => $args{module_name},
                   dl_file => $def_base,
                   dl_base => $spec{basename} );
 
-- 
1.7.2.5

@p5pRT
Copy link
Author

p5pRT commented Oct 2, 2012

@ikegami - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Oct 2, 2012

From @steve-m-hay

Eric Brine via RT wrote on 2012-10-02​:

Patch attached. Not sure what to do about the file versions.

Thanks for the patch. It looks good to me. I will test it and apply later with appropriate version bumps if all is well.

@p5pRT
Copy link
Author

p5pRT commented Oct 2, 2012

From @Leont

On Tue, Oct 2, 2012 at 4​:37 AM, Eric Brine <perlbug-followup@​perl.org> wrote​:

When using MS's compiler, symbols aren't exported by DLLs unless
they are explicitly declared to be exported. One way of doing
this is through a .def file.

prelink() builds this .def file. It supports options that allow
one to specify symbols to export, and :​:Base​::link() will forward
these options to prelink(), but the forwarding is missing in
:​:Windows​::link().

I can't say I'm surprised it's broken in such a way, I've fixed
similar bugs before. We never tested any behavior beyond the barest
Perl extension building, so anything more than that can be assumed to
be broken on Windows until proven otherwise. EU​::CB is a POS like
that.

Leon

@p5pRT
Copy link
Author

p5pRT commented Oct 2, 2012

From @ikegami

On Tue, Oct 2, 2012 at 4​:02 AM, Steve Hay <Steve.Hay@​verosoftware.com> wrote​:

Thanks for the patch. It looks good to me. I will test it and apply later with appropriate version bumps if all is well.

I tested it by changing

  $cb->link(objects => [$o_file], module_name => "t​::dyna_low");

to

  $cb->link(objects => [$o_file], module_name => "t​::dyna_low",
dl_func_list => [qw( boot_t__dyna_low dynalow_foo dynalow_bar )]);

in DynaLoader​::Functions's t/dyna_low.t. The test doesn't succeed with
MS's cl without the change.

- Eric

@p5pRT
Copy link
Author

p5pRT commented Oct 3, 2012

From @steve-m-hay

Thanks again, now applied as 4ae0770.

@p5pRT
Copy link
Author

p5pRT commented Oct 3, 2012

From [Unknown Contact. See original ticket]

Thanks again, now applied as 4ae0770.

@p5pRT
Copy link
Author

p5pRT commented Oct 3, 2012

@steve-m-hay - Status changed from 'open' to 'resolved'

@p5pRT
Copy link
Author

p5pRT commented Mar 11, 2013

From @ikegami

On Wed, Oct 3, 2012 at 3​:45 AM, Steve Hay via RT
<perlbug-comment@​perl.org>wrote​:

Thanks again, now applied as 4ae0770.

Will :​:CBuilder be released to CPAN when 5.18 comes out?

I'm waiting on this to fix other modules.

@p5pRT
Copy link
Author

p5pRT commented May 23, 2013

@ikegami - Status changed from 'resolved' to 'open'

@p5pRT
Copy link
Author

p5pRT commented May 23, 2013

From @ikegami

On Sun Mar 10 17​:31​:50 2013, ikegami@​adaelis.com wrote​:

On Wed, Oct 3, 2012 at 3​:45 AM, Steve Hay via RT
<perlbug-comment@​perl.org>wrote​:

Thanks again, now applied as 4ae0770.

Will :​:CBuilder be released to CPAN when 5.18 comes out?

I'm waiting on this to fix other modules.

Hi,

ExtUtils​::CBuilder is dual-lifed, but the CPAN release is out of date.
Could we please please please have a CPAN release of the
ExtUtils​::CBuilder found in 5.18?

Thanks,
Eric

@p5pRT
Copy link
Author

p5pRT commented May 23, 2013

From @Leont

On Thu, May 23, 2013 at 9​:08 PM, Eric Brine via RT
<perlbug-followup@​perl.org> wrote​:

ExtUtils​::CBuilder is dual-lifed, but the CPAN release is out of date.
Could we please please please have a CPAN release of the
ExtUtils​::CBuilder found in 5.18?

I think Alberto volunteered for that ;-)

Leon

@p5pRT
Copy link
Author

p5pRT commented Sep 13, 2013

From @ikegami

On Thu, May 23, 2013 at 5​:21 PM, Leon Timmermans via RT <
perlbug-followup@​perl.org> wrote​:

On Thu, May 23, 2013 at 9​:08 PM, Eric Brine via RT
<perlbug-followup@​perl.org> wrote​:

ExtUtils​::CBuilder is dual-lifed, but the CPAN release is out of date.
Could we please please please have a CPAN release of the
ExtUtils​::CBuilder found in 5.18?

I think Alberto volunteered for that ;-)

Leon

w00t! It's been done! Closing ticket.

@p5pRT
Copy link
Author

p5pRT commented Sep 13, 2013

@ikegami - Status changed from 'open' to 'resolved'

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

No branches or pull requests

1 participant