From: Fyleo Message-ID: <75c20daf-b35f-116e-11c5-75f6fcfc10ed@gmail.com> Date: Mon, 29 May 2017 23:19:45 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: [Xenomai] dlopen failing when using shared library on xenomai 3.0.4 List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: xenomai@xenomai.org Hello all, I'm trying to port machinekit (machinekit.io) to xenomai 3.0.4 which support only xenomai 2.6.4 for the moment. This software is design this way : A : main executable B : shared library abstracting thread API, with one library for posix, for xenomai, ... The xenomai B library is linked against alchemy, copperplate, ... (xeno-config --ldflags --auto-init-solib --skin=alchemy) The program works in a way that, at start time, it load with dlopen the configured API (B). My problem is that dlopen(with RTLD_GLOBAL|RTLD_NOW) fail with the error : "/usr/lib/libcopperplate.so.0: undefined symbol: main" Here is the simplified test case to reproduce the problem : main.c: #include #include #include int main(int argc, char *const argv[]) { void *handle; handle = dlopen("./ulapi-xenomai.so", RTLD_GLOBAL|RTLD_NOW); if (!handle) { fprintf(stderr, "%s\n", dlerror()); exit(EXIT_FAILURE); } dlclose(handle); exit(EXIT_SUCCESS); } gcc main.c -o testcase -ldl gcc -Wl,-soname,ulapi-xenomai.so -shared -o ulapi-xenomai.so `xeno-config --ldflags --auto-init-solib --skin=alchemy` run testcase I am missing something or is there a solution that doesn't imply to use RTLD_LAZY ? my xeno-config --info Xenomai version: Xenomai/cobalt v3.0.4 Linux beaglebone 4.4.62-ti-xenomai-r105 #1 SMP Wed May 24 00:09:09 UTC 2017 armv7l GNU/Linux Kernel parameters: console=ttyO0,115200n8 capemgr.disable_partno=BB-BONELT-HDMI bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet I-pipe release #7 detected Cobalt core 3.0.4 detected Compiler: gcc version 4.9.2 (Debian 4.9.2-10) Build args: --prefix=/usr --includedir=/usr/include/xenomai --mandir=/usr/share/man --with-testdir=/usr/lib/xenomai/testsuite --enable-dlopen-libs --enable-smp --build arm-linux-gnueabihf build_alias=arm-linux-gnueabihf Regards, Fyleo