Linking problems

2 views
Skip to first unread message

Gustavo

unread,
Mar 11, 2010, 7:36:05 AM3/11/10
to autopackage
Hey,

I am experiencing a behavior that I don't know if it is a bug. I will
write the facts in items, much like steps to reproduce the problem:

1) I am using Ubuntu 9.10.
2) I have downloaded through synaptic the stlport implementation.
3) I had problems with it, so I downloaded the stlport source code and
build it myself.
4) I am using apgc++ to link, passing the option -L../lib (the
directory of libstlport.so that I built)
5) apg++ will ignore the -L option and will link my binary with the
lib stlport in /usr/lib.

I tried to trace the bug and I went as far as discovering that
searchLib (which I don't know where/how it is defined) is returning
the wrong lib.

my $lib = searchLib("lib$libname.so", \@searchPaths);

Printing the value of @searchPaths I can see ../lib, but I don't know
why it is preferring /usr/lib over ../lib. I tried to use the full
path to my libs directory, but the problem is the same.

Is this the normal behavior?

I would also like to thanks the autopackage team and community, for
your excellent work. We have been using autopackage for at least 3
years (I don't know if you guys will remember me, I have translated
some of autopackage docs for portuguese).


Eugene Zolenko

unread,
Mar 11, 2010, 6:35:20 PM3/11/10
to autopackage
If you export APBUILD_DEBUG=1 before running apg++ it will print the
exact g++ cmd line it is using. Then you can see if it breaks
something or if the problem is on your machine.

Also, run apg++ --help, it will print other interesting variables.
(APBUILD_RESOLVE_LIBPATH might be useful for you).

Jan Niklas Hasse

unread,
Mar 12, 2010, 11:14:47 AM3/12/10
to autop...@googlegroups.com
On Thu, Mar 11, 2010 at 1:36 PM, Gustavo <gustavo.s...@gmail.com> wrote:
> I tried to trace the bug and I went as far as discovering that
> searchLib (which I don't know where/how it is defined) is returning
> the wrong lib.
>
> my $lib = searchLib("lib$libname.so", \@searchPaths);
>
> Printing the value of @searchPaths I can see ../lib, but I don't know
> why it is preferring /usr/lib over ../lib. I tried to use the full
> path to my libs directory, but the problem is the same.
>
> Is this the normal behavior?

No I think something is wrong there. searchLib is defined in Utils.pm
and looks like this:

sub searchLib {
my ($basename, $extra_paths) = @_;

if ($extra_paths) {
foreach my $path (reverse(@{$extra_paths})) {
return "$path/$basename" if (-f "$path/$basename");
}
}
foreach my $path ('/usr/local/lib', '/lib', '/usr/lib') {
return "$path/$basename" if (-f "$path/$basename");
}
return undef;
}

It already looks in the extra_path first, so it should work. But
somehow it doesn't. Hm ... I don't know enough about Perl so I'm no
help here, sorry.

Gustavo Serra

unread,
Mar 15, 2010, 8:33:31 AM3/15/10
to autop...@googlegroups.com
Using APBUILD_DEBUG=1 becomes clear that apgcc is changing the command
line options. I passed -lstlport to apgcc and it changes to
-lstlport_gcc. When I remove Ubuntu's stlport, the problem disappears.

2010/3/11 Eugene Zolenko <zole...@gmail.com>:

--
Serra

Reply all
Reply to author
Forward
0 new messages