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

build: bdb detection and configuration fixes for macOs/brew #3308

Merged
merged 2 commits into from
Oct 1, 2023

Conversation

patricklodder
Copy link
Member

@patricklodder patricklodder commented Aug 7, 2023

Currently, brew logic in configure.ac always adds the default berkeley-db path when compiling on macOs. This causes link-time and/or run-time issues when the default version (18.x) is installed on the compiling system, and prevents proper linking when using the contrib/install_bdb.sh script. This has been blocking #2686.

This PR fixes that issue by:

  1. Updating dogecoin_find_bdb53.m4 to also check manually specified BDB_CFLAGS and BDB_LIBS. This prevents link-time and run-time errors by catching the error during configuration.
  2. Using the BITCOIN_FIND_BDB53 m4 macro when using brew for bdb detection instead of appending values to the generic CPPFLAGS and LIBS, because these are used generically for every binary and can cause issues with libtool archive scope.
  3. Only using brew to detect the installed version if no BDB_CFLAGS or BDB_LIBS is manually given. This is to allow maximum flexibility for custom compiles, while retaining automatic configuration.
  4. Detect each version of the berkeley-db package, in the order @5, @4 and only then the default version. The reason for this detection order is that 4.x is still fully readable by 5.3.27NC that is distributed by default, and therefore preferred over newer-than 5.x versions.

I've tested this to work on x86_64-linux, arm64-darwin and x86_64-darwin

After applying this patch on top of #3301, configuration on macOs only requires manual specification of boost, i.e.:

./autogen.sh
./configure --with-boost=`brew --prefix boost`

Note: this PR is best tested on top of #3301, so it's probably best to rebase this after that, or an alternative fix, gets merged.

Fixes the detection of bdb on brew enabled systems by using
dogecoin_find_bdb53.m4 parametrization and checking if the
brew-located files actually work.

Searches brew installed packages in the order: 5.x, 4.x, default.

The reason for this order is that 4.x is still fully readable by
5.3.27NC that is distributed by default, and therefore prefered
over newer-than 5.x versions.
@patricklodder
Copy link
Member Author

Rebased on top of 836753e after merge of #3301

@chromatic
Copy link
Member

ACK, all tests pass on 64-bit x86-Linux and the code changes make sense to me.

I think we should have another test on Mac though. @michilumin can you take this for a spin too?

@michilumin
Copy link
Member

Yup will do. About a day until I get back to my Mac but yes.

Copy link
Member

@michilumin michilumin left a comment

Choose a reason for hiding this comment

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

Review OK, testing in-situ.

@michilumin
Copy link
Member

Using brew berkeley-db@5 (vs berkeley-db), configures OK, builds OK, passes all unit tests (Core 2/2, libsec 2/2, univalue 3/3), on x86 Mac OS 13/Ventura build 13.6 (Intel, virgin install to ext SSD.)

@michilumin michilumin closed this Sep 28, 2023
@michilumin
Copy link
Member

wrong button.

@michilumin michilumin reopened this Sep 28, 2023
@michilumin michilumin self-requested a review September 28, 2023 01:05
@michilumin michilumin self-assigned this Sep 28, 2023
Copy link
Member

@michilumin michilumin left a comment

Choose a reason for hiding this comment

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

Visually reviewed and tested, looks OK to merge.

@chromatic
Copy link
Member

With Michi's approval, we're well past the 24 hour merge window so here we go!

@chromatic chromatic merged commit e23f14c into dogecoin:1.14.7-dev Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants