You are not logged in.

#1 2021-04-19 07:32:56

Toideng
Member
Registered: 2021-04-19
Posts: 3

[SOLVED] Can't reproduce installed file with a pkgconfig file

I'm having trouble compiling libargon2 from source

If i'm running a usual make -> make test routine, or if i build a pkgconfig file from https://github.com/archlinux/svntogit-p … k/PKGBUILD , i get a libargon2.so.1 with a following output of `file`:

$ file src/phc-winner-argon2-20190702/libargon2.so.1
src/phc-winner-argon2-20190702/libargon2.so.1: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=f67ac7ba189b1d4252c7d93f05000ffd54b0fea1, with debug_info, not stripped

But this is what i get for the installed-from-repo file:

$ file /usr/lib/libargon2.so.1 
/usr/lib/libargon2.so.1: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0614a9b6263447832d30020ba63ca1a713858411, stripped

So the difference is the "with debug_info, not stripped" vs. "stripped" part

It seems like this is why i am able to build a different project against the pre-installed version of a library, but not so with a built-from-source one: some symbols collide with a not stripped version of a library and the linker fails.

So i got curious, why is the installed library stripped? When does this happen, if the pkginfo file produces the not stripped version?

Last edited by Toideng (2021-04-20 18:55:49)

Offline

#2 2021-04-19 11:50:57

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,350

Re: [SOLVED] Can't reproduce installed file with a pkgconfig file

PKGBUILDs are processed by makepkg[1] which takes its options from makepkg.conf .

It is possible to override these options inside a PKGBUILD through the options= array[2]

man PKGBUILD has details about the options.

disabling stripping is easy , but that's not the same as building with debug info .
Check [3] for detailed info about creating debug packages.

[1] https://wiki.archlinux.org/index.php/Makepkg
[2] https://wiki.archlinux.org/index.php/PKGBUILD#options
[3] https://wiki.archlinux.org/index.php/De … ing_Traces

Welcome to archlinux forums.

P.S. .PKGINFO and *.pc (pkgconfig) files have specific uses and have little in common with PKGBUILD files.

Last edited by Lone_Wolf (2021-04-19 11:51:09)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2021-04-19 14:01:53

Toideng
Member
Registered: 2021-04-19
Posts: 3

Re: [SOLVED] Can't reproduce installed file with a pkgconfig file

Lone_Wolf wrote:

It is possible to override these options inside a PKGBUILD through the options= array[2]

The thing that got me confused is that in the pkgbuild file the building / installation is basically the same as in the manual scenario, with no stripping. I still can't really see how changing options there would affect this build process?..

...
build() {
  cd "$srcdir/phc-winner-$pkgname-$pkgver"

  make OPTTARGET='none' LIBRARY_REL='lib'
}

check() {
  cd "$srcdir/phc-winner-$pkgname-$pkgver"

  make OPTTARGET='none' LIBRARY_REL='lib' test
}

package() {
  cd "$srcdir/phc-winner-$pkgname-$pkgver"

  make OPTTARGET='none' LIBRARY_REL='lib' DESTDIR="$pkgdir" install

  install -D -m0644 LICENSE "${pkgdir}/usr/share/licenses/argon2/LICENSE"
}

Offline

#4 2021-04-20 09:36:50

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,350

Re: [SOLVED] Can't reproduce installed file with a pkgconfig file

TL;DR makepkg build environment differs A LOT from user environment

PKGBUILDs are run by makepkg in a special environment while applying customized settings for building .
Check /etc/makepkg.conf for the systemwide settings it uses .

example of some default settings in /etc/makepkg.conf as installed by pacman 5.2.2-2 :

#########################################################################
# GLOBAL PACKAGE OPTIONS
#   These are default values for the options=() settings
#########################################################################
#
# Default: OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug)
#  A negated option will do the opposite of the comments below.
#
#-- strip:      Strip symbols from binaries/libraries
#-- docs:       Save doc directories specified by DOC_DIRS
#-- libtool:    Leave libtool (.la) files in packages
#-- staticlibs: Leave static library (.a) files in packages
#-- emptydirs:  Leave empty directories in packages
#-- zipman:     Compress manual (man and info) pages in MAN_DIRS with gzip
#-- purge:      Remove files specified by PURGE_TARGETS
#-- debug:      Add debugging flags as specified in DEBUG_* variables
#
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug)

Your manual scenarion doesn't use those options, but makepkg applies them always during building .
So by default all binaries in packages produced by makepkg are stripped and don't include debug symbols .

run makepkg --log and compare the logs (especially those of the build() and package() functions ) with the output of your manual actions.

Last edited by Lone_Wolf (2021-04-20 09:38:13)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2021-04-20 10:46:29

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,097

Re: [SOLVED] Can't reproduce installed file with a pkgconfig file


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#6 2021-04-20 18:55:17

Toideng
Member
Registered: 2021-04-19
Posts: 3

Re: [SOLVED] Can't reproduce installed file with a pkgconfig file

Thank you, i now see where the symbols went --- the linked PKBBUILD's package() wasn't all that happened on packaging stage, there was something more to be done on a higher level.

Marking thread as solved.

Last edited by Toideng (2021-04-20 18:58:03)

Offline

Board footer

Powered by FluxBB