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

cmake, doc: Update build-openbsd.md #167

Merged
merged 1 commit into from
Apr 25, 2024
Merged

Conversation

hebasto
Copy link
Owner

@hebasto hebasto commented Apr 23, 2024

No description provided.

@hebasto
Copy link
Owner Author

hebasto commented Apr 23, 2024

Friendly ping @theStack :)

Copy link

@theStack theStack left a comment

Choose a reason for hiding this comment

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

Concept ACK

Following the build instructions on OpenBSD 7.5 succeeded for the "Descriptor Wallet and GUI" scenario ✔️ , will still play a bit around with different configurations (in particular, building with BerkeleyDB).

doc/build-openbsd.md Show resolved Hide resolved
doc/build-openbsd.md Outdated Show resolved Hide resolved
doc/build-openbsd.md Outdated Show resolved Hide resolved
@hebasto
Copy link
Owner Author

hebasto commented Apr 24, 2024

@theStack @fanquake

Thank you for your reviews! Your comments have been addressed.

doc/build-openbsd.md Outdated Show resolved Hide resolved

./autogen.sh
Prepare a build directory:

Choose a reason for hiding this comment

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

Aren't we using modern CMake invocations, where this isn't needed?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I think this is a better option for the documentation purpose:

The point is the mkdir build && cd build invocation guaranties the clean build environment. Another benefit of cd build is that there is no need to specify the --test-dir option when running ctest.

Choose a reason for hiding this comment

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

Right, but isn't the point of using a dir, that you can just blow it away, and guarantee a clean env? i.e I'll regularly just rm -r build, and then re-run CMake commands, without having to hop around in directories.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I do the same :)

Or use the --fresh option.

But I believe that the documentation should be foolproof. It has to suggest the safest way to do things. Users will find their own ways that suit their needs better.

Copy link

@fanquake fanquake Apr 25, 2024

Choose a reason for hiding this comment

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

It has to suggest the safest way to do things.

Why is using mkdir and cd safer than using the CMake option that exists to do exactly the same thing?

Choose a reason for hiding this comment

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

I think it's because -B will reuse an existing dirty build directory

Sure, but there's nothing preventing a user who's hopping around dirs and always recreating them manually from accidently doing the exact same thing?

Copy link

@m3dwards m3dwards Apr 25, 2024

Choose a reason for hiding this comment

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

You are right but in terms of documentation, how do we know that their build directory is empty? A mkdir sets the expectation that this directory didn't already exist.

Choose a reason for hiding this comment

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

That only works the first time, and nowhere do we tell users to cleanup and recreate their build dirs, so anyone who's already built once, could easily re-use the same build dir with different code etc.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

mkdir ensures pristine build directory only if we assume that the user will stop if it gives an error. I can imagine some users continuing nevertheless (I have seen people that don't recognize error messages from normal diagnostic messages or just accidentally don't read that extra line on the screen which reads "mkdir: build: File exists").

If we want to stress on clean build directory then we need to start with a command like rm -fr build or cmake --fresh.

doc/build-openbsd.md Outdated Show resolved Hide resolved
@hebasto hebasto force-pushed the 240423-cmake-EA branch 2 times, most recently from d5580c9 to 4b93202 Compare April 25, 2024 15:12
@hebasto
Copy link
Owner Author

hebasto commented Apr 25, 2024

The cmake and ctest invocations have been modernized (discussed during today's call).

doc/build-openbsd.md Outdated Show resolved Hide resolved
@theStack
Copy link

Tested ACK f8994d1

I can confirm that the cmake build/test instructions work as expected on OpenBSD 7.5.

Some differences I found between autotools vs. cmake that could potentially confuse/disturb users:

  • $ ./configure --help shows the available options immediately, while $ cmake -B build -LH performs some checks already before options are shown, which takes significantly longer, at least on the first run. Is there way to get the config options instantly? (other than looking into CMakeLists.txt manually, or some workaround like $ grep ^option CMakeLists.txt?)
  • Calling $ ./configure with an option that errors (e.g. due to missing package/header) and then calling it again without that option works fine. With CMake, it seems that once an option is passed, it is saved, so removing the option in another call still fails. E.g.:
$ cmake -B build -DWITH_UPNPC=ON
...
CMake Error at /usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find MiniUPnPc (missing: MiniUPnPc_LIBRARY MiniUPnPc_INCLUDE_DIR
  MiniUPnPc_API_VERSION_OK)
...
$ cmake -B build
< still fails with the same error... >

No strong opinion, but it seems using --fresh mitigates the second problem and could be slightly less confusing?

@hebasto
Copy link
Owner Author

hebasto commented Apr 25, 2024

  • Calling $ ./configure with an option that errors (e.g. due to missing package/header) and then calling it again without that option works fine. With CMake, it seems that once an option is passed, it is saved, so removing the option in another call still fails.

What about passing this option in another call with OFF value?

@hebasto
Copy link
Owner Author

hebasto commented Apr 25, 2024

  • $ ./configure --help shows the available options immediately, while $ cmake -B build -LH performs some checks already before options are shown, which takes significantly longer, at least on the first run.

Right. The approaches are quite different. CMake shows the cached variables, which means the cache is generated first.

Is there way to get the config options instantly?

No, if using cmake binary.

@hebasto hebasto merged commit 2fc8782 into cmake-staging Apr 25, 2024
30 checks passed
hebasto added a commit that referenced this pull request May 7, 2024
448132a fixup! cmake, doc: Update `build-freebsd.md` (Hennadii Stepanov)
9bafc55 fixup! cmake, doc: Update `build-osx.md` (Hennadii Stepanov)
a0a98ff fixup! cmake, docs: Update MSVC build docs (Hennadii Stepanov)

Pull request description:

  This PR amends build docs according the discussion in #167 where there were agreed to use modern cmake invocations.

  Simplifies #173 and #177.

ACKs for top commit:
  vasild:
    ACK 448132a

Tree-SHA512: cf49f258b6f65098603a0e33ec2a3f11665d83ee87efe3fc11ff59a2a92ba798c4e127896052cf934b0fcabbbfa6a87c880341458b0c12cfbc7b7a4465f9c413
hebasto added a commit that referenced this pull request May 8, 2024
…VE. The GUI

c46dd16 cmake [KILL 3-STATE]: Rename WITH_GUI to BUILD_GUI (Hennadii Stepanov)
d06252f cmake [KILL 3-STATE]: Make WITH_GUI binary option w/ default OFF (Hennadii Stepanov)

Pull request description:

  Replaces multi-value `WITH_GUI` with boolean `BUILD_GUI` as discussed during the recent call.

  The default value of the `BUILD_GUI` option is `OFF`.

  Documentation has been adjusted.

  While touching build docs, they were amended to use modern CMake invocations according to discussion in #167 (should be trivial to review though).

Top commit has no ACKs.

Tree-SHA512: ebe65f616e2044a6b09e8b1ff3685fd4f8fca6be2f2324db7495b56bbfdb03e6ab7d5a80d1a91ef903e11417590f9267cc2f80aa591379cb193ced36fbebbec0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants