ni / grpc-labview

gRPC client and server support for LabVIEW
MIT License
91 stars 62 forks source link

Update to only export LIBRARY_EXPORT symbols from the shared library for Linux #362

Closed yaqian256 closed 5 months ago

yaqian256 commented 5 months ago

This PR is to update the Linux build to only export LIBRARY_EXPORT symbols from the shared library.

Currently the labview grpc shared library for Linux exports all symbols. This causes symbol collisions for some use case. For example, the liblabview_grpc_server.so exports the following unique symbols (you can see the full list by running the nm -C -D liblabview_grpc_server.so command)

0000000000b3ef88 u grpc::internal::GrpcLibraryInitializer::GrpcLibraryInitializer()::g_core_codegen
0000000000b3ef98 u grpc::internal::GrpcLibraryInitializer::GrpcLibraryInitializer()::g_gli

If in a labview app that uses grpc-labview, it calls another C library that also uses grpc which also exports the above symbols, there will be collisions.

To avoid that issues, we should update the Linux build (include both Desktop and RT) to only export LIBRARY_EXPORTsymbols from the shared library. We already do this for the Windows build.