Hi again, perhaps you can help me with this new problem i have related to the last.

I'm stuck because even if the program i wrote as an example compiles fine, the real module for my project does not and i believe it's because PERL_NO_SHORT_NAMES is not defined or respected in my project while it is in the example program.

I can make no sense at all of this because in my example program, i have Perl_doing_taint even if i remove the #define PERL_NO_SHORT_NAMES directive.

While it always uses the short names in my project, what is causing this? I've tried modifying the arguments i use to compile so many times and the way i see it the main differences are that in my project i have -lircbot which links all my modules to a library with some common functions for them to use.

Besides that i bring in the ccopts and ldopts in a configure script which strips the newline and puts it all into a variable so it looks like this: PERL_OPTS=  -Wl,-R/usr/local/lib/perl5/5.8.8/mach/CORE  -Wl,-E -L/usr/local/lib /usr/local/lib/perl5/5.8.8/mach/auto/DynaLoader/DynaLoader.a -L/usr/local/lib/perl5/5.8.8/mach/CORE -lperl -lm -lcrypt -lutil -DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.8/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include  -I/usr/local/lib/perl5/5.8.8/mach/CORE but i've also tried just using `perl -MExtUtils::Embed -e ccopts -e ldopts` directly in the Makefile rule and it didn't help.

So the way i see it, the only difference in the arguments is -Isrc -I.. -L../.. -lircbot which must be included in the arguments for my projects modules. How could this possibly cause PERL_NO_SHORT_NAMES to be ignored?! And how on earth is it defined in the example program even if i remove the preprocessing directives defining it and refuse to define it on the command line?

I even tried compiling and linking the example program with -lircbot like my projects module is, it didn't affect the fact that nm returned the symbol Perl_doing_taint still, even though i nowhere define PERL_NO_SHORT_NAMES anymore.

I must note that i can actually compile my example program module without the #define PERL_NO_SHORT_NAMES and when i check it's symbols with nm perl_test1.so | grep taint i see that it's not using short names, i see Perl_doing_taint. But when i check the symbols on my module i see doing_taint so i must assume that getting my module to respect PERL_NO_SHORT_NAMES will solve my problem because right now the program exits with this message:

/libexec/ld-elf.so.1: modules/peval.so: Undefined symbol "doing_taint"

Things like this just boggles my mind. Here is the Makefile i use along with the primary Makefile that defines ccopts and ldopts.

Makefile:
SHELL=/bin/sh CC=gcc LD=ld LDFLAGS+=-rpath . -L. CFLAGS+=-g -Wall -pedantic -ansi -DSETPROCTITLE -DPERL_NO_SHORT_NAMES LIBS+=-lircbot INCLUDES+=-Isrc -I.. HEADERS=bicebot.h ircbot.h PERL_OPTS= -Wl,-R/usr/local/lib/perl5/5.8.8/mach/CORE -Wl,-E -L/usr/ +local/lib /usr/local/lib/perl5/5.8.8/mach/auto/DynaLoader/DynaLoader. +a -L/usr/local/lib/perl5/5.8.8/mach/CORE -lperl -lm -lcrypt -lutil -D +APPLLIB_EXP="/usr/local/lib/perl5/5.8.8/BSDPAN" -DHAS_FPSETMASK -DHAS +_FLOATINGPOINT_H -fno-strict-aliasing -pipe -Wdeclaration-after-state +ment -I/usr/local/include -I/usr/local/lib/perl5/5.8.8/mach/CORE SRC=src SRC_MODS:=$(SRC)/mods # TODO: some sort of PREFIX to install elsewhere # also install target MODULES=modules export all: $(MAKE) -f $(SRC)/Makefile $(MAKE) -C $(SRC_MODS) @echo 'All done, now run bicebot.' modules: $(MAKE) -C $(SRC_MODS) # TODO: so you can rebuild only modules clean-modules: rm -f $(MODULES)/*.so $(SRC_MODS)/*.o clean: rm -f *.o bicebot *.so $(MODULES)/*.so $(SRC_MODS)/*.o
src/mods/Makefile
MODS_SRCS=$(wildcard *.c) MODS_OBJS=$(MODS_SRCS:%.c=%.o) MODS_TRGT=$(MODS_OBJS:%.o=%.so) LDFLAGS+=-L../.. all: $(MODS_TRGT) #gcc -Wall -fPIC -shared -o perl_test1.so perl_test1.c `perl -MExtUtil +s::Embed -e ccopts -e ldopts` $(MODS_TRGT): $(MODS_SRCS) $(CC) -Wall -Isrc -I.. -rpath . -L. -L../.. -fPIC -shared -o ../.. +/$(MODULES)/$@ $(@:%.so=%.c) `perl -MExtUtils::Embed -e ccopts -e ldo +pts` -lircbot -lc
I've been trying and testing tons of different methods in the last Makefile so excuse the mess but maybe you can figure out why it acts like this if i show you how i compile and link the module.

In reply to Re^2: Problem with dlopen and shared objects using perl libs by swehack
in thread Problem with dlopen and shared objects using perl libs by swehack

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.