How to compile a lib as shared lib with symbols?

I’m the maintainer of the Luos_engine lib.
I’m trying to compile this lib as a native shared lib with symbols on it to make it usable with other languages such as Python or Rust.

To make It, I added a src folder containing a main.c doing nothing except importing the libs I want to compile, and a shared_lib_build.py script to add the command line generating the shared lib.

Here is a simplified version of this script for Mac:

Import("env")
import os
import click

def shared_lib(source, target, env):
    # Try to find the luos_engine.a somwhere on $BUILD_DIR/*/ archive and save it to a libPath variable
    libPath = None
    for root, dirs, files in os.walk(env.subst("$BUILD_DIR")):
        for file in files:
            if file.endswith("luos_engine.a"):
                libPath = os.path.join(root, file)
                break
        if libPath is not None:
            break

    # Create the actual shared lib
    if libPath is not None:
        env.Execute("gcc -v -shared -fPIC -o $BUILD_DIR/libluos_engine.dylib " + libPath)
        click.secho("\n")
        click.secho("Luos engine shared library available in " + str(env.subst("$BUILD_DIR")) + "/ :", underline=True)

env.AddPostAction("$PROGPATH", shared_lib)
env.Append(LINKFLAGS=["-fPIC"])
env.Append(BUILD_FLAGS=["-fPIC"])

By compiling I have this extra execution in the end of compilation :

$ gcc -v -shared -fPIC -o .../luos_engine/.pio/build/native_lib/libluos_engine.dylib .../luos_engine/.pio/build/native_lib/libdf9/libluos_engine.a
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: x86_64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -dylib -arch x86_64 -platform_version macos 14.0.0 14.2 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -o .../luos_engine/.pio/build/native_lib/libluos_engine.dylib -L/usr/local/lib .../luos_engine/.pio/build/native_lib/libdf9/libluos_engine.a -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/lib/darwin/libclang_rt.osx.a

After the compilation, I get my libluos_engine.dylib with no error but there are no symbols on it.

$ nm .pio/build/native_lib/libws_luos_engine.dylib
.pio/build/native_lib/libluos_engine.dylib: no symbols

You can find the code related to this subject on this pull request on GitHub.

I can’t find any way to include the symbols on this shared lib, did someone have any idea?