Re: sysutils/xxhash: pledge xxhsum(1)

2023-08-20 Thread Klemens Nanni
On Sun, Aug 20, 2023 at 09:05:36PM +0100, Stuart Henderson wrote:
> i'm ok with adding pledge (and the homepage update).
> 
> generally when we've added pledge patches to ports before, we used
> the 'native' means of error reporting rather than pulling in err.h;
> I would slightly prefer to do that here too - for this port it looks
> like the native is probably XSUM_log + exit (though one of the cases in
> xsum_os_specific.c just uses fprintf(stderr) + abort).

That would be XSUM_log() with strerror(3), which amounts to
"xsum_output.h" with  and , which looks more native,
but does not seem as straight forward as a single err(3).

Both hunks are at the top of main(), so direct return is both sufficient
and consistent with existing returns -- compared to abort(3).

This could look like this, I'm fine with both.
I can take it upstream (afterwards) and see if/how they want it.


Index: Makefile
===
RCS file: /cvs/ports/sysutils/xxhash/Makefile,v
retrieving revision 1.15
diff -u -p -r1.15 Makefile
--- Makefile17 Aug 2023 06:44:12 -  1.15
+++ Makefile17 Aug 2023 16:23:55 -
@@ -4,20 +4,21 @@ COMMENT = extremely fast non-cryptograph
 GH_ACCOUNT =   Cyan4973
 GH_PROJECT =   xxHash
 GH_TAGNAME =   v0.8.2
-REVISION = 0
+REVISION = 1
 PKGNAME =  ${DISTNAME:L}
 
 SHARED_LIBS =  xxhash 0.3  # 0.8.1
 
 CATEGORIES =   sysutils
 
-HOMEPAGE = https://cyan4973.github.io/xxHash/
+HOMEPAGE = https://xxhash.com
 
 MAINTAINER =   Bjorn Ketelaars 
 
 # BSD 2-Clause
 PERMIT_PACKAGE =   Yes
 
+# uses pledge()
 WANTLIB =  c
 
 MAKE_FLAGS =   CC="${CC}" \
Index: patches/patch-cli_xsum_os_specific_c
===
RCS file: patches/patch-cli_xsum_os_specific_c
diff -N patches/patch-cli_xsum_os_specific_c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-cli_xsum_os_specific_c20 Aug 2023 21:18:41 -
@@ -0,0 +1,31 @@
+Use pledge(2), xxhsum(1) only ever reads files or stdin.
+
+Index: cli/xsum_os_specific.c
+--- cli/xsum_os_specific.c.orig
 cli/xsum_os_specific.c
+@@ -69,6 +69,11 @@ static int XSUM_IS_CONSOLE(FILE* stdStream)
+  || defined(__DJGPP__) \
+  || defined(__MSYS__) \
+  || defined(__HAIKU__)
++#  ifdef __OpenBSD__
++#include/* errno */
++#include   /* strerror */
++#include "xsum_output.h" /* XSUM_log */
++#  endif
+ #  include/* isatty */
+ #  define XSUM_IS_CONSOLE(stdStream) isatty(fileno(stdStream))
+ #elif defined(MSDOS) || defined(OS2)
+@@ -135,6 +140,13 @@ static int XSUM_stat(const char* infilename, XSUM_stat
+ #ifndef XSUM_NO_MAIN
+ int main(int argc, const char* argv[])
+ {
++#ifdef __OpenBSD__
++if (pledge("stdio rpath", NULL) == -1) {
++XSUM_log("pledge: %s\n", strerror(errno));
++return 1;
++}
++#endif
++
+ return XSUM_main(argc, argv);
+ }
+ #endif
Index: patches/patch-tests_sanity_test_c
===
RCS file: patches/patch-tests_sanity_test_c
diff -N patches/patch-tests_sanity_test_c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-tests_sanity_test_c   20 Aug 2023 21:17:10 -
@@ -0,0 +1,19 @@
+Use pledge(2), the sanity test does even not read files.
+
+Index: tests/sanity_test.c
+--- tests/sanity_test.c.orig
 tests/sanity_test.c
+@@ -639,6 +639,13 @@ int main(int argc, const char* argv[])
+ (void) argc;
+ (void) argv;
+ 
++#ifdef __OpenBSD__
++if (pledge("stdio", NULL) == -1) {
++XSUM_log("pledge: %s\n", strerror(errno));
++return EXIT_FAILURE;
++}
++#endif
++
+ {
+ /* XXH32 */
+ size_t const n = sizeof(XSUM_XXH32_testdata) / 
sizeof(XSUM_XXH32_testdata[0]);



Re: sysutils/xxhash: pledge xxhsum(1)

2023-08-20 Thread Stuart Henderson
On 2023/08/20 16:36, Klemens Nanni wrote:
> On Thu, Aug 17, 2023 at 02:00:52AM +, Klemens Nanni wrote:
> > Compared to md5(1) with [-h hashfile], xxhsum(1) has no option to write
> > to anything but standard output.
> > 
> > Dropping "rpath" later can be done, but needs more patching and testing.
> > 
> > Works for me, tests pass.
> > Feedback? Objcetion? OK?
> 
> Rebased after the alignment fix.
> 
> No objection from bket.
> 
> Index: Makefile
> ===
> RCS file: /cvs/ports/sysutils/xxhash/Makefile,v
> retrieving revision 1.15
> diff -u -p -r1.15 Makefile
> --- Makefile  17 Aug 2023 06:44:12 -  1.15
> +++ Makefile  17 Aug 2023 16:23:55 -
> @@ -4,20 +4,21 @@ COMMENT =   extremely fast non-cryptograph
>  GH_ACCOUNT = Cyan4973
>  GH_PROJECT = xxHash
>  GH_TAGNAME = v0.8.2
> -REVISION =   0
> +REVISION =   1
>  PKGNAME =${DISTNAME:L}
>  
>  SHARED_LIBS =xxhash 0.3  # 0.8.1
>  
>  CATEGORIES = sysutils
>  
> -HOMEPAGE =   https://cyan4973.github.io/xxHash/
> +HOMEPAGE =   https://xxhash.com
>  
>  MAINTAINER = Bjorn Ketelaars 
>  
>  # BSD 2-Clause
>  PERMIT_PACKAGE = Yes
>  
> +# uses pledge()
>  WANTLIB =c
>  
>  MAKE_FLAGS = CC="${CC}" \
> Index: patches/patch-cli_xsum_os_specific_c
> ===
> RCS file: patches/patch-cli_xsum_os_specific_c
> diff -N patches/patch-cli_xsum_os_specific_c
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ patches/patch-cli_xsum_os_specific_c  17 Aug 2023 01:41:40 -
> @@ -0,0 +1,27 @@
> +Use pledge(2), xxhsum(1) only ever reads files or stdin.
> +
> +Index: cli/xsum_os_specific.c
> +--- cli/xsum_os_specific.c.orig
>  cli/xsum_os_specific.c
> +@@ -69,6 +69,9 @@ static int XSUM_IS_CONSOLE(FILE* stdStream)
> +  || defined(__DJGPP__) \
> +  || defined(__MSYS__) \
> +  || defined(__HAIKU__)
> ++#  ifdef __OpenBSD__
> ++#include 
> ++#  endif

i'm ok with adding pledge (and the homepage update).

generally when we've added pledge patches to ports before, we used
the 'native' means of error reporting rather than pulling in err.h;
I would slightly prefer to do that here too - for this port it looks
like the native is probably XSUM_log + exit (though one of the cases in
xsum_os_specific.c just uses fprintf(stderr) + abort).

> + #  include/* isatty */
> + #  define XSUM_IS_CONSOLE(stdStream) isatty(fileno(stdStream))
> + #elif defined(MSDOS) || defined(OS2)
> +@@ -135,6 +138,11 @@ static int XSUM_stat(const char* infilename, XSUM_stat
> + #ifndef XSUM_NO_MAIN
> + int main(int argc, const char* argv[])
> + {
> ++#ifdef __OpenBSD__
> ++if (pledge("stdio rpath", NULL) == -1)
> ++err(1, "pledge");
> ++#endif
> ++
> + return XSUM_main(argc, argv);
> + }
> + #endif
> Index: patches/patch-tests_sanity_test_c
> ===
> RCS file: patches/patch-tests_sanity_test_c
> diff -N patches/patch-tests_sanity_test_c
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ patches/patch-tests_sanity_test_c 17 Aug 2023 01:41:40 -
> @@ -0,0 +1,17 @@
> +Use pledge(2), the sanity test does even not read files.
> +
> +Index: tests/sanity_test.c
> +--- tests/sanity_test.c.orig
>  tests/sanity_test.c
> +@@ -639,6 +639,11 @@ int main(int argc, const char* argv[])
> + (void) argc;
> + (void) argv;
> + 
> ++#ifdef __OpenBSD__
> ++if (pledge("stdio", NULL) == -1)
> ++err(1, "pledge");
> ++#endif
> ++
> + {
> + /* XXH32 */
> + size_t const n = sizeof(XSUM_XXH32_testdata) / 
> sizeof(XSUM_XXH32_testdata[0]);
> 



Re: sysutils/xxhash: pledge xxhsum(1)

2023-08-20 Thread Klemens Nanni
On Thu, Aug 17, 2023 at 02:00:52AM +, Klemens Nanni wrote:
> Compared to md5(1) with [-h hashfile], xxhsum(1) has no option to write
> to anything but standard output.
> 
> Dropping "rpath" later can be done, but needs more patching and testing.
> 
> Works for me, tests pass.
> Feedback? Objcetion? OK?

Rebased after the alignment fix.

No objection from bket.

Index: Makefile
===
RCS file: /cvs/ports/sysutils/xxhash/Makefile,v
retrieving revision 1.15
diff -u -p -r1.15 Makefile
--- Makefile17 Aug 2023 06:44:12 -  1.15
+++ Makefile17 Aug 2023 16:23:55 -
@@ -4,20 +4,21 @@ COMMENT = extremely fast non-cryptograph
 GH_ACCOUNT =   Cyan4973
 GH_PROJECT =   xxHash
 GH_TAGNAME =   v0.8.2
-REVISION = 0
+REVISION = 1
 PKGNAME =  ${DISTNAME:L}
 
 SHARED_LIBS =  xxhash 0.3  # 0.8.1
 
 CATEGORIES =   sysutils
 
-HOMEPAGE = https://cyan4973.github.io/xxHash/
+HOMEPAGE = https://xxhash.com
 
 MAINTAINER =   Bjorn Ketelaars 
 
 # BSD 2-Clause
 PERMIT_PACKAGE =   Yes
 
+# uses pledge()
 WANTLIB =  c
 
 MAKE_FLAGS =   CC="${CC}" \
Index: patches/patch-cli_xsum_os_specific_c
===
RCS file: patches/patch-cli_xsum_os_specific_c
diff -N patches/patch-cli_xsum_os_specific_c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-cli_xsum_os_specific_c17 Aug 2023 01:41:40 -
@@ -0,0 +1,27 @@
+Use pledge(2), xxhsum(1) only ever reads files or stdin.
+
+Index: cli/xsum_os_specific.c
+--- cli/xsum_os_specific.c.orig
 cli/xsum_os_specific.c
+@@ -69,6 +69,9 @@ static int XSUM_IS_CONSOLE(FILE* stdStream)
+  || defined(__DJGPP__) \
+  || defined(__MSYS__) \
+  || defined(__HAIKU__)
++#  ifdef __OpenBSD__
++#include 
++#  endif
+ #  include/* isatty */
+ #  define XSUM_IS_CONSOLE(stdStream) isatty(fileno(stdStream))
+ #elif defined(MSDOS) || defined(OS2)
+@@ -135,6 +138,11 @@ static int XSUM_stat(const char* infilename, XSUM_stat
+ #ifndef XSUM_NO_MAIN
+ int main(int argc, const char* argv[])
+ {
++#ifdef __OpenBSD__
++if (pledge("stdio rpath", NULL) == -1)
++err(1, "pledge");
++#endif
++
+ return XSUM_main(argc, argv);
+ }
+ #endif
Index: patches/patch-tests_sanity_test_c
===
RCS file: patches/patch-tests_sanity_test_c
diff -N patches/patch-tests_sanity_test_c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-tests_sanity_test_c   17 Aug 2023 01:41:40 -
@@ -0,0 +1,17 @@
+Use pledge(2), the sanity test does even not read files.
+
+Index: tests/sanity_test.c
+--- tests/sanity_test.c.orig
 tests/sanity_test.c
+@@ -639,6 +639,11 @@ int main(int argc, const char* argv[])
+ (void) argc;
+ (void) argv;
+ 
++#ifdef __OpenBSD__
++if (pledge("stdio", NULL) == -1)
++err(1, "pledge");
++#endif
++
+ {
+ /* XXH32 */
+ size_t const n = sizeof(XSUM_XXH32_testdata) / 
sizeof(XSUM_XXH32_testdata[0]);



Re: sysutils/xxhash

2020-08-09 Thread Bjorn Ketelaars
On Sun 09/08/2020 09:58, Jeremie Courreges-Anglas wrote:
> On Sun, Aug 09 2020, Bjorn Ketelaars  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 -pipexxhash.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 -  1.7
> +++ Makefile  9 Aug 2020 07:34:49 -
> @@ -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}" \

OK bket@



Re: sysutils/xxhash

2020-08-09 Thread Jeremie Courreges-Anglas
On Sun, Aug 09 2020, Bjorn Ketelaars  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 -pipexxhash.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
--- Makefile28 Jul 2020 04:41:18 -  1.7
+++ Makefile9 Aug 2020 07:34:49 -
@@ -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



Re: sysutils/xxhash (was: Re: i386/LLVM 10)

2020-08-08 Thread Bjorn Ketelaars
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 -pipexxhash.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).

With the above OK bket@