Skip to content

Commit 6bd74a6

Browse files
committed
PS-10166 [8.0]: Improve stability of component_keyring_file.dynamic_loading
On some platforms we see the following issue: ``` CURRENT_TEST: component_keyring_file.dynamic_loading /usr/bin/ld: /tmp/ccg7pao0.o: in function main::{lambda(void*)#1}::operator()(void*) const': dlopen_checker.cpp:(.text+0x1f): undefined reference to dlclose' /usr/bin/ld: /tmp/ccg7pao0.o: in function main': dlopen_checker.cpp:(.text+0xa9): undefined reference to dlopen' /usr/bin/ld: dlopen_checker.cpp:(.text+0xf8): undefined reference to dlerror' collect2: error: ld returned 1 exit status mysqltest: At line 20: Command "g++ -std=c++17 -ldl -o $dlopen_checker_binary $dlopen_checker_source" failed. ``` This error occurs because the linker flag -ldl (for linking against the dynamic loading library, libdl) is placed before the source file instead of after it in your g++ command. In GCC and Clang, order matters — libraries must come after the objects or source files that reference them.
1 parent 82a1d2e commit 6bd74a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mysql-test/include/keyring_tests/mats/dynamic_loading.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
--let $dlopen_checker_binary = $MYSQL_TMP_DIR/dlopen_checker
1818

1919
--echo *** Building dlopen_checker utility
20-
--exec g++ -std=c++17 -ldl -o $dlopen_checker_binary $dlopen_checker_source
20+
--exec g++ -std=c++17 -o $dlopen_checker_binary $dlopen_checker_source -ldl
2121

2222
--echo *** Checking for unresolved symbols
2323
--replace_result $DLOPEN_CHECKER_LIBRARY_PATH <LIBRARY_PATH>

0 commit comments

Comments
 (0)