Skip to content

Commit 65d8539

Browse files
authored
Fix driver export and don't force static lib (#352)
* Don't force static library when building tests * Use shared lib for export checks * Fix and speed up CI `check_driver_exports()` * Always define`dse_gssapi_authenticator_set_lock_callbacks()`
1 parent 58ba05c commit 65d8539

6 files changed

Lines changed: 25 additions & 17 deletions

File tree

build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ build:
4949
5050
FUNCTIONS+=($(grep -Eoh '(^cass_\s*(\w+)\s*\()|(^dse_\s*(\w+)\s*\()' cpp-driver/include/dse.h | awk -F '(' '{print $1}'));
5151
FUNCTIONS+=($(grep -Eoh '^cass_\s*(\w+)\s*\(' cpp-driver/include/cassandra.h | awk -F '(' '{print $1}'))
52-
check_driver_exports 'cpp-driver/build/libcassandra_static.a' "${FUNCTIONS[@]}"
52+
check_driver_exports 'cpp-driver/build/libcassandra' "${FUNCTIONS[@]}"
5353
5454
cpp-driver/build/cassandra-unit-tests --gtest_output=xml:unit-test-results.xml
5555

cpp-driver/.build.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ SHA=$(echo ${GIT_COMMIT} | cut -c1-7)
2727

2828
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
2929
if [ "${OS_NAME}" = "osx" ]; then
30+
LIB_SUFFIX="dylib"
3031
PROCS=$(sysctl -n hw.logicalcpu)
3132
. ${SCRIPT_DIR}/.build.osx.sh
3233
else
34+
LIB_SUFFIX="so"
3335
PROCS=$(grep -e '^processor' -c /proc/cpuinfo)
3436
. ${SCRIPT_DIR}/.build.linux.sh
3537
fi
@@ -79,7 +81,6 @@ build_driver() {
7981
fi
8082
cmake -DCMAKE_BUILD_TYPE=Release \
8183
-D${driver_prefix}_BUILD_SHARED=On \
82-
-D${driver_prefix}_BUILD_STATIC=On \
8384
-D${driver_prefix}_BUILD_EXAMPLES=On \
8485
-D${driver_prefix}_BUILD_UNIT_TESTS=On \
8586
-D${driver_prefix}_BUILD_INTEGRATION_TESTS=${BUILD_INTEGRATION_TESTS} \
@@ -91,11 +92,13 @@ build_driver() {
9192

9293
check_driver_exports() {(
9394
set +e #Disable fail fast for this subshell
94-
local driver_library=${1}
95+
local driver_library="${1}.${LIB_SUFFIX}"
9596
if [ -f ${driver_library} ]; then
9697
declare -a MISSING_FUNCTIONS
98+
local symbols_file=$(mktemp /tmp/driver_exports.XXXXXX)
99+
nm ${driver_library} > $symbols_file
97100
for function in "${@:2}"; do
98-
nm ${driver_library} | grep ${function} > /dev/null
101+
grep ${function} $symbols_file > /dev/null
99102
if [ $? -ne 0 ]
100103
then
101104
MISSING_DEFINITION+=("${function}")

cpp-driver/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ if(CASS_BUILD_TESTS)
5555
endif()
5656

5757
if(CASS_BUILD_INTEGRATION_TESTS OR CASS_BUILD_UNIT_TESTS)
58-
set(CASS_BUILD_STATIC ON) # Required for tests
5958
set(CASS_USE_OPENSSL ON) # Required for tests
6059
set(CASS_USE_KERBEROS ON) # Required for tests
6160
endif()

cpp-driver/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ build:
4646
4747
FUNCTIONS+=($(grep -Eoh '(^cass_\s*(\w+)\s*\()|(^dse_\s*(\w+)\s*\()' include/dse.h | awk -F '(' '{print $1}'));
4848
FUNCTIONS+=($(grep -Eoh '^cass_\s*(\w+)\s*\(' include/cassandra.h | awk -F '(' '{print $1}'))
49-
check_driver_exports 'build/libcassandra_static.a' "${FUNCTIONS[@]}"
49+
check_driver_exports 'build/libcassandra' "${FUNCTIONS[@]}"
5050
5151
build/cassandra-unit-tests --gtest_output=xml:unit-test-results.xml
5252

cpp-driver/src/dse_auth.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
limitations under the License.
1515
*/
1616

17+
#include "dse.h"
18+
1719
#include "dse_auth.hpp"
1820
#include "logger.hpp"
1921

@@ -26,6 +28,21 @@ using namespace datastax;
2628
using namespace datastax::internal;
2729
using namespace datastax::internal::enterprise;
2830

31+
extern "C" {
32+
33+
CassError
34+
dse_gssapi_authenticator_set_lock_callbacks(DseGssapiAuthenticatorLockCallback lock_callback,
35+
DseGssapiAuthenticatorUnlockCallback unlock_callback,
36+
void* data) {
37+
#ifdef HAVE_KERBEROS
38+
return DseGssapiAuthenticator::set_lock_callbacks(lock_callback, unlock_callback, data);
39+
#else
40+
return CASS_ERROR_LIB_NOT_IMPLEMENTED;
41+
#endif
42+
}
43+
44+
} // extern "C"
45+
2946
bool DsePlainTextAuthenticator::initial_response(String* response) {
3047
if (class_name_ == DSE_AUTHENTICATOR) {
3148
response->assign(PLAINTEXT_AUTH_MECHANISM);

cpp-driver/src/gssapi/dse_auth_gssapi.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,6 @@ using namespace datastax::internal::enterprise;
4040
static void dse_gssapi_authenticator_nop_lock(void* data) {}
4141
static void dse_gssapi_authenticator_nop_unlock(void* data) {}
4242

43-
extern "C" {
44-
45-
CassError
46-
dse_gssapi_authenticator_set_lock_callbacks(DseGssapiAuthenticatorLockCallback lock_callback,
47-
DseGssapiAuthenticatorUnlockCallback unlock_callback,
48-
void* data) {
49-
return DseGssapiAuthenticator::set_lock_callbacks(lock_callback, unlock_callback, data);
50-
}
51-
52-
} // extern "C"
53-
5443
struct GssapiBuffer {
5544
public:
5645
gss_buffer_desc buffer;

0 commit comments

Comments
 (0)