akheron / jansson

C library for encoding, decoding and manipulating JSON data
http://www.digip.org/jansson/
Other
3.05k stars 809 forks source link

Multiple hashtable symbols #693

Closed empyreanx closed 1 month ago

empyreanx commented 1 month ago

The symbols hashtable_init and hashtable_clear are conflicting with my own implementation.

/usr/bin/ld: ../_deps/jansson-build/lib/libjansson.a(hashtable.c.o): in function `hashtable_init':
/home/james/Projects/build-wolfspider2d/_deps/jansson-src/src/hashtable.c:174: multiple definition of `hashtable_init'; ../lib/libwolfspider2d.a(hashtable.c.o):/home/james/Projects/wolfspider2d/external/hashtable.h:502: first defined here
/usr/bin/ld: ../_deps/jansson-build/lib/libjansson.a(hashtable.c.o): in function `hashtable_clear':
/home/james/Projects/build-wolfspider2d/_deps/jansson-src/src/hashtable.c:280: multiple definition of `hashtable_clear'; ../lib/libwolfspider2d.a(hashtable.c.o):/home/james/Projects/wolfspider2d/external/hashtable.h:734: first defined here
empyreanx commented 1 month ago

Three things:

  1. I am compiling from source (using CMake's FetchContent) and linking it statically
  2. I am using https://github.com/mattiasgustavsson/libs/blob/main/hashtable.h
  3. Jansson is the best JSON library there is!
akheron commented 1 month ago

AFAIK, it's not possible to hide symbols when linking statically. The only exception is symbols that exist inside one module (.o file).