Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 508192 - net-ftp/vsftpd-3.0.2-r2[pam] /lib/libpam.so.0: error adding symbols: File in wrong format
Summary: net-ftp/vsftpd-3.0.2-r2[pam] /lib/libpam.so.0: error adding symbols: File in ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Markos Chandras (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: no-symlink-lib
  Show dependency tree
 
Reported: 2014-04-19 21:30 UTC by Mike Gilbert
Modified: 2014-04-23 20:55 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Replace /lib/libpam.so.0 with -lpam (vsf_findlibs.patch,619 bytes, patch)
2014-04-19 21:32 UTC, Mike Gilbert
Details | Diff
Revised patch (vsf_findlibs.patch,615 bytes, patch)
2014-04-20 13:39 UTC, Mike Gilbert
Details | Diff
Revised patch II (vsf_findlibs.patch,514 bytes, patch)
2014-04-20 13:50 UTC, Mike Gilbert
Details | Diff
Override LIBS variable (vsftpd.patch,702 bytes, patch)
2014-04-20 15:15 UTC, Mike Gilbert
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Gilbert gentoo-dev 2014-04-19 21:30:31 UTC
x86_64-pc-linux-gnu-gcc -o vsftpd -Wl,-O1 -Wl,--as-needed -fPIE -pie -Wl,-z,relro -Wl,-z,now main.o utility.o prelogin.o ftpcmdio.o postlogin.o privsock.o tunables.o ftpdataio.o secbuf.o ls.o postprivparent.o logging.o str.o netstr.o sysstr.o strlist.o banner.o filestr.o parseconf.o secutil.o ascii.o oneprocess.o twoprocess.o privops.o standalone.o hash.o tcpwrap.o ipaddrparse.o access.o features.o readwrite.o opts.o ssl.o sslslave.o ptracesandbox.o ftppolicy.o sysutil.o sysdeputil.o seccompsandbox.o  -Wl,-O1 -Wl,--as-needed -fPIE -pie -Wl,-z,relro -Wl,-z,now `./vsf_findlibs.sh`
/lib/libpam.so.0: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
Makefile:29: recipe for target 'vsftpd' failed


This error occurs when using an amd64 profile with SYMLINK_LIB=no and LIBDIR_x86=lib.

The vsf_findlibs.sh script outputs "/lib/libpam.so.0", which is a 32-bit library.
Comment 1 Mike Gilbert gentoo-dev 2014-04-19 21:32:32 UTC
Created attachment 375330 [details, diff]
Replace /lib/libpam.so.0 with -lpam

This patch resolves the issue. However, this vsf_findlibs.sh script needs to die in a fire.

While you are at it, could you also add a call to epatch_user? This makes testing patches easier.
Comment 2 Markos Chandras (RETIRED) gentoo-dev 2014-04-20 10:24:28 UTC
(In reply to Mike Gilbert from comment #0)
> This error occurs when using an amd64 profile with SYMLINK_LIB=no and
> LIBDIR_x86=lib.
> 

Is this a supported configuration? What amd64 profile is this?
Comment 3 Markos Chandras (RETIRED) gentoo-dev 2014-04-20 10:26:25 UTC
(In reply to Mike Gilbert from comment #1)
> Created attachment 375330 [details, diff] [details, diff]
> Replace /lib/libpam.so.0 with -lpam
> 
> This patch resolves the issue. However, this vsf_findlibs.sh script needs to
> die in a fire.
> 

Is it safe to use both /usr/lib and /usr/lib64 in there? You assume that if the first one is not a symlink, then you need to use that one, otherwise it does not matter. What about /lib32 ? Again, I am not sure what's the layout in the profile you are using.

> While you are at it, could you also add a call to epatch_user? This makes
> testing patches easier.

Sure
Comment 4 Mike Gilbert gentoo-dev 2014-04-20 13:38:10 UTC
(In reply to Markos Chandras from comment #2)
> Is this a supported configuration? What amd64 profile is this?

Not really a profile yet, just my own config in make.conf.

See bug 506276; base-system is starting to think about making this the default configuration.

(In reply to Markos Chandras from comment #3)

> Is it safe to use both /usr/lib and /usr/lib64 in there?

Honestly, I'm just imitating the logic used by the rest of the script. The order of the directories is not really all that important, so long as a copy of libpam.so is located in one of them.

The important part of the patch is that it outputs "-lpam" instead of an absolute path. That lets the linker do the work of finding the correct library.

> Again, I am not sure what's the layout in the profile you are using.

64-bit libs in /lib64 and /usr/lib64, 32-bit libs in /lib and /usr/lib.
Comment 5 Mike Gilbert gentoo-dev 2014-04-20 13:39:19 UTC
Created attachment 375372 [details, diff]
Revised patch

The old patch looked for libpam.so.0, which is obviously wrong. Look for libpam.so instead.
Comment 6 Mike Gilbert gentoo-dev 2014-04-20 13:50:31 UTC
Created attachment 375374 [details, diff]
Revised patch II

Actually, we can just remove the one offending line
Comment 7 Mike Gilbert gentoo-dev 2014-04-20 15:15:51 UTC
Created attachment 375384 [details, diff]
Override LIBS variable

Another option to consider would be overriding the LIBS Makefile variable to avoid calling vsf_findlibs.sh at all. This is the approach that Fedora has taken.

http://pkgs.fedoraproject.org/cgit/vsftpd.git/tree/vsftpd-2.1.0-libs.patch

We could do something like this in the ebuild. See attached patch.
Comment 8 Johan Bergström 2014-04-21 02:59:05 UTC
I prefer avoiding running it at all.

Additionally, am I the only one getting warnings about redefining fortify_source?
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
opts.c:1:0: note: this is the location of the previous definition

Should we do something about it or does it qualify as nitpick?
Comment 9 Markos Chandras (RETIRED) gentoo-dev 2014-04-21 10:18:47 UTC
(In reply to Mike Gilbert from comment #7)
> Created attachment 375384 [details, diff] [details, diff]
> Override LIBS variable
> 
> Another option to consider would be overriding the LIBS Makefile variable to
> avoid calling vsf_findlibs.sh at all. This is the approach that Fedora has
> taken.
> 
> http://pkgs.fedoraproject.org/cgit/vsftpd.git/tree/vsftpd-2.1.0-libs.patch
> 
> We could do something like this in the ebuild. See attached patch.

Yeah I suppose a patch like this would be better.
Comment 10 Markos Chandras (RETIRED) gentoo-dev 2014-04-21 10:47:30 UTC
(In reply to Johan Bergström from comment #8)
> I prefer avoiding running it at all.
> 
> Additionally, am I the only one getting warnings about redefining
> fortify_source?
> <command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
> opts.c:1:0: note: this is the location of the previous definition
> 
> Should we do something about it or does it qualify as nitpick?

Probably because the build systems enables _FORTIFY_SOURCE and then we have the gentoo cflags that enable it too. No reason to fix this. It's just a warning.
Comment 11 Markos Chandras (RETIRED) gentoo-dev 2014-04-23 20:16:05 UTC
The fedora patch seems a bit incomplete. On my system i see this output when i run the script manually

_findlibs.sh 
-lwrap
-lnsl
-lnsl
/lib/libpam.so.0
-lpam
-lpam
-ldl
-lnsl
-lresolv
-lutil
-lssl -lcrypto

So i think your "Override LIBS variable" patch is what I will commit
Comment 12 Markos Chandras (RETIRED) gentoo-dev 2014-04-23 20:55:13 UTC
It should be fixed now in 3.0.2-r2. Thanks for the report and the patch

http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-ftp/vsftpd/vsftpd-3.0.2-r2.ebuild?r1=1.1&r2=1.2