#880198 libntru: FTBFS on x32: position-dependent relocation in sha1-mb-x86_64.o

#880198#5
Date:
2017-10-30 14:39:15 UTC
From:
To:
The build of libntru for x32 (admittedly not a release architecture)
failed:

  CC=cc ASM="cc -c" /usr/bin/perl src/sha1-mb-x86_64.pl elf > src/sha1-mb-x86_64.s
  cc -c src/sha1-mb-x86_64.s -o src/sha1-mb-x86_64.o
  CC=cc ASM="cc -c" /usr/bin/perl src/sha256-mb-x86_64.pl elf > src/sha256-mb-x86_64.s
  cc -c src/sha256-mb-x86_64.s -o src/sha256-mb-x86_64.o
  cc -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -DNTRU_AVOID_HAMMING_WT_PATENT -Wall -Wextra -Wno-unused-parameter -mssse3 -O2 -Wdate-time -D_FORTIFY_SOURCE=2 -shared -Wl,-soname,libntru-0.5.so -o libntru-0.5.so src/bitstring.o src/encparams.o src/hash.o src/idxgen.o src/key.o src/mgf.o src/ntru.o src/poly.o src/rand.o src/arith.o src/sha1.o src/sha2.o src/nist_ctr_drbg.o src/rijndael.o src/sha1-mb-x86_64.o src/sha256-mb-x86_64.o -Wl,-z,relro -lrt
  /usr/bin/ld: src/sha1-mb-x86_64.o: relocation R_X86_64_PC32 against undefined symbol `OPENSSL_ia32cap_P' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: final link failed: Bad value
  collect2: error: ld returned 1 exit status

If this assembler code is specifically geared for a 64-bit ABI, please
do without it here.  Otherwise, you might try adding -fPIC to ASM.

Thanks!

#880198#10
Date:
2017-11-07 16:08:12 UTC
From:
To:
Hi,

This bug seems to be fixed by side-effect after disabling SSE3.

In Makefile.linux we have
ifeq ($(SSE), yes)
    ifeq ($(MACHINE), x86_64)
        LIB_OBJS+=sha1-mb-x86_64.o sha256-mb-x86_64.o
    endif
endif

So if SSE=no then it does not build that two object files. Thus fixes
the FTBFS.
But I still think that we have to check DEB_HOST_ARCH instead of the
MACHINE.
MACHINE=$(shell uname -m | sed 's/i.86/i386/g')
And it seems to me that on x32, "uname -m" will be amd64. Which is still
buggy I think.

Yours,
Paul