Skip to content

Static builds #4

@vegas503

Description

@vegas503

I'm trying to build c-libp2p to be used with static linking. However, when trying to build with...

cmake -S . -B build/ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DBUILD_SHARED_LIBS=OFF
make -C build

...most of stuff is built properly, however some tests are failing to link:

[ 95%] Building C object CMakeFiles/test_protocol_noise.dir/tests/protocol/noise/test_protocol_noise.c.o
[ 96%] Linking C executable tests/test_protocol_noise
/usr/bin/ld: lib/libsha3.a(sha3.c.o): in function `shake128_absorb':
sha3.c:(.text+0x206a): multiple definition of `shake128_absorb'; lib/libnoiseprotocol.a(fips202.c.o):fips202.c:(.text+0x1647): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/test_protocol_noise.dir/build.make:139: tests/test_protocol_noise] Error 1
make[1]: *** [CMakeFiles/Makefile2:2278: CMakeFiles/test_protocol_noise.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

Versions:

  • c-libp2p (latest main)
  • gcc (GCC) 15.1.1 20250425
  • cmake version 4.0.2-dirty
  • GNU Make 4.4.1

I suck at cmake so at this point I'm wondering if there's anything else that needs to be defined from my side, or if c-libp2p is not able to be built as static libs at all?

Let me know if I should provide more details.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions