Re: Compilation on latest FreeBSD
Martin Schanzenbach <[email protected]> Sat, 6 Sep 2025 11:21:12 +0200
| Newsgroups | gmane.network.gnunet.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--------------Z0jxNwnWgLNWaOSGWgt0ecd2
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
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,
>>
--------------Z0jxNwnWgLNWaOSGWgt0ecd2
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>On a whim, maybe this patch works for you?</p>
<p><br>
</p>
<p>diff --git a/src/include/gnunet_common.h
b/src/include/gnunet_common.h<br>
index 5b68b424c..443b14477 100644<br>
--- a/src/include/gnunet_common.h<br>
+++ b/src/include/gnunet_common.h<br>
@@ -55,11 +55,13 @@<br>
#if defined(__FreeBSD__)<br>
<br>
#include <sys/endian.h><br>
+#define bswap_16(x) bswap16 (x)<br>
#define bswap_32(x) bswap32 (x)<br>
#define bswap_64(x) bswap64 (x)<br>
<br>
#elif defined(__OpenBSD__)<br>
<br>
+#define bswap_16(x) swap32 (x)<br>
#define bswap_32(x) swap32 (x)<br>
#define bswap_64(x) swap64 (x)<br>
<br>
@@ -67,6 +69,7 @@<br>
<br>
#include <machine/bswap.h><br>
#if defined(__BSWAP_RENAME) && ! defined(__bswap_32)<br>
+#define bswap_16(x) bswap16 (x)<br>
#define bswap_32(x) bswap32 (x)<br>
#define bswap_64(x) bswap64 (x)<br>
#endif</p>
<p><br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">Am 06.09.25 um 11:17 schrieb Martin
Schanzenbach:<br>
</div>
<blockquote type="cite"
cite="mid:[email protected]">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<p>Hello,</p>
<p><br>
</p>
<p>I only occasionally compile on recent OpenBSDs. This error is
new to me and completely unclear what the problem ist.</p>
<p>in src/include/gnunet_common.h there is an ifdef for FreeBSD
that defines bswap_XY to bswapXY, which should exist:
<a class="moz-txt-link-freetext"
href="https://man.freebsd.org/cgi/man.cgi?query=bswap16&apropos=0&sektion=9&manpath=FreeBSD+15.0-CURRENT&arch=default&format=html"
moz-do-not-send="true">https://man.freebsd.org/cgi/man.cgi?query=bswap16&apropos=0&sektion=9&manpath=FreeBSD+15.0-CURRENT&arch=default&format=html</a></p>
<p>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...</p>
<p><br>
</p>
<p>Anyway, maybe you can fiddle around with gnunet_common.h to
make it compile somehow and provide a patch?</p>
<p><br>
</p>
<p>Best</p>
<p>Martin<br>
</p>
<div class="moz-cite-prefix">Am 06.09.25 um 09:54 schrieb k via
Mailinglist for GNUnet developers:<br>
</div>
<blockquote type="cite"
cite="mid:[email protected]">
<meta http-equiv="Content-Type"
content="text/html; charset=UTF-8">
<p>Dear,</p>
<p>I see that there are not many reactions in general for
FreeBSD. Maybe I will share what I did:</p>
<pre>#!/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
</pre>
<p>cd build</p>
<p>ninja</p>
<pre>[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
</pre>
<p>Best Regards,</p>
</blockquote>
</blockquote>
</body>
</html>
--------------Z0jxNwnWgLNWaOSGWgt0ecd2--