-
Notifications
You must be signed in to change notification settings - Fork 52
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
RFC: Add autotools buildsystem #8
Conversation
## Some compilers (gcc) ignore unknown -Wno-* options, but warn about all | ||
## unknown options if any other warning is produced. Test the -Wfoo case, and | ||
## set the -Wno-foo case if it works. | ||
AX_CHECK_COMPILE_FLAG([-Wshift-count-overflow],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-shift-count-overflow"],,[[$CXXFLAG_WERROR]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is here because of a loud clang warning, which I assume is caused by some unreachable code. Rather than hunting it down, I just silenced it here for now. I'll open a separate issue for that warning.
src/fields/clmul_1byte.cpp
Outdated
@@ -6,7 +6,7 @@ | |||
|
|||
/* This file was substantially auto-generated by doc/gen_params.sage. */ | |||
|
|||
#ifdef __x86_64 | |||
#ifdef HAVE_CLMUL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that these files are conditionally built, is there any reason for these guards?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess not.
Fixed up a few problems, now ready for testing. I also finally found the secret sauce that allows the sources.mk to be used downstream with no modification (Automake's %reldir%). Here's a quick POC to show how trivial the Bitcoin Core integration is: theuni/bitcoin@1e779c8 . To test, just copy the contents of this branch to Core at src/minisketch and make. |
It looks like this does not build the test object code with -DMINISKETCH_VERIFY. |
It wasn't clear to me how that should be handled. Is it sufficient to compile only the test files that way, or does everything need to be rebuilt? |
@theuni All the object files that include sketch_impl.h should be built with -DMINISKETCH_VERIFY for tests (which probably means separate .a files for testing etc...). |
Got it, will do. |
Awesome, thanks! |
@sipa fixed. |
|
@sipa Should be fixed. I'm currently testing on macOS where the flags aren't required, so I can't be 100%. |
We don't actually use assert anymore anywhere in the codebase, so NDEBUG shouldn't be needed. |
Ok, removed it but left the machinery to add others later. |
Very cool. Would it be crazy to also build a test binary linked against the normal library (just so it catches any issues that are accidentally fixed by the verify macro?)? |
@gmaxwell Added for the sake of discussion, though I'm not sure I agree. I wonder if we can somehow constrain the macros to be side-effect free. Maybe using function attributes (const and pure, for example) and/or trivial callbacks that are optimized away? |
meh, part of the goal of having tests is catching bugs introduced by miscompilation (or undefined behaviour, which looks a lot like miscompilation). I think it would be a bad idea to never test the code the applications use... If building two weren't an option I'd rather just not compile with the test instrumentation except in special test builds... the tests still run fine against the release library, they're just not as sensitive. |
Concept ACK, I think this is fine (including the separate the two binaries for testing). |
tested 6eaccf6 on macOS 10.14.3
works as expected. Ran
then the example:
Currently running
|
@@ -1,95 +0,0 @@ | |||
default: test-exhaust bench | |||
|
|||
DEFINES := -DHAVE_CLZ -O2 -g0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HAVE_CLZ
is not covered by the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching that! Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't CLZ test with zero, it's undefined behaviour. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, thanks. Fixed.
Tiny nit: the Otherwise, looks good. Please squash? |
Rebased and squashed. New commits added before squashing:
For reference, the unrebased/unsquashed branch: Worth noting, as-is, this builds everything several times. We should consider setting a default static/shared to avoid duplicating all objects. Also, non-verify binaries (and objects) could be disabled by default. |
Funnily, make fails when configured with ACK with |
Hm, actually I'm not sure not.
I can imagine that this is on purpose but I'm not an expert enough to tell if it's correct or not. |
@real-or-random Huh. Thanks for noticing! We use I'll add that one-liner and re-squash. |
Should be functionally equivalent to the old Makefile, minus the logic to handle debug builds. Sources are split into a separate file for easier inclusion in downstream projects.
utACK 7a05881 |
7a05881 Add autotools buildsystem (Cory Fields) Pull request description: Should be functionally equivalent to the old Makefile ~~, minus the logic to handle debug builds, as it's unclear how they should work ideally~~. Sources are split into a separate file for easier inclusion in downstream projects ~~, though a simple sed will be needed to correct for paths~~(no longer needed). This will allow Bitcoin Core (and other projects) to incorporate sources into their buildsystems similar to the way that leveldb is currently handled, rather than requiring a subconfigure. Ideally (imo), univalue and libsecp256k1 would get the same treatment. ACKs for commit 7a0588: sipa: utACK 7a05881 Tree-SHA512: 52f99861ca06c83920bd352ffef9c7cdce9cd7cc83ed57c1dcd4570b9cace46b0025ab1c16b6bc021c7afac41f22d495d11b0524b82407be26f64c72334e9ff0
edited #Building to account for sipa#8
4a5b0a1 build: Move source entries out to sources.mk (Cory Fields) 6c7d94b build: cleanup wonky gen usage (Cory Fields) Pull request description: This addresses issues like the one in bitcoin/bitcoin#12467, where some of our compiler flags end up being dropped during the subconfigure of Univalue. Specifically, we're still using the compiler-default c++ version rather than forcing c++17. We can drop the need subconfigure completely in favor of a tighter build integration, where the sources are listed separately from the build recipes, so that they may be included directly by upstream projects. This is similar to the way leveldb build integration works in Core. A similar split was recently added for minisketch: sipa/minisketch#8 Upstream benefits of this approach include: - Better caching (for ex. ccache and autoconf) - No need for a slow subconfigure - No more missing compile flags - Compile only the objects needed There are no benefits to Univalue itself that I can think of. These changes should be a no-op here, and to downstreams as well until they take advantage of the new sources.mk. Once merged, [This Core branch](https://github.com/theuni/bitcoin/commits/univalue-split) is ready-ish for PR, and takes advantage of the features added here. libsecp256k1 will get the same treatment once this is done. ACKs for top commit: jnewbery: Tested ACK 4a5b0a1 fanquake: ACK 4a5b0a1 Tree-SHA512: 7c9237b5a4eea8d07da0b58471fabc6860e3dfe253f505bbf83366bb28d377c967a1c811bee04913e7da2121a7e0eaff31dd9681c3595d70e29c4ec08dbb2105
Should be functionally equivalent to the old Makefile
, minus the logic to handle debug builds, as it's unclear how they should work ideally.Sources are split into a separate file for easier inclusion in downstream projects
, though a simple sed will be needed to correct for paths(no longer needed). This will allow Bitcoin Core (and other projects) to incorporate sources into their buildsystems similar to the way that leveldb is currently handled, rather than requiring a subconfigure.Ideally (imo), univalue and libsecp256k1 would get the same treatment.