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

issue hebasto openend this issue on April 14, 2023
  1. hebasto commented at 2:23 pm on April 14, 2023: member

    On master (4258c54f4ebfc09390168e8a43306c46b315134b):

    0$ ./autogen.sh
    1$ mkdir ../build && cd ../build
    2$ ../secp256k1/configure
    3$ make precomp
    4make: Nothing to be done for 'precomp'.
    5$ make clean-precomp
    6rm -f src/precomputed_ecmult_gen.c src/precomputed_ecmult.c
    7$ make precomp
    8make: Nothing to be done for 'precomp'.
    
  2. real-or-random commented at 1:21 pm on April 19, 2023: 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).

  3. hebasto commented at 2:03 pm on April 19, 2023: member
    Thanks for clarification!
  4. hebasto closed this on Apr 19, 2023

  5. real-or-random cross-referenced this on Apr 19, 2023 from issue build: Move generation of prebuilt files out of build system by real-or-random

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-22 08:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me