Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix build on FreeBSD #2770

Merged

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
40 of 42 checks passed
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