You are not logged in.

#1 2016-02-24 04:00:34

opencode
Member
Registered: 2016-02-24
Posts: 5

Compiling under makepkg produces different results

I'm trying to understand the differences in the makepkg environment that would be causing compilation to fail when it succeeds when done manually.

I'm updated to the latest bits as of today on x86_64 and compiling freeswitch 1.6.6. (FWIW, I'm using my own PKGBUILD instead of the AUR one for two reasons: first, to learn; and second, I'm ultimately porting this to Arch Linux ARM on a Raspberry Pi Zero and want to simplify/slim things down a bit).

The steps I'm following should be equivalent to:

curl -O https://files.freeswitch.org/releases/freeswitch/freeswitch-1.6.6.tar.xz
tar -xvf freeswitch-1.6.6.tar.xz
cd freeswitch-1.6.6
./configure --disable-debug
make

These steps work when I'm doing them manually, but when I do the equivalent through a PKGBUILD, I'm getting a compilation error (lightly sanitized):

  CC     freeswitch-switch.o
src/switch.c: In function ‘main’:
src/switch.c:1194:5: error: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Werror=unused-result]
     (void)read(fds[1], &v, sizeof(v));
     ^
src/switch.c: In function ‘check_fd’:
src/switch.c:236:5: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
     (void)write(fd, &r, sizeof(r));
     ^
cc1: all warnings being treated as errors
Makefile:1988: recipe for target 'freeswitch-switch.o' failed
make[2]: *** [freeswitch-switch.o] Error 1
make[2]: Leaving directory '~/builds/freeswitch/src/freeswitch-1.6.6'
Makefile:2420: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '~/builds/freeswitch/src/freeswitch-1.6.6'
Makefile:970: recipe for target 'all' failed
make: *** [all] Error 2

I suspect there's something about the makepkg environment variables that's causing somehow triggering extra warnings as errors or something like that, but I'm not sure where to investigate further. I believe I'm using the normal makepkg.conf settings; I've included the non-commented lines below just in case:

DLAGENTS=('ftp::/usr/bin/curl -fC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
          'http::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
          'https::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
          'rsync::/usr/bin/rsync --no-motd -z %u %o'
          'scp::/usr/bin/scp -C %u %o')
VCSCLIENTS=('bzr::bzr'
            'git::git'
            'hg::mercurial'
            'svn::subversion')
CARCH="x86_64"
CHOST="x86_64-unknown-linux-gnu"
CPPFLAGS="-D_FORTIFY_SOURCE=2"
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong"
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
DEBUG_CFLAGS="-g -fvar-tracking-assignments"
DEBUG_CXXFLAGS="-g -fvar-tracking-assignments"
BUILDENV=(!distcc color !ccache check !sign)
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !optipng !upx !debug)
INTEGRITY_CHECK=(md5)
STRIP_BINARIES="--strip-all"
STRIP_SHARED="--strip-unneeded"
STRIP_STATIC="--strip-debug"
MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
COMPRESSGZ=(gzip -c -f -n)
COMPRESSBZ2=(bzip2 -c -f)
COMPRESSXZ=(xz -c -z -)
COMPRESSLRZ=(lrzip -q)
COMPRESSLZO=(lzop -q)
COMPRESSZ=(compress -c -f)
PKGEXT='.pkg.tar.xz'
SRCEXT='.src.tar.gz'

None of these settings, particularly the *FLAGS ones, look particularly suspicious to me, but I'm a newbie so I may be missing something obvious.

I'm currently applying a custom patch to the freeswitch code to get it to work. Ultimately, I'd like to provide upstream with a good bug report/repro with a proposed patch, but currently all I can say is that it fails when used within Arch Linux's makepkg (and upstream develops on Debian, not Arch Linux, so I suspect that isn't an ideal bug report for them).

Any pointers on how I might get this problem to reproduce outside of the makepkg environment so I can provide a good, portable bug report?

I can also provide the full PKGBUILD I'm using if that's helpful, but the --disable-debug part is the key that causes compilation to fail inside makepkg (but not when executing the same commands from the shell).

Thanks,

David

Offline

#2 2016-02-24 04:25:57

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,539

Re: Compiling under makepkg produces different results

It's a good thing you're using your own, the PKGBUILD in the AUR is pretty bad.

Try adding options=(!buildflags) to your PKGBUILD, that will clear the env variables in question. If that works, you can do it more selectively to help narrow it down.

Edit: typo option -> options

Last edited by Scimmia (2016-02-24 04:28:10)

Online

#3 2016-02-24 06:19:31

opencode
Member
Registered: 2016-02-24
Posts: 5

Re: Compiling under makepkg produces different results

Thanks, Scimmia.

Great suggestion. I don't get the make error when I use options=(!buildflags), so now it's just a matter of narrowing it down like you suggested. Do you know if buildflags controls only the settings mentioned in the man page: CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS
or does it also include the other settings in makepkg.conf (for example, DEBUG_CFLAGS and CARCH)?

Thanks,

David

Offline

#4 2016-02-24 06:36:33

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Compiling under makepkg produces different results

CARCH is a bit unavoidable. wink

DEBUG_C(XX)FLAGS are appended to C(XX)FLAGS if and only if the "debug" option is active. Either way, "!buildflags" will unset exactly what it says it will.

Last edited by eschwartz (2016-02-24 06:41:54)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#5 2016-02-25 06:32:55

opencode
Member
Registered: 2016-02-24
Posts: 5

Re: Compiling under makepkg produces different results

I narrowed it down to this setting:

CPPFLAGS=-D_FORTIFY_SOURCE=2

Thanks for the help!

Offline

Board footer

Powered by FluxBB