I pushed a commit into master for this. It may be that usage of *swap16 was introduced rather recently (March 2025) and never tested for portability.

Hopefully this fixes it for you.


BR

Am 06.09.25 um 11:21 schrieb Martin Schanzenbach:

On a whim, maybe this patch works for you?


diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index 5b68b424c..443b14477 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -55,11 +55,13 @@
 #if defined(__FreeBSD__)

 #include <sys/endian.h>
+#define bswap_16(x) bswap16 (x)
 #define bswap_32(x) bswap32 (x)
 #define bswap_64(x) bswap64 (x)

 #elif defined(__OpenBSD__)

+#define bswap_16(x) swap32 (x)
 #define bswap_32(x) swap32 (x)
 #define bswap_64(x) swap64 (x)

@@ -67,6 +69,7 @@

 #include <machine/bswap.h>
 #if defined(__BSWAP_RENAME) && ! defined(__bswap_32)
+#define bswap_16(x) bswap16 (x)
 #define bswap_32(x) bswap32 (x)
 #define bswap_64(x) bswap64 (x)
 #endif



Am 06.09.25 um 11:17 schrieb Martin Schanzenbach:

Hello,


I only occasionally compile on recent OpenBSDs. This error is new to me and completely unclear what the problem ist.

in src/include/gnunet_common.h there is an ifdef for FreeBSD that defines bswap_XY to bswapXY, which should exist: https://man.freebsd.org/cgi/man.cgi?query=bswap16&apropos=0&sektion=9&manpath=FreeBSD+15.0-CURRENT&arch=default&format=html

Now, I do not know if FreeBSD wants any special linker flags for those symbols. But that does not seem to be the problem at all, the problem seems to be that the bswap_16 symbol is not found, which should not really ever happen...


Anyway, maybe you can fiddle around with gnunet_common.h to make it compile somehow and provide a patch?


Best

Martin

Am 06.09.25 um 09:54 schrieb k via Mailinglist for GNUnet developers:

Dear,

I see that there are not many reactions in general for FreeBSD. Maybe I will share what I did:

#!/bin/sh

pkg install meson ninja pkgconf gettext gmake libtool libltdl git

pkg install libgcrypt
pkg install libidn2
pkg install libmicrohttpd
pkg install libunistring
pkg install jansson
pkg install gmp
pkg install curl
pkg install sqlite3
pkg install zbar
pkg install quiche

pkg install recutils

pkg install libltdl libtool

pkg install libmicrohttpd

pkg install libngtcp2
pkg install libnghttp3
pkg install miniupnpc

meson setup build \
   -Dc_args="-I/usr/local/include" \
   -Dc_link_args="-L/usr/local/lib" \
   --prefix=/usr/local \
   --sysconfdir=/usr/local/etc \
   -Dexclude-manpages=false

cd build

ninja

[1/681] cc  -o src/lib/pq/libgnunetpq.so.5.4.0 
src/lib/pq/libgnunetpq.so.5.4.0.p/pq.c.o 
src/lib/pq/libgnunetpq.so.5.4.0.p/pq_connect.c.o 
src/lib/pq/libgnunetpq.so.5.4.0.p/pq_eval.c.o 
src/lib/pq/libgnunetpq.so.5.4.0.p/pq_event.c.o 
src/lib/pq/libgnunetpq.so.5.4.0.p/pq_exec.c.o 
src/lib/pq/libgnunetpq.so.5.4.0.p/pq_prepare.c.o 
src/lib/pq/libgnunetpq.so.5.4.0.p/pq_query_helper.c.o 
src/lib/pq/libgnunetpq.so.5.4.0.p/pq_result_helper.c.o -L/usr/local/lib 
-Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,-soname,libgnunetpq.so.5 
'-Wl,-rpath,$ORIGIN/../util:/usr/local/lib' 
-Wl,-rpath-link,/usr/home/user1/gnunet/gnunet/build/src/lib/util 
-Wl,-rpath-link,/usr/local/lib -Wl,--start-group 
src/lib/util/libgnunetutil.so.18.0.0 /usr/local/lib/libpq.so -Wl,--end-group
FAILED: src/lib/pq/libgnunetpq.so.5.4.0
cc  -o src/lib/pq/libgnunetpq.so.5.4.0 src/lib/pq/libgnunetpq.so.5.4.0.p/pq.c.o 
src/lib/pq/libgnunetpq.so.5.4.0.p/pq_connect.c.o 
src/lib/pq/libgnunetpq.so.5.4.0.p/pq_eval.c.o 
src/lib/pq/libgnunetpq.so.5.4.0.p/pq_event.c.o 
src/lib/pq/libgnunetpq.so.5.4.0.p/pq_exec.c.o 
src/lib/pq/libgnunetpq.so.5.4.0.p/pq_prepare.c.o 
src/lib/pq/libgnunetpq.so.5.4.0.p/pq_query_helper.c.o 
src/lib/pq/libgnunetpq.so.5.4.0.p/pq_result_helper.c.o -L/usr/local/lib 
-Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,-soname,libgnunetpq.so.5 
'-Wl,-rpath,$ORIGIN/../util:/usr/local/lib' 
-Wl,-rpath-link,/usr/home/user1/gnunet/gnunet/build/src/lib/util 
-Wl,-rpath-link,/usr/local/lib -Wl,--start-group 
src/lib/util/libgnunetutil.so.18.0.0 /usr/local/lib/libpq.so -Wl,--end-group
ld: error: undefined symbol: bswap_16
>>> referenced by pq_query_helper.c:361 (../src/lib/pq/pq_query_helper.c:361)
>>>               
src/lib/pq/libgnunetpq.so.5.4.0.p/pq_query_helper.c.o:(qconv_int16)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
[2/681] cc  -o src/lib/gnsrecord/libgnunetgnsrecord.so.0.0.0 
src/lib/gnsrecord/libgnunetgnsrecord.so.0.0.0.p/gnsrecord.c.o 
src/lib/gnsrecord/libgnunetgnsrecord.so.0.0.0.p/gnsrecord_serialization.c.o 
src/lib/gnsrecord/libgnunetgnsrecord.so.0.0.0.p/gnsrecord_crypto.c.o 
src/lib/gnsrecord/libgnunetgnsrecord.so.0.0.0.p/gnsrecord_pow.c.o 
src/lib/gnsrecord/libgnunetgnsrecord.so.0.0.0.p/gnsrecord_misc.c.o 
-L/usr/local/lib -Wl,--as-needed -Wl,--no-undefined -shared -fPIC 
-Wl,-soname,libgnunetgnsrecord.so.0 '-Wl,-rpath,$ORIGIN/../util:/usr/local/lib' 
-Wl,-rpath-link,/usr/home/user1/gnunet/gnunet/build/src/lib/util 
-Wl,-rpath-link,/usr/local/lib -Wl,--start-group 
src/lib/util/libgnunetutil.so.18.0.0 /usr/local/lib/libsodium.so 
/usr/local/lib/libgcrypt.so -Wl,--end-group
ninja: build stopped: subcommand failed

Best Regards,

Reply via email to