Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.88k stars 530 forks source link

Embedding regression building golly: Perl_newSV_type #10052

Closed p5pRT closed 14 years ago

p5pRT commented 14 years ago

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

Searchable as RT71784$

p5pRT commented 14 years ago

From @hvds

Created by @hvds

The cellular automaton simulator 'golly' (http​://golly.sourceforge.net/) has embedded perl (and python) support from C++. Note that it requires a perl built with threading support.

Building golly-src-2.1 with perl-5.8.8 gives me the warning​:   cc1plus​: warning​: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++ .. but otherwise works fine.

Building with perl-5.10.0 works fine\, with no warnings.

Building with perl-5.10.1 or with perl-5.11.2 fails with this error at link time​: g++ `wx-config --cxxflags` -O5 -DZLIB -DVERSION=2.1 -Wall -Wno-non-virtual-dtor -fno-strict-aliasing -o golly ObjGTK/bigint.o ObjGTK/lifealgo.o ObjGTK/hlifealgo.o ObjGTK/hlifedraw.o ObjGTK/qlifealgo.o ObjGTK/qlifedraw.o ObjGTK/jvnalgo.o ObjGTK/ruletreealgo.o ObjGTK/ruletable_algo.o ObjGTK/ghashbase.o ObjGTK/ghashdraw.o ObjGTK/readpattern.o ObjGTK/writepattern.o ObjGTK/liferules.o ObjGTK/util.o ObjGTK/liferender.o ObjGTK/viewport.o ObjGTK/lifepoll.o ObjGTK/generationsalgo.o ObjGTK/wxutils.o ObjGTK/wxprefs.o ObjGTK/wxalgos.o ObjGTK/wxrule.o ObjGTK/wxinfo.o ObjGTK/wxhelp.o ObjGTK/wxstatus.o ObjGTK/wxview.o ObjGTK/wxrender.o ObjGTK/wxscript.o ObjGTK/wxperl.o ObjGTK/wxpython.o ObjGTK/wxfile.o ObjGTK/wxedit.o ObjGTK/wxcontrol.o ObjGTK/wxundo.o ObjGTK/wxselect.o ObjGTK/wxlayer.o ObjGTK/wxmain.o ObjGTK/wxgolly.o `wx-config --libs` -lz `perl -MExtUtils​::Embed -e '$]\<5.010 && ldopts'` ObjGTK/wxperl.o​: In function `pl_getcolors'​: wxperl.cpp​:(.text+0x6784)​: undefined reference to `Perl_newSV_type' ObjGTK/wxperl.o​: In function `pl_load'​: wxperl.cpp​:(.text+0xc712)​: undefined reference to `Perl_newSV_type' ObjGTK/wxperl.o​: In function `pl_evolve'​: wxperl.cpp​:(.text+0x12189)​: undefined reference to `Perl_newSV_type' ObjGTK/wxperl.o​: In function `pl_transform'​: wxperl.cpp​:(.text+0x12680)​: undefined reference to `Perl_newSV_type' ObjGTK/wxperl.o​: In function `pl_parse'​: wxperl.cpp​:(.text+0x134d4)​: undefined reference to `Perl_newSV_type' ObjGTK/wxperl.o​:wxperl.cpp​:(.text+0x19efd)​: more undefined references to `Perl_newSV_type' follow collect2​: ld returned 1 exit status make​: *** [golly] Error 1

The missing symbol is mentioned as a newly added function in the 5.10.1 and 5.11.0 deltalogs\, is this simply a failure to export the new symbol correctly?

The linkage to perl in the application is handled entirely in the file wxperl.cpp\, I'm not sure if it's doing anything in unusually strange ways. As far as I can see Perl_newSV_type is pulled in solely for newAV() calls in this case.

I don't know much about embedding\, so I hope this is obvious to someone. I haven't yet contacted the golly maintainers\, since to me this looks like the problem is at perl's end.

Hugo

Perl Info ``` Flags: category=core severity=medium Site configuration information for perl 5.10.1: Configured by hv at Wed Dec 30 16:34:02 GMT 2009. Summary of my perl5 (revision 5 version 10 subversion 1) configuration: Platform: osname=linux, osvers=2.6.22.14-72.fc6, archname=i686-linux-thread-multi uname='linux zen.crypt.org 2.6.22.14-72.fc6 #1 smp wed nov 21 13:44:07 est 2007 i686 i686 i386 gnulinux ' config_args='-des -Dprefix=/opt/perl-5.10.1-t -Doptimize=-g -O6 -Dusethread -Duseithreads -Dusedevel -Uversiononly' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-g -O6', cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.1.2 20070626 (Red Hat 4.1.2-13)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib/libc-2.5.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.5' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -g -O6 -L/usr/local/lib -fstack-protector' Locally applied patches: @INC for perl 5.10.1: /opt/perl-5.10.1-t/lib/5.10.1/i686-linux-thread-multi /opt/perl-5.10.1-t/lib/5.10.1 /opt/perl-5.10.1-t/lib/site_perl/5.10.1/i686-linux-thread-multi /opt/perl-5.10.1-t/lib/site_perl/5.10.1 . Environment for perl 5.10.1: HOME=/home/hv LANG=C LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/hv/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin PERL_BADLANG (unset) SHELL=/bin/bash ```
p5pRT commented 14 years ago

From perl@profvince.com

Building with perl-5.10.0 works fine\, with no warnings.

Building with perl-5.10.1 or with perl-5.11.2 fails with this error at link time​: g++ `wx-config --cxxflags` -O5 -DZLIB -DVERSION=2.1 -Wall -Wno-non-virtual-dtor -fno-strict-aliasing -o golly ObjGTK/bigint.o ObjGTK/lifealgo.o ObjGTK/hlifealgo.o ObjGTK/hlifedraw.o ObjGTK/qlifealgo.o ObjGTK/qlifedraw.o ObjGTK/jvnalgo.o ObjGTK/ruletreealgo.o ObjGTK/ruletable_algo.o ObjGTK/ghashbase.o ObjGTK/ghashdraw.o ObjGTK/readpattern.o ObjGTK/writepattern.o ObjGTK/liferules.o ObjGTK/util.o ObjGTK/liferender.o ObjGTK/viewport.o ObjGTK/lifepoll.o ObjGTK/generationsalgo.o ObjGTK/wxutils.o ObjGTK/wxprefs.o ObjGTK/wxalgos.o ObjGTK/wxrule.o ObjGTK/wxinfo.o ObjGTK/wxhelp.o ObjGTK/wxstatus.o ObjGTK/wxview.o ObjGTK/wxrender.o ObjGTK/wxscript.o ObjGTK/wxperl.o ObjGTK/wxpython.o ObjGTK/wxfile.o ObjGTK/wxedit.o ObjGTK/wxcontrol.o ObjGTK/wxundo.o ObjGTK/wxselect.o ObjGTK/wxlayer.o ObjGTK/wxmain.o ObjGTK/wxgolly.o `wx-config --libs` -lz `perl -MExtUtils​::Embed -e '$]\<5.010 && ldopts'` ObjGTK/wxperl.o​: In function `pl_getcolors'​: wxperl.cpp​:(.text+0x6784)​: undefined reference to `Perl_newSV_type' ObjGTK/wxperl.o​: In function `pl_load'​: wxperl.cpp​:(.text+0xc712)​: undefined reference to `Perl_newSV_type' ObjGTK/wxperl.o​: In function `pl_evolve'​: wxperl.cpp​:(.text+0x12189)​: undefined reference to `Perl_newSV_type' ObjGTK/wxperl.o​: In function `pl_transform'​: wxperl.cpp​:(.text+0x12680)​: undefined reference to `Perl_newSV_type' ObjGTK/wxperl.o​: In function `pl_parse'​: wxperl.cpp​:(.text+0x134d4)​: undefined reference to `Perl_newSV_type' ObjGTK/wxperl.o​:wxperl.cpp​:(.text+0x19efd)​: more undefined references to `Perl_newSV_type' follow collect2​: ld returned 1 exit status make​: *** [golly] Error 1

The missing symbol is mentioned as a newly added function in the 5.10.1 and 5.11.0 deltalogs\, is this simply a failure to export the new symbol correctly?

newSV_type was correctly listed in global.sym at the time of 5.10.1 (and still is). Hence it should have been correctly exported. But that doesn't really matter on linux anyway\, where all non-static symbols are linkable.

This smells like two versions of perl get mixed in the build for some reason.

Vincent.

p5pRT commented 14 years ago

The RT System itself - Status changed from 'new' to 'open'

p5pRT commented 14 years ago

From ben@morrow.me.uk

Quoth perl5-porters@​perl.org​:

The cellular automaton simulator 'golly' (http​://golly.sourceforge.net/) has embedded perl (and python) support from C++. Note that it requires a perl built with threading support.

Building golly-src-2.1 with perl-5.8.8 gives me the warning​: cc1plus​: warning​: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++ .. but otherwise works fine.

Building with perl-5.10.0 works fine\, with no warnings.

Building with perl-5.10.1 or with perl-5.11.2 fails with this error at link time​: g++ `wx-config --cxxflags` -O5 -DZLIB -DVERSION=2.1 -Wall -Wno-non-virtual-dtor -fno-strict-aliasing -o golly ObjGTK/bigint.o ObjGTK/lifealgo.o ObjGTK/hlifealgo.o ObjGTK/hlifedraw.o ObjGTK/qlifealgo.o ObjGTK/qlifedraw.o ObjGTK/jvnalgo.o ObjGTK/ruletreealgo.o ObjGTK/ruletable_algo.o ObjGTK/ghashbase.o ObjGTK/ghashdraw.o ObjGTK/readpattern.o ObjGTK/writepattern.o ObjGTK/liferules.o ObjGTK/util.o ObjGTK/liferender.o ObjGTK/viewport.o ObjGTK/lifepoll.o ObjGTK/generationsalgo.o ObjGTK/wxutils.o ObjGTK/wxprefs.o ObjGTK/wxalgos.o ObjGTK/wxrule.o ObjGTK/wxinfo.o ObjGTK/wxhelp.o ObjGTK/wxstatus.o ObjGTK/wxview.o ObjGTK/wxrender.o ObjGTK/wxscript.o ObjGTK/wxperl.o ObjGTK/wxpython.o ObjGTK/wxfile.o ObjGTK/wxedit.o ObjGTK/wxcontrol.o ObjGTK/wxundo.o ObjGTK/wxselect.o ObjGTK/wxlayer.o ObjGTK/wxmain.o ObjGTK/wxgolly.o `wx-config --libs` -lz `perl -MExtUtils​::Embed -e '$]\<5.010 && ldopts'`   ^^^^^^^^ What is that doing there? Does the link actually try to pull in -lperl at all? If so\, where does it come from? What about with 5.10.0\, which I would also expect not to link -lperl\, given that command line?

Ben

p5pRT commented 14 years ago

From @hvds

Vincent Pit \perl@&#8203;profvince\.com wrote​: :> Building with perl-5.10.1 or with perl-5.11.2 fails with this error at link :> time​: [...] :> wxperl.cpp​:(.text+0x6784)​: undefined reference to `Perl_newSV_type' [...] :> The missing symbol is mentioned as a newly added function in the 5.10.1 :> and 5.11.0 deltalogs\, is this simply a failure to export the new symbol :> correctly? :>
: :newSV_type was correctly listed in global.sym at the time of 5.10.1 (and :still is). Hence it should have been correctly exported. But that :doesn't really matter on linux anyway\, where all non-static symbols are :linkable. : :This smells like two versions of perl get mixed in the build for some :reason.

Ah ok\, looks like I was confused in several respects​: - I was specifying LD_LIBRARY_PATH only at runtime\, and I guess it was needed at link time too; - I was specifying /opt/perl-5.10.1-t/lib for LD_LIBRARY_PATH\, but the .so is installed to /opt/perl-5.10.1-t/lib/5.10.1/i686-linux-thread-multi/CORE; - in any case I hadn't built any of my local perls with -Duseshrplib\, so they didn't have a libperl.so.

The system perl 5.8.8 *does* have a libperl.so\, so I guess that was being used (rather than the local one I specified) for each build\, and I guess the application didn't use anything that required a new symbol for the 5.10.0 build - not sure whether I count myself lucky or unlucky in that respect.

So now I've worked out how to build the .so\, I just need to work out how to install it without also overwriting the statically-linked perl binary - I guess that makes me a vote in favour of Tim Bunce's proposal to add a makeshrplib option independent of useshrplib. [1]

Any way up\, I'll close this as notabug.

Hugo [1] http​://www.nntp.perl.org/group/perl.perl5.porters/2009/11/msg153121.html

p5pRT commented 14 years ago

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

p5pRT commented 14 years ago

From @hvds

Ben Morrow \ben@&#8203;morrow\.me\.uk wrote​: :Quoth perl5-porters@​perl.org​: :> :> The cellular automaton simulator 'golly' (http​://golly.sourceforge.net/) :> has embedded perl (and python) support from C++. Note that it requires :> a perl built with threading support. :> :> Building golly-src-2.1 with perl-5.8.8 gives me the warning​: :> cc1plus​: warning​: command line option "-Wdeclaration-after-statement" :> is valid for C/ObjC but not for C++ :> .. but otherwise works fine. :> :> Building with perl-5.10.0 works fine\, with no warnings. :> :> Building with perl-5.10.1 or with perl-5.11.2 fails with this error at link :> time​: :> g++ `wx-config --cxxflags` -O5 -DZLIB -DVERSION=2.1 -Wall :> -Wno-non-virtual-dtor -fno-strict-aliasing -o golly ObjGTK/bigint.o :> ObjGTK/lifealgo.o ObjGTK/hlifealgo.o ObjGTK/hlifedraw.o :> ObjGTK/qlifealgo.o ObjGTK/qlifedraw.o ObjGTK/jvnalgo.o :> ObjGTK/ruletreealgo.o ObjGTK/ruletable_algo.o ObjGTK/ghashbase.o :> ObjGTK/ghashdraw.o ObjGTK/readpattern.o ObjGTK/writepattern.o :> ObjGTK/liferules.o ObjGTK/util.o ObjGTK/liferender.o ObjGTK/viewport.o :> ObjGTK/lifepoll.o ObjGTK/generationsalgo.o ObjGTK/wxutils.o :> ObjGTK/wxprefs.o ObjGTK/wxalgos.o ObjGTK/wxrule.o ObjGTK/wxinfo.o :> ObjGTK/wxhelp.o ObjGTK/wxstatus.o ObjGTK/wxview.o ObjGTK/wxrender.o :> ObjGTK/wxscript.o ObjGTK/wxperl.o ObjGTK/wxpython.o ObjGTK/wxfile.o :> ObjGTK/wxedit.o ObjGTK/wxcontrol.o ObjGTK/wxundo.o ObjGTK/wxselect.o :> ObjGTK/wxlayer.o ObjGTK/wxmain.o ObjGTK/wxgolly.o `wx-config --libs` -lz :> `perl -MExtUtils​::Embed -e '$]\<5.010 && ldopts'` : ^^^^^^^^ :What is that doing there? Does the link actually try to pull in -lperl :at all? If so\, where does it come from? What about with 5.10.0\, which I :would also expect not to link -lperl\, given that command line?

The makefile says​: # for Perl script support PERL_INCLUDE = `perl -MExtUtils​::Embed -e ccopts` # note that we must link in the Perl library if the Perl version is older # than 5.10 (this is necessary because boot_DynaLoader is in DynaLoader.a); # if using 5.10 or later we can dynamically load the Perl library because # it contains the boot_DynaLoader code PERL_LINK = `perl -MExtUtils​::Embed -e '$]\<5.010 && ldopts'`

If a different approach is the recommended way\, I'd be happy to communicate it to the authors.

Hugo

p5pRT commented 14 years ago

From @hvds

hv@​crypt.org wrote​: :Ben Morrow \ben@&#8203;morrow\.me\.uk wrote​: :​:Quoth perl5-porters@​perl.org​: [...] :​:> `perl -MExtUtils​::Embed -e '$]\<5.010 && ldopts'` :​: ^^^^^^^^ :​:What is that doing there? Does the link actually try to pull in -lperl :​:at all? If so\, where does it come from? What about with 5.10.0\, which I :​:would also expect not to link -lperl\, given that command line? : :The makefile says​: : # for Perl script support : PERL_INCLUDE = `perl -MExtUtils​::Embed -e ccopts` : # note that we must link in the Perl library if the Perl version is older : # than 5.10 (this is necessary because boot_DynaLoader is in DynaLoader.a); : # if using 5.10 or later we can dynamically load the Perl library because : # it contains the boot_DynaLoader code : PERL_LINK = `perl -MExtUtils​::Embed -e '$]\<5.010 && ldopts'`

Sorry\, the last line is actually​:   PERL_LINK = `perl -MExtUtils​::Embed -e '$$]\<5.010 && ldopts'`

:If a different approach is the recommended way\, I'd be happy to communicate :it to the authors.

Hugo