Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

ERROR: sys-libs/pam-1.7.2::gentoo failed (compile phase):

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
13 posts • Page 1 of 1
Author
Message
northfrisia
Tux's lil' helper
Tux's lil' helper
Posts: 83
Joined: Mon Feb 01, 2021 4:55 am

ERROR: sys-libs/pam-1.7.2::gentoo failed (compile phase):

  • Quote

Post by northfrisia » Sat Mar 21, 2026 5:36 am

Hi,

sys-libs/pam-1.7.2. failed to compile.

Here are the logs:
The emerge info -> https://bpa.st/2R4BW
The output of emerge -pqv -> https://bpa.st/HJFGG
The build log -> https://bpa.st/CQ5T6
The environment -> (wget paste failed here "400 Bad request" ???)
Will see whether I will be able to add this file later...

My Gentoo is updated daily, I am running multilib.
This error is an older one, since I hoped that is would be a temporary...
...which is not unfortunately.

How can I fix this?

Cheers!
NorthFrisia
Top
netfab
Advocate
Advocate
Posts: 2066
Joined: Thu Mar 03, 2005 1:27 pm
Location: 127.0.0.1

  • Quote

Post by netfab » Sat Mar 21, 2026 6:59 am

Hi,

Same as https://forums.gentoo.org/viewtopic-t-1176001.html

Code: Select all

[...]x86_64-pc-linux-gnu/bin/ld: /usr/lib/libcrypt.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status 
No solution but it seems you are not alone in this case.
Top
netfab
Advocate
Advocate
Posts: 2066
Joined: Thu Mar 03, 2005 1:27 pm
Location: 127.0.0.1

  • Quote

Post by netfab » Sat Mar 21, 2026 10:45 am

Can you please post the outputs of following commands :

Code: Select all

$ ls -l /usr/lib*/libcrypt.so*

Code: Select all

$ pkgconf --path libcrypt

Code: Select all

$ qfile /usr/lib*/pkgconfig/libcrypt.pc

Code: Select all

$ qfile /usr/lib*/libcrypt.so*
The qfile utility is from app-portage/portage-utils.

Your emerge --info and build.log shows that portage is building the package only for 64-bit.
But, on this command :
[122/525] x86_64-pc-linux-gnu-gcc -o modules/pam_pwhistory/pam_pwhistory.so modules/pam_pwhistory/pam_pwhistory.so.p/pam_pwhistory.c.o modules/pam_pwhistory/pam_pwhistory.so.p/opasswd.c.o modules/pam_pwhistory/pam_pwhistory.so.p/pwhistory_config.c.o -Wl,--as-needed -Wl,--allow-shlib-undefined -shared -fPIC -Wl,--fatal-warnings -Wl,--no-undefined-version -Wl,-O1 -O2 -pipe -march=znver2 -mtune=znver2 -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,--undefined-version '-Wl,-rpath,$ORIGIN/../../libpam' -Wl,--start-group libpam_internal/libpam_internal.a libpam/libpam.so.0.85.1 -Wl,--version-script=/var/tmp/portage/sys-libs/pam-1.7.2/work/Linux-PAM-1.7.2/modules/pam_pwhistory/module.map /usr/lib/libcrypt.so -Wl,--end-group
[...]
/usr/x86_64-pc-linux-gnu/binutils-bin/2.46.0/ld: /usr/lib/libcrypt.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
/usr/lib/libcrypt.so is a 32bit path.
Maybe this file (and others) is an orphan file on your filesystem.
Top
grknight
Retired Dev
Retired Dev
Posts: 2549
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Sat Mar 21, 2026 1:02 pm

The source of the issue is this:

Code: Select all

    build.pkg_config_path: /usr/lib/pkgconfig:/usr/share/pkgconfig
    pkg_config_path      : /usr/lib/pkgconfig:/usr/share/pkgconfig
Those paths should be /usr/lib64 and not /usr/lib.

How are you running emerge? from a root prompt? Feels a lot like environment bleed or some other way of overriding pkgconfig path.
Top
grknight
Retired Dev
Retired Dev
Posts: 2549
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Sat Mar 21, 2026 9:29 pm

To be clear, this is what I get for the configure stage of sys-libs/pam-1.7.2 for those variables:

Code: Select all

    build.pkg_config_path: /usr/share/pkgconfig
    pkg_config_path      : /usr/share/pkgconfig
The meson code in an ebuild looks for PKG_CONFIG_LIBDIR or BUILD_PKG_CONFIG_LIBDIR to be set in the environment.
This is normally supplied by other eclasses.

I believe this is a case where emerge --info --verbose may be of some help
Top
northfrisia
Tux's lil' helper
Tux's lil' helper
Posts: 83
Joined: Mon Feb 01, 2021 4:55 am

  • Quote

Post by northfrisia » Sun Mar 22, 2026 5:02 am

netfab wrote:Can you please post the outputs of following commands :

Code: Select all

$ ls -l /usr/lib*/libcrypt.so*

Code: Select all

$ pkgconf --path libcrypt

Code: Select all

$ qfile /usr/lib*/pkgconfig/libcrypt.pc

Code: Select all

$ qfile /usr/lib*/libcrypt.so*
The qfile utility is from app-portage/portage-utils.

Your emerge --info and build.log shows that portage is building the package only for 64-bit.
But, on this command :
[122/525] x86_64-pc-linux-gnu-gcc -o modules/pam_pwhistory/pam_pwhistory.so modules/pam_pwhistory/pam_pwhistory.so.p/pam_pwhistory.c.o modules/pam_pwhistory/pam_pwhistory.so.p/opasswd.c.o modules/pam_pwhistory/pam_pwhistory.so.p/pwhistory_config.c.o -Wl,--as-needed -Wl,--allow-shlib-undefined -shared -fPIC -Wl,--fatal-warnings -Wl,--no-undefined-version -Wl,-O1 -O2 -pipe -march=znver2 -mtune=znver2 -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,--undefined-version '-Wl,-rpath,$ORIGIN/../../libpam' -Wl,--start-group libpam_internal/libpam_internal.a libpam/libpam.so.0.85.1 -Wl,--version-script=/var/tmp/portage/sys-libs/pam-1.7.2/work/Linux-PAM-1.7.2/modules/pam_pwhistory/module.map /usr/lib/libcrypt.so -Wl,--end-group
[...]
/usr/x86_64-pc-linux-gnu/binutils-bin/2.46.0/ld: /usr/lib/libcrypt.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
/usr/lib/libcrypt.so is a 32bit path.
Maybe this file (and others) is an orphan file on your filesystem.

I am multilib (32/64 bit) by the way (see initial post)

Code: Select all

$ ls -l /usr/lib*/libcrypt.so*

Code: Select all

lrwxrwxrwx 1 root root     17 2025-11-10 17:42 /usr/lib/libcrypt.so -> libcrypt.so.2.0.0
lrwxrwxrwx 1 root root     17 2025-11-10 17:42 /usr/lib/libcrypt.so.1 -> libcrypt.so.1.1.0
-rwxr-xr-x 1 root root 214320 2025-11-10 17:42 /usr/lib/libcrypt.so.1.1.0
lrwxrwxrwx 1 root root     17 2025-11-10 17:42 /usr/lib/libcrypt.so.2 -> libcrypt.so.2.0.0
-rwxr-xr-x 1 root root 214320 2025-11-10 17:42 /usr/lib/libcrypt.so.2.0.0
lrwxrwxrwx 1 root root     17 2025-11-10 17:42 /usr/lib64/libcrypt.so -> libcrypt.so.2.0.0
lrwxrwxrwx 1 root root     17 2025-11-10 17:42 /usr/lib64/libcrypt.so.1 -> libcrypt.so.1.1.0
-rwxr-xr-x 1 root root 206712 2025-11-10 17:42 /usr/lib64/libcrypt.so.1.1.0
lrwxrwxrwx 1 root root     17 2025-11-10 17:42 /usr/lib64/libcrypt.so.2 -> libcrypt.so.2.0.0
-rwxr-xr-x 1 root root 202616 2025-11-10 17:42 /usr/lib64/libcrypt.so.2.0.0

Code: Select all

pkgconf --path libcrypt 

Code: Select all

/usr/lib/pkgconfig/libcrypt.pc

Code: Select all

qfile /usr/lib*/pkgconfig/libcrypt.pc 

Code: Select all

sys-libs/libxcrypt: /usr/lib/pkgconfig/libcrypt.pc
sys-libs/libxcrypt: /usr/lib64/pkgconfig/libcrypt.pc

Code: Select all

qfile /usr/lib*/libcrypt.so* 

Code: Select all

sys-libs/libxcrypt: /usr/lib/libcrypt.so.2
sys-libs/libxcrypt: /usr/lib/libcrypt.so.2.0.0
sys-libs/libxcrypt: /usr/lib/libcrypt.so
sys-libs/libxcrypt: /usr/lib/libcrypt.so.1
sys-libs/libxcrypt: /usr/lib/libcrypt.so.1.1.0
sys-libs/libxcrypt: /usr/lib64/libcrypt.so.2
sys-libs/libxcrypt: /usr/lib64/libcrypt.so.2.0.0
sys-libs/libxcrypt: /usr/lib64/libcrypt.so
sys-libs/libxcrypt: /usr/lib64/libcrypt.so.1
sys-libs/libxcrypt: /usr/lib64/libcrypt.so.1.1.0

Code: Select all

How are you running emerge? from a root prompt? 
Yes

Code: Select all

emerge --info --verbose 
https://bpa.st/EFRQ


By the way
sys-apps/systemd-utils-259.3:0/0::gentoo
now fails at the same ninja-step seemingly (looking at the error after compilation failed...
no deeper analysis, though)
Top
netfab
Advocate
Advocate
Posts: 2066
Joined: Thu Mar 03, 2005 1:27 pm
Location: 127.0.0.1

  • Quote

Post by netfab » Sun Mar 22, 2026 8:30 am

Please post the outputs of :

Code: Select all

$ ls -l /usr/lib*/pkgconfig/libcrypt.pc

Code: Select all

$ emerge -pv sys-libs/libxcrypt
Can you try to reinstall sys-libs/libxcrypt to see if it makes any difference :

Code: Select all

# emerge -av1 sys-libs/libxcrypt
Top
northfrisia
Tux's lil' helper
Tux's lil' helper
Posts: 83
Joined: Mon Feb 01, 2021 4:55 am

  • Quote

Post by northfrisia » Sun Mar 22, 2026 11:25 am

netfab wrote:Please post the outputs of :

Code: Select all

$ ls -l /usr/lib*/pkgconfig/libcrypt.pc

Code: Select all

$ emerge -pv sys-libs/libxcrypt
Can you try to reinstall sys-libs/libxcrypt to see if it makes any difference :

Code: Select all

# emerge -av1 sys-libs/libxcrypt
First I reinstalled sys-libs/libxcrypt

the compilation of libxcrypt was painless, the following compilation of pam failed.

Here are the outputs of the mentioned commands:

Code: Select all

#> ls -l /usr/lib*/pkgconfig/libcrypt.pc
lrwxrwxrwx 1 root root 12 2026-03-22 11:29 /usr/lib/pkgconfig/libcrypt.pc -> libxcrypt.pc
lrwxrwxrwx 1 root root 12 2026-03-22 11:29 /usr/lib64/pkgconfig/libcrypt.pc -> libxcrypt.pc

Code: Select all

#> emerge -pv sys-libs/libxcrypt
These are the packages that would be merged, in order:

Calculating dependencies  ... done!
Dependency resolution took 2.90 s (backtrack: 0/20).

[ebuild   R    ] sys-libs/libxcrypt-4.4.38:0/1::gentoo  USE="(compat) (system) (-headers-only) -static-libs -test" ABI_X86="32 (64) (-x32)" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB
Top
netfab
Advocate
Advocate
Posts: 2066
Joined: Thu Mar 03, 2005 1:27 pm
Location: 127.0.0.1

  • Quote

Post by netfab » Sun Mar 22, 2026 12:29 pm

Please post outputs of :

Code: Select all

# pkg-config --variable pc_path pkg-config

Code: Select all

$ env | grep PATH
Top
grknight
Retired Dev
Retired Dev
Posts: 2549
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Sun Mar 22, 2026 12:58 pm

northfrisia wrote:

Code: Select all

PKG_CONFIG_PATH="/usr/lib/pkgconfig"
This should not be set anywhere and is causing you problems. Find out where it coming from and remove it. Often an environment file somewhere in /etc or a shell configuration.

If found in /etc/env.d, then don't forget to execute env-update ; source /etc/profile. A new login or reboot may be required to apply the environment change beyond that.
Top
northfrisia
Tux's lil' helper
Tux's lil' helper
Posts: 83
Joined: Mon Feb 01, 2021 4:55 am

  • Quote

Post by northfrisia » Sun Mar 22, 2026 4:02 pm

grknight wrote:
northfrisia wrote:

Code: Select all

PKG_CONFIG_PATH="/usr/lib/pkgconfig"
This should not be set anywhere and is causing you problems. Find out where it coming from and remove it. Often an environment file somewhere in /etc or a shell configuration.

If found in /etc/env.d, then don't forget to execute env-update ; source /etc/profile. A new login or reboot may be required to apply the environment change beyond that.
That fixed it! Oh YEAH! Thanks a lot too all, which contributed and helped to pin point this...

ATTENTION! For all reading this...
After pam is recompiled successfully you need to recompile your login manager (sddm in my case)
BEFORE you logout or reboot otherwise you are locked out.

PKG_CONFIG_PATH is set bei nvidia and vpl via scripts copied to /etc.
In my case I found a leftover in my .zshrc, which seemed to be the culprit here.

May be "This should not be set anywhere " is a little too broad...? (guessing, since official sources set it in scripts below /etc/. ...)
Top
Hu
Administrator
Administrator
Posts: 24380
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Sun Mar 22, 2026 4:11 pm

PKG_CONFIG_PATH must be set only to paths which contain pkg-config files that are correct for the build being run. In the general case of running emerge on arbitrary packages, it seems dangerous to have it set because of the variety of packages that might consume it. Exactly what official sources are setting it, where are they writing it, and to what value are they setting it?
Top
northfrisia
Tux's lil' helper
Tux's lil' helper
Posts: 83
Joined: Mon Feb 01, 2021 4:55 am

  • Quote

Post by northfrisia » Mon Mar 23, 2026 5:23 pm

I found the following place, where PKG_CONFIG_PTH gets set:

Code: Select all

/etc>grep -r PKG_CONFIG_PATH
env.d/99cuda879098:PKG_CONFIG_PATH=/opt/cuda/pkgconfig
environment.d/10-gentoo-env.conf:PKG_CONFIG_PATH=/opt/cuda/pkgconfig
csh.env:setenv PKG_CONFIG_PATH '/opt/cuda/pkgconfig'
profile.env:export PKG_CONFIG_PATH='/opt/cuda/pkgconfig'
vpl/vars.sh:PKG_CONFIG_PATH=$(prepend_path "$vpl_pkgconfig" "${PKG_CONFIG_PATH:-}")
vpl/vars.sh:export PKG_CONFIG_PATH
I could identify some of the packages:

Code: Select all

dev-util/nvidia-cuda-toolkit
env-update
???
???
media-libs/libvpl
Top
Post Reply

13 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy