Skip to content

Conversation

@wilkart
Copy link
Contributor

@wilkart wilkart commented Jun 26, 2024

Fix building on FreeBSD.

[ 73%] Building CXX object src/CMakeFiles/gridcoin_util.dir/pbkdf2.cpp.o
/home/wilkart/Gridcoin-Research/src/pbkdf2.cpp:20:1: error: redefinition of 'be32enc'
be32enc(void *pp, uint32_t x)
^
/usr/include/sys/endian.h:128:1: note: previous definition is here
be32enc(void *pp, uint32_t u)
^
1 error generated.
gmake[2]: *** [src/CMakeFiles/gridcoin_util.dir/build.make:972: src/CMakeFiles/gridcoin_util.dir/pbkdf2.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:249: src/CMakeFiles/gridcoin_util.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2

Additionally remove #include <linux/random.h> according to upstream.

This requires a linux kernel of 3.17.0+, which seems entirely
reasonable. 3.17 went EOL in 2015, and the last supported 3.x kernel
(3.16) went EOL > 4 years ago, in 2020. For reference, the current
oldest maintained kernel is 4.14 (released 2017, EOL Jan 2024).
Support for getrandom() (and getentropy()) was added to
glibc 2.25, https://sourceware.org/legacy-ml/libc-alpha/2017-02/msg00079.html,
and we already require 2.27+.
All that being said, I don't think you would encounter a current day
system, running with kernel headers older than 3.17 (released 2014) but
also having a glibc of 2.27+ (released 2018).

Signed-off-by: Artur Pedziwilk <[email protected]>
@wilkart
Copy link
Contributor Author

wilkart commented Jun 26, 2024

@jamescowens @div72
Dear collegues,
maybe you could review my changes and advice how to pass the test-linux-minimal.

I am trying to solve problem of building on FreeBSD 14.
I am running 2 instances now for verification, built with gmake on amd64 and with cmake on arm64.

@div72
Copy link
Member

div72 commented Jun 26, 2024

@wilkart Was the <linux/random.h> include causing problems for FreeBSD? If so, did you check if it was CMake-only or reproducable with automake? I remember CMake setting some HAVE_* flags to 0 when it shouldn't have been defined in the first place.

@wilkart
Copy link
Contributor Author

wilkart commented Jun 29, 2024

@div72 I confirm it is CMake-only error.

[ 75%] Building CXX object src/CMakeFiles/gridcoin_util.dir/random.cpp.o
/root/Gridcoin-Research/src/random.cpp:34:10: fatal error: 'linux/random.h' file not found
#include <linux/random.h>
         ^~~~~~~~~~~~~~~~
1 error generated.

Solution, I simply took from bitcoin repository as upstream.

@jamescowens jamescowens requested a review from div72 June 30, 2024 13:24
@jamescowens jamescowens added this to the Natasha milestone Jun 30, 2024
Copy link
Member

@div72 div72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK - Needs a follow-up to add new checks to configure.ac/CMake.

@jamescowens jamescowens merged commit 9ba9e8a into gridcoin-community:development Jul 3, 2024
jamescowens added a commit that referenced this pull request Feb 16, 2025
Added
 - depends: add cross arm64-darwin support #2775 (@div72)
 - build: add missing randomness checks #2772 (@div72)
 - init, registry: Support -clearallregistryhistory startup parameter #2773 (@jamescowens)

Changed
 - build: omit _FORTIFY_SOURCE on debug #2793 (@div72)
 - doc: cmake is required for Windows depends #2791 (@barton2526)
 - CMake: Set maximum supported Boost version #2788 (@CyberTailor)
 - ci: bump to MacOS 13 #2784 (@div72)
 - build/cmake: disable LevelDB tests #2776 (@div72)
 - util: use XDG_STATE_HOME for datadir on Flatpak #2774 (@div72)
 - util, build: Support miniupnp API version 18+ #2771 (@jamescowens)
 - build: explicitly include FindPkgConfig for CMake #2769 (@jamescowens)
 - ci, cd: bump action versions #2763 (@div72)
 - Sync CMake CI #2762 (@CyberTailor)
 - cpid: Modify CPID local hasher to eliminate compiler warnings on 32 bit archs #2760 (@jamescowens)

Removed
 - refactor, misc: remove CBitcoin(Address|Secret) #2634 (@div72)

Fixed
 - poll, gui: Disable choice add button in poll wizard when choice limit is reached #2792 (@jamescowens)
 - diagnose, rpc: fix compilation with boost 1.87 #2786 (@div72)
 - node: fix build with GCC 15 #2783 (@CyberTailor)
 - ci: use overwrite with brew install on MacOS CMake #2782 (@div72)
 - scraper: Protect access to ConvergedStats.csv.gz with a lock #2779 (@jamescowens)
 - fix build on FreeBSD #2770 (@wilkart)
 - rpc/server: fix removing deprecated commands from command list #2768 (@lrusak)
 - cmake bdb53: disable error for implicit-int with gcc #2767 (@lrusak)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants