Affected: Lua SDK, version 2.1.1
Symptoms
When compiling the Lua SDK, the following error appears:
lua: error loading module 'launchdarkly_server_sdk' from file '/usr/local/lib/lua/5.1/launchdarkly_server_sdk.so': /usr/local/lib/lua/5.1/launchdarkly_server_sdk.so: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE
Cause
The error undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE
indicates a missing C++ library, which typically arises when using the gcc compiler.
Solution
To resolve this error, follow these steps:
- Update the C++ server to version 3.3.3.
- Compile the library by using the
scripts/get-cpp-sdk-locally.sh
script from theluarocks
package. - Add the following line to the
rockspec
file:
libraries = {"launchdarkly-cpp-server","stdc++","boost_json","boost_url","ssl","crypto"}
- Run the build command:
luarocks make launchdarkly-server-sdk-2.1.1-0.rockspec
- Run the compiler.
Example:
g++ -O2 -fPIC -fpermissive -I/usr/local/openresty/luajit/include/luajit-2.1 -c launchdarkly-server-sdk.c -o launchdarkly-server-sdk.o -I/usr/local/include && \
g++ -std=c++11 -shared launchdarkly-server-sdk.o -L/usr/local/lib -Wl,-rpath,/usr/local/lib -llaunchdarkly-cpp-server && \