cmake: Fix ABI version for shared library and improve MSVC output artifacts naming #1237

pull hebasto wants to merge 3 commits into bitcoin-core:master from hebasto:230311-msvc changing 1 files +13 −3
  1. hebasto commented at 0:59 am on March 11, 2023: member
    1. Fixed ABI version for a shared library.

    To test, one needs to simulate a release with backward-compatible API changes, which means:

    • increment of LIB_VERSION_CURRENT
    • setting LIB_VERSION_REVISION to zero
    • increment of LIB_VERSION_AGE

    1. When using Visual Studio generator, the “lib” prefix is not added automatically.

    Also added ABI-version suffix for a shared library (not bothering about a static library, as it already has the “_static” suffix to avoid name collision with DLL import library; should be revisited after #1230).

    On master (5658209459655cb74a0b8295e524a6390406e86a):

    • shared library: secp256k1.dll and secp256k1.lib
    • static library: secp256k1_static.lib

    With this PR:

    • shared library: libsecp256k1-2.dll and libsecp256k1-2.lib
    • static library: libsecp256k1_static.lib
  2. real-or-random commented at 2:08 pm on March 11, 2023: contributor

    Concept ACK, also based on the fact that autotools+mingw adds the lib prefix:

    With ./configure --enable-shared --enable-static --enable-dev-mode --host=x86_64-w64-mingw32, I get this in .libs:

     0-rwxr-xr-x 1 1740850 Mar 11 14:58 bench_ecmult.exe*
     1-rw-r--r-- 1    5990 Mar 11 14:58 bench_ecmult_ltshwrapper
     2-rwxr-xr-x 1  183064 Mar 11 14:58 bench.exe*
     3-rwxr-xr-x 1 1728983 Mar 11 14:58 bench_internal.exe*
     4-rw-r--r-- 1    6010 Mar 11 14:58 bench_internal_ltshwrapper
     5-rw-r--r-- 1    6360 Mar 11 14:58 bench_ltshwrapper
     6-rwxr-xr-x 1 1622008 Mar 11 14:58 libsecp256k1-2.dll*
     7-rw-r--r-- 1 1620676 Mar 11 14:58 libsecp256k1.a
     8-rw-r--r-- 1   50552 Mar 11 14:58 libsecp256k1.dll.a
     9lrwxrwxrwx 1      18 Mar 11 14:58 libsecp256k1.la -> ../libsecp256k1.la
    10-rw-r--r-- 1     936 Mar 11 14:58 libsecp256k1.lai
    11-rw-r--r-- 1 1120192 Mar 11 14:58 libsecp256k1_precomputed.a
    12lrwxrwxrwx 1      30 Mar 11 14:58 libsecp256k1_precomputed.la -> ../libsecp256k1_precomputed.la
    13-rw-r--r-- 1   32675 Mar 11 14:58 lt-bench.c
    14-rw-r--r-- 1   32021 Mar 11 14:58 lt-bench_ecmult.c
    15-rw-r--r-- 1   32049 Mar 11 14:58 lt-bench_internal.c
    

    Do we also want the -2 ABI version suffix?


    By the way, autotools+MSVC doesn’t add the prefix… But that’s a somewhat strange combination that probably noone uses, except our CI.
    With ./configure --enable-shared --enable-static --enable-dev-mode --host=x86_64-w64-mingw32 CC=/opt/msvc/bin/x64/cl CFLAGS="-nologo -diagnostics:caret" LDFLAGS="-XCClinker -nologo -XCClinker -diagnostics:caret" NM="/opt/msvc/bin/x64/dumpbin -symbols -headers" AR="/opt/msvc/bin/x64/lib", I get this in .libs:

     0-rwxr-xr-x 1 1330176 Mar 11 15:05 bench_ecmult.exe*
     1-rw-r--r-- 1    5990 Mar 11 15:05 bench_ecmult_ltshwrapper
     2-rwxr-xr-x 1  157184 Mar 11 15:05 bench.exe*
     3-rwxr-xr-x 1 1320960 Mar 11 15:05 bench_internal.exe*
     4-rw-r--r-- 1    6010 Mar 11 15:05 bench_internal_ltshwrapper
     5-rw-r--r-- 1    6360 Mar 11 15:05 bench_ltshwrapper
     6lrwxrwxrwx 1      18 Mar 11 15:05 libsecp256k1.la -> ../libsecp256k1.la
     7-rw-r--r-- 1     928 Mar 11 15:05 libsecp256k1.lai
     8lrwxrwxrwx 1      30 Mar 11 15:05 libsecp256k1_precomputed.la -> ../libsecp256k1_precomputed.la
     9-rw-r--r-- 1   32675 Mar 11 15:05 lt-bench.c
    10-rw-r--r-- 1   32021 Mar 11 15:05 lt-bench_ecmult.c
    11-rw-r--r-- 1   32049 Mar 11 15:05 lt-bench_internal.c
    12-rw-r--r-- 1 1333760 Mar 11 15:05 secp256k1-2.dll
    13-rw-r--r-- 1    3180 Mar 11 15:05 secp256k1-2.dll.exp
    14-rw-r--r-- 1   12123 Mar 11 15:05 secp256k1.dll.exp
    15-rw-r--r-- 1   20200 Mar 11 15:05 secp256k1.dll.lib
    16-rw-r--r-- 1    2214 Mar 11 15:05 secp256k1.exp
    17-rw-r--r-- 1 1363666 Mar 11 15:05 secp256k1.lib
    18-rw-r--r-- 1 1123338 Mar 11 15:05 secp256k1_precomputed.lib
    
  3. hebasto commented at 2:13 pm on March 11, 2023: member

    Do we also want the -2 ABI version suffix?

    Incidentally, I’m thinking about the same at this moment :)

  4. hebasto commented at 3:47 pm on March 11, 2023: member

    Updated ff0a509e5c374ae451c9a06d7d528d3e1add3b7e -> e2e0f47e1e9de40de80d1811ee00cda3e9cc99a4 (pr1237.01 -> pr1237.02, diff):

    Do we also want the -2 ABI version suffix?

  5. sipa commented at 11:13 pm on March 11, 2023: contributor
    Concept ACK
  6. hebasto force-pushed on Mar 13, 2023
  7. hebasto renamed this:
    cmake: Fix MSVC output artifacts naming
    cmake: Fix API version for shared library and improve MSVC output artifacts naming
    on Mar 13, 2023
  8. hebasto renamed this:
    cmake: Fix API version for shared library and improve MSVC output artifacts naming
    cmake: Fix ABI version for shared library and improve MSVC output artifacts naming
    on Mar 13, 2023
  9. cmake: Fix ABI version for shared library edc3f21a85
  10. cmake: Improve MSVC output artifacts naming
    When using Visual Studio generator, the "lib" prefix is not added
    automatically.
    2802d34206
  11. cmake: Add ABI version to MSVC output DLL name a8d6b4f2ce
  12. hebasto force-pushed on Mar 13, 2023
  13. hebasto commented at 2:39 pm on March 13, 2023: member

    Also I’ve noticed and fixed a wrong ABI version for a shared library.

    The PR description has been updated as well.

  14. hebasto cross-referenced this on Apr 10, 2023 from issue cmake: Fix library ABI versioning by hebasto
  15. hebasto marked this as a draft on Apr 10, 2023
  16. hebasto commented at 8:39 pm on April 10, 2023: member

    Also I’ve noticed and fixed a wrong ABI version for a shared library.

    The ABI version fix has been moved into a separated #1270.


    Drafted for now.

  17. hebasto commented at 4:18 pm on April 21, 2023: member
    Closing in favour of #1270.
  18. hebasto closed this on Apr 21, 2023

  19. hebasto deleted the branch on Apr 29, 2023

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-21 20:15 UTC

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