Compile with -fpie/pie ?

My first attempt at using the OBS is trying to get it to prepare a netatalk 2.1.5 package which builds successfully on my OS 11.3 box. It looks like it compiles successfully, but the install section fails.

It appears to be a problem with the “brp-pie” script, which prints the following:

/var/tmp/netatalk-2.1.5-build//usr/bin/achfile is not compiled with -fpie/linked with -pie!
/var/tmp/netatalk-2.1.5-build//usr/bin/adv1tov2 is not compiled with -fpie/linked with -pie
... <repeats for every executable in package>
/var/tmp/netatalk-2.1.5-build//usr/sbin/papd is not compiled with -fpie/linked with -pie!

Please adjust your package and compile the above programs with -fpie/-pie

error: Bad exit status from /var/tmp/rpm-tmp.70756 (%install)

RPM errors:
    cannot open Pubkeys index using db3 - No such file or directory (2)
    Bad exit status from /var/tmp/rpm-tmp.70756 (%install)

Adding these compiler/linker flags (LDFLAGS="-lpthread -pie" CFLAGS="$RPM_OPT_FLAGS -Wall -g -fpie") didn’t help. Can anyone tell me what I’m doing wrong here?

It is not linked with -pie

gcc -std=gnu99 -I../../include "-D_U_=__attribute__((unused))" -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -Wall -g -fpie -I../../sys -o achfile achfile.o common.o  -L/usr/src/packages/BUILD/netatalk-2.1.5/libatalk

I don’t know the details of PIE code, but I don’t think it’s a good idea to mix -fPIE and -fPIC as in

gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I../../include "-D_U_=__attribute__((unused))" -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -Wall -g -fpie -I../../sys -MT uams_gss_la-uams_gss.lo -MD -MP -MF .deps/uams_gss_la-uams_gss.Tpo -c uams_gss.c  -fPIC -DPIC -o .libs/uams_gss_la-uams_gss.o

Did you manage to fix this issue? I’m stuck with the same issue trying to build bind9.9, any tips would be appreciated.

Hi
Have you looked over the openSUSE spec file for the rpm?
https://build.opensuse.org/package/view_file?file=bind.spec&package=bind&project=openSUSE%3AFactory&rev=06039f5aa40d2e79f77e87887f822943


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.1 (x86_64) Kernel 3.1.0-1.2-desktop
up 1 day 15:30, 5 users, load average: 0.08, 0.10, 0.07
CPU Intel i5 CPU M520@2.40GHz | Intel Arrandale GPU