static build

72 views
Skip to first unread message

Igor Lamerger

unread,
Nov 21, 2018, 5:49:38 AM11/21/18
to DataStax C++ Driver for Apache Cassandra User Mailing List
Hello, have big trouble with C++ driver
try build a static library with your driver, but when try static compile my application give many errors about libuv, tell me please how static build your driver with static include all library?

errors:
undefined reference to `uv_key_create'
undefined reference to `uv_mutex_init'

and more 332 errors o_O

Fero

unread,
Nov 21, 2018, 7:22:15 AM11/21/18
to DataStax C++ Driver for Apache Cassandra User Mailing List
Igor,

It sounds like you didn't provide libuv as a link library; using '-luv' on unix like systems when compiling with gcc or clang or ensure the 'uv.lib' or 'uv_a.lib' is assigned in the Linker->Input section for Visual Studio.

If you want a complete static application you need to build all the dependencies statically as well (e.g. OpenSSL, libuv) when building your application or if on Windows and using DLLs you will need to make sure that they are in your PATH or in your application directory after compilation to properly execute your application.

~Fero

Igor Lamerger

unread,
Nov 21, 2018, 7:36:24 AM11/21/18
to DataStax C++ Driver for Apache Cassandra User Mailing List
среда, 21 ноября 2018 г., 15:22:15 UTC+3 пользователь Fero написал:
hi, thanx for answer, i write app in QT creator, use a static build

i compile libuv and add to pro file:

CONFIG += c++11 console crypto exceptions static luv

QMAKE_LFLAGS += -static -static-libstdc++ -static-libgcc

unix:!macx: LIBS += -L$$PWD/../../../../opt/openssl-1.1.1/ -lcrypto

INCLUDEPATH += $$PWD/../../../../opt/openssl-1.1.1/include
DEPENDPATH += $$PWD/../../../../opt/openssl-1.1.1/include

unix:!macx: PRE_TARGETDEPS += $$PWD/../../../../opt/openssl-1.1.1/libcrypto.a


unix:!macx: LIBS += -L$$PWD/../../../../../../../../../../opt/rabbitmq_driver/2/rabbitmq-c/build/librabbitmq/ -lrabbitmq

INCLUDEPATH += $$PWD/../../../../../../opt/rabbitmq_driver/2/rabbitmq-c/librabbitmq/
DEPENDPATH += $$PWD/../../../../../../opt/rabbitmq_driver/2/rabbitmq-c/librabbitmq/

DISTFILES += \
websocket_rabbit_translator.pro.user


unix:!macx: LIBS += -L$$PWD/../../../../opt/cas_driver/libuv/lib/libuv.a

INCLUDEPATH += $$PWD/../../../../opt/cas_driver/libuv/include
DEPENDPATH += $$PWD/../../../../opt/cas_driver/libuv/include

unix:!macx: LIBS += -L$$PWD/../../../../opt/cas_driver/cas2/usr/lib/ -lcassandra_static

INCLUDEPATH += $$PWD/../../../../opt/cas_driver/cas2/usr/include
DEPENDPATH += $$PWD/../../../../opt/cas_driver/cas2/usr/include

unix:!macx: PRE_TARGETDEPS += $$PWD/../../../../opt/cas_driver/cas2/usr/lib/libcassandra_static.a



errors:
undefined reference to `uv_rwlock_init'
undefined reference to `uv_rwlock_rdlock'

etc...

Fero

unread,
Nov 21, 2018, 7:46:35 AM11/21/18
to DataStax C++ Driver for Apache Cassandra User Mailing List
Igor,

> unix:!macx: LIBS += -L$$PWD/../../../../opt/cas_driver/libuv/lib/libuv.a

I don't use QT Creator so I am not sure how you are creating your library search path (-L), but you should fix that path and ensure the libuv library is set as your link library (-luv).

~Fero

Igor Lamerger

unread,
Nov 21, 2018, 7:53:29 AM11/21/18
to DataStax C++ Driver for Apache Cassandra User Mailing List
среда, 21 ноября 2018 г., 15:46:35 UTC+3 пользователь Fero написал:
but maybe i can static include a libuv to cass driver when make?

Fero

unread,
Nov 21, 2018, 8:12:31 AM11/21/18
to DataStax C++ Driver for Apache Cassandra User Mailing List
Igor,

Even if you include the static lib when building the C/C++ driver you also need to link the C/C++ driver and its dependencies when you are making your application.

~Fero

Reply all
Reply to author
Forward
0 new messages