Does anyone know how do use the options
array in a PKGBUILD to add makeflags? I’ve seen it mentioned in a couple of places but not how to go about doing it or what the syntax would be. Basically, I just want to add the -no-pie
flag. Currently, I’m achieving this by using sed
to insert the flag into the Makefile
, but that feels clunky.
Looking at makepkg - ArchWiki and following it to makepkg.conf(5) — Arch manual pages where the options array is documented, made me come to the conclusion that it is only an array with keywords that automate certain settings.
So you would need to (IMHO) modify the Makefile with a patch if you want to change the flags used…
(Or use sed
like you already mentioned.)
Thanks. Those were the only two bits of info I found on the topic. So each of the options are just simple ‘off’/‘on’ switches?
Look like it to me also…
Disclamer: I have not taken any time yet to fiddle with PKGBUILD’s myself yet in any way.
Do you otherwise have control of the Makefile
? Is it your project?
No, unfortunately not.
What do you mean by this? Are you talking about compile flags?
I’m not sure on the nomenclature. My C++ ability is pretty much non-existent. One of the Makefiles is this one:
CCXXFLAGS=-Dint_lnx -O
CXX=g++
SHELL=/bin/sh
LDLIB=-lz
LDLIN=-linterp.1
CXXFLAGS=$(CCXXFLAGS)
ukbfetch : ukbfetch.o libufetch.a
$(CXX) -o ukbfetch $< -L. -lufetch -lz
clean:
rm *.o
Basically, I’m using sed
to insert -no-pie
after the $(CXX)
. Otherwise it doesn’t compile and throws the following errors:
g++ -o ukbfetch ukbfetch.o -L. -lufetch -lz
/usr/bin/ld: ./libufetch.a(ufetch.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(reposit.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(ftarget.o): relocation R_X86_64_32S against symbol `_ZNSs4_Rep20_S_empty_rep_storageE@@GLIBCXX_3.4' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(webfetch.o): relocation R_X86_64_32S against symbol `_ZTV9WEB_FETCH' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(bulcom.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(fetutil.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(xaes.o): relocation R_X86_64_32S against symbol `_ZTV4XAES' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(xtime.o): relocation R_X86_64_32S against symbol `_ZTV5XDATE' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(xerror.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(xencode.o): relocation R_X86_64_32 against symbol `_ZN7XENCODE10last_errorE' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(xbinob.o): relocation R_X86_64_32S against symbol `_ZTV6XBINOB' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(rosetta.o): relocation R_X86_64_32S against symbol `_ZTV7ROSETTA' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(authkey.o): relocation R_X86_64_32S against symbol `_ZTV8AUTH_KEY' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(xmd5.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(aeskey.o): relocation R_X86_64_32S against symbol `t_fl' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(aescrypt.o): relocation R_X86_64_32S against symbol `t_fn' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(comcrypt.o): relocation R_X86_64_32S against symbol `_ZTV8COMCRYPT' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(kipper.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(rosebase.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(aestab.o): relocation R_X86_64_32 against `.text' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ./libufetch.a(rosebase.o): warning: relocation against `_ZNSsC1ERKSs@@GLIBCXX_3.4' in read-only section `.text'
collect2: error: ld returned 1 exit status
make: *** [Makefile:9: ukbfetch] Error 1
Not sure whether there’s a better way of doing this or not. I only came up with this as a workaround from internet searches. It was the first thing I found that worked.
As I said, my C++ knowledge is non-existent. To me, “pie” is just a tasty meal, and no pie sounds depressing.
One way you could possibly try is to add ‘no-pie’ to your CXXFLAGS array in /etc/makepkg.conf.
Other than that, I’m pretty cluless here.
Thanks for the suggestion. Just tried it. Unfortunately, it doesn’t work… same error.
Make a detailed report on the packages’ AUR page. Maybe the maintainer might have some insight.
I’m the maintainer. I just uploaded the PKGBUILD today:
https://aur.archlinux.org/packages/ukbprep-bin/
I sent an email upstream to the developers earlier on today, but I’ve not heard back yet.
You should append it on the same line (at the end) of CCXXFLAGS=-Dint_lnx -O
IMHO…
(But that’s my personal preference i guess)
This might help him also on top of those 2…
https://wiki.archlinux.org/index.php/CMake_package_guidelines
I tried that, but it didn’t work. I’m not sure if it’s because $CXXFLAGS
is missing from line 9.
Ohhh wait…my bad sorry…
I thought you were putting it after the CXXFLAGS=$(CCXXFLAGS)
line…
Nevermind what i said then…
It’s indeed strange that they don’t use that variable on that line…
To anyone interested, the complete source for the prior Makefile
example can be found at:
https://biobank.ndph.ox.ac.uk/showcase/showcase/util/ukbfetch_linkset.tar
Accompanying ‘build’ info at: