On Sun, Aug 09 2020, Bjorn Ketelaars <b...@openbsd.org> wrote:
> On Sun 09/08/2020 00:10, Jeremie Courreges-Anglas wrote:
>> > ==> failures/sysutils/xxhash.log <==
>> > Hunk #1 succeeded at 447.
>> > done
>> > ===>  Compiler link: clang -> /usr/bin/clang
>> > ===>  Compiler link: clang++ -> /usr/bin/clang++
>> > ===>  Compiler link: cc -> /usr/bin/cc
>> > ===>  Compiler link: c++ -> /usr/bin/c++
>> > ===>  Generating configure for xxhash-0.8.0
>> > ===>  Configuring for xxhash-0.8.0
>> > ===>  Building for xxhash-0.8.0
>> > cc -O2 -pipe     -c -o xxhash.o xxhash.c
>> > ar rcs libxxhash.a xxhash.o
>> > cc -O2 -pipe    xxhash.c -shared  -o libxxhash.so.0.2
>> > ld: error: relocation R_386_PC32 cannot be used against symbol 
>> > XXH3_64bits_withSeed; recompile with -fPIC
>> >>>> defined in /tmp/xxhash-53bf5d.o
>> >>>> referenced by xxhash.c
>> >>>>               /tmp/xxhash-53bf5d.o:(XXH3_64bits_digest)
>> >
>> > ld: error: relocation R_386_PC32 cannot be used against symbol 
>> > XXH3_64bits_withSecret; recompile with -fPIC
>> >>>> defined in /tmp/xxhash-53bf5d.o
>> >>>> referenced by xxhash.c
>> >>>>               /tmp/xxhash-53bf5d.o:(XXH3_64bits_digest)
>> >
>> > ld: error: relocation R_386_PC32 cannot be used against symbol 
>> > XXH3_128bits_withSeed; recompile with -fPIC
>> >>>> defined in /tmp/xxhash-53bf5d.o
>> >>>> referenced by xxhash.c
>> >>>>               /tmp/xxhash-53bf5d.o:(XXH3_generateSecret)
>> >
>> > ld: error: relocation R_386_PC32 cannot be used against symbol 
>> > XXH3_128bits_withSeed; recompile with -fPIC
>> >>>> defined in /tmp/xxhash-53bf5d.o
>> >>>> referenced by xxhash.c
>> >>>>               /tmp/xxhash-53bf5d.o:(XXH128)
>> >
>> > ld: error: relocation R_386_PC32 cannot be used against symbol 
>> > XXH3_128bits_withSeed; recompile with -fPIC
>> >>>> defined in /tmp/xxhash-53bf5d.o
>> >>>> referenced by xxhash.c
>> >>>>               /tmp/xxhash-53bf5d.o:(XXH3_128bits_digest)
>> >
>> > ld: error: relocation R_386_PC32 cannot be used against symbol 
>> > XXH3_128bits_withSecret; recompile with -fPIC
>> >>>> defined in /tmp/xxhash-53bf5d.o
>> >>>> referenced by xxhash.c
>> >>>>               /tmp/xxhash-53bf5d.o:(XXH3_128bits_digest)
>> > cc: error: linker command failed with exit code 1 (use -v to see 
>> > invocation)
>> > gmake: *** [Makefile:129: libxxhash.so.0.2] Error 1
>> > *** Error 2 in sysutils/xxhash 
>> > (/usr/ports/infrastructure/mk/bsd.port.mk:2925 
>> > '/pobj/xxhash-0.8.0/.build_done': @cd /pobj/xxhash-0.8.0/xxHas...)
>> > *** Error 2 in sysutils/xxhash 
>> > (/usr/ports/infrastructure/mk/bsd.port.mk:2584 'build': 
>> > @lock=xxhash-0.8.0;  export _LOCKS_HELD=" xxhash-0.8....)
>> > ===> Exiting sysutils/xxhash with an error
>> > *** Error 1 in /usr/ports (infrastructure/mk/bsd.port.subdir.mk:137 
>> > 'build': @: ${echo_msg:=echo};  : ${target:=build};  for i in ; do  
>> > eval...)
>> >>>> Ended at 1596797814.95
>> > max_stuck=0.00/depends=1.29/show-prepare-results=0.32/build=4.64
>> > Error: job failed with 512 on i386-1 at 1596797814
>> 
>> Shared libraries should be built with -fpic/-fPIC, i386 is more
>> sensitive than amd64 in this regard.
>> 
>> In the diff below I strip the CXX bits since this is a C-only port.
>> I can leave them alone if you prefer, though.
>> 
>> ok?
>
> Thank you addressing this issue!
>
> Please note that the CXX bits are needed for the testing phase. As such,
> I think it makes sense to leave them alone (or move them to TEST_FLAGS).

Oh indeed.  I've left them alone.

Here's an alternative take regarding the CFLAGS vs -fPIC issue.
Upstream's GNU Makefile does respect CFLAGS (we pass them via MAKE_ENV)
and properly tweaks them when needed (eg when building the shared lib).
By also passing CFLAGS via MAKE_FLAGS we prevent such tweaking.  So the
fix is just to do less.

ok?

Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/xxhash/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- Makefile    28 Jul 2020 04:41:18 -0000      1.7
+++ Makefile    9 Aug 2020 07:34:49 -0000
@@ -5,6 +5,7 @@ COMMENT =       extremely fast non-cryptograph
 GH_ACCOUNT =   Cyan4973
 GH_PROJECT =   xxHash
 GH_TAGNAME =   v0.8.0
+REVISION =     0
 PKGNAME =      ${DISTNAME:L}
 
 SHARED_LIBS =  xxhash 0.2      # 0.7.4
@@ -22,7 +23,6 @@ WANTLIB =     c
 
 MAKE_FLAGS =   CC="${CC}" \
                CXX="${CXX}" \
-               CFLAGS="${CFLAGS}" \
                CXXFLAGS="${CXXFLAGS}" \
                SONAME_FLAGS= \
                SHARED_EXT_VER="so.${LIBxxhash_VERSION}" \


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to