Hi,
I'm trying to wrap libdeflate in Nim. I would like to create a package which
doesn't depend on any external library so I embedded C sources of libdeflate
inside my Nimble package.
Now I use following `compile` directives in my source code:
{.compile: "libdeflate_gzip/private/libdeflate/lib/deflate_decompress.c",
compile: "libdeflate_gzip/private/libdeflate/lib/utils.c",
compile: "libdeflate_gzip/private/libdeflate/lib/arm/cpu_features.c",
compile: "libdeflate_gzip/private/libdeflate/lib/x86/cpu_features.c",
compile: "libdeflate_gzip/private/libdeflate/lib/crc32.c",
compile: "libdeflate_gzip/private/libdeflate/lib/gzip_decompress.c"
.}
Run
Unfortunately when linking my test I'm getting error
duplicate symbol '_libdeflate_init_x86_cpu_features' in:
/Users/radekm/.cache/nim/test1_d/cpu_features.c.o
Run
The problem is that there are two files `cpu_features.c` with the same name but
in different directories. Then my linker is called with
/Users/radekm/.cache/nim/test1_d/cpu_features.c.o
Run
twice and I have duplicate symbols. I also suspect that `cpu_features.c` for
x86 ovewrites one for ARM. Can you advice how can I solve this without
modifying or renaming the original sources of libdeflate?