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

autotools: make precomp does not work for out-of-source builds #1280

Closed
hebasto opened this issue Apr 14, 2023 · 2 comments
Closed

autotools: make precomp does not work for out-of-source builds #1280

hebasto opened this issue Apr 14, 2023 · 2 comments

Comments

@hebasto
Copy link
Member

hebasto commented Apr 14, 2023

On master (4258c54):

$ ./autogen.sh
$ mkdir ../build && cd ../build
$ ../secp256k1/configure
$ make precomp
make: Nothing to be done for 'precomp'.
$ make clean-precomp
rm -f src/precomputed_ecmult_gen.c src/precomputed_ecmult.c
$ make precomp
make: Nothing to be done for 'precomp'.
@real-or-random
Copy link
Contributor

Well, I think that's somewhat by design.

The problem here is not that make precomp does not work. The problem is that make clean-precomp has nothing to clean: src/precomputed_ecmult_gen.c src/precomputed_ecmult.c simply don't exist in the build dir.

So, what is make clean-precomp supposed to do in an out-of-tree build? We have three options:

  1. Do nothing. Disadvantage: It doesn't work.
  2. Error out. Disadvantage: It doesn't work either.
  3. Clean in the src dir. Disadvantage: That violates the convention that an out-of-tree build should not touch the source dir.

As I see it, the maintainer features generate source files, so it's natural that they only work in the source dir.

Having said that, it would probably be okay to implement 3. But I'm not convinced that this is much better. The build should work then somewhat because the precomp files are then generated in the build dir (since we have https://github.com/bitcoin-core/secp256k1/pull/1160/commits/e862c4af0c5a7300129700d38eff499a836a108d0). But this also means that another make clean-precomp will (try to) delete the files in the source dir again.

I lean towards accepting that this is a maintainer-only feature and works only in the source dir. That will translate to option 2.

Here's an entirely different idea:
With all this autotools mess, and since we don't even have these features in CMake, it would perhaps be cleaner to move (maintainer-)generation of the distributed files entirely out of the build system(s). This is currently hard since creating the files involves running a C program, which needs to be compiled, which needs some kind of build infrastructure. If we used Python to create the table files (see #919), this would simplify some things. In particular because we have a "maintainer dependency" on Python anyway now with the test vector scripts.... On the other hand, all of this is work and I doubt it's worth spending our time on this right now. (This is true in general when it comes to solving this "issue" here).

@hebasto
Copy link
Member Author

hebasto commented Apr 19, 2023

Thanks for clarification!

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

No branches or pull requests

2 participants