Ad Widget

Collapse

zabbix agent module compiled on Alpine causes symbol not found

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chace20
    Junior Member
    • Sep 2018
    • 1

    #1

    zabbix agent module compiled on Alpine causes symbol not found

    When I build a .so module in Alpine OS, I found that always some symbol not found caused compile fail. But it's normal in other platform(centOS, ubuntu).

    ```
    12158:20180913:074631.818 In zbx_load_modules()
    12158:20180913:074631.818 loading module "/home/zabbix/src/modules/zabbix_module_docker/zabbix_module_docker.so"
    12158:20180913:074631.822 cannot load module "zabbix_module_docker.so": Error relocating /home/zabbix/src/modules/zabbix_module_docker/zabbix_module_docker.so: zbx_strcpy_alloc: symbol not found
    12158:20180913:074631.822 End of zbx_load_modules():FAIL
    12158:20180913:074631.822 loading modules failed, exiting...

    ```

    Then I found it's because zabbix agent is compiled by static in Alpine, while compiled by dynamic in other platform. The`config.log` in Alpine is below. It seems `execinfo.h` is missed and check function is not work cause `-rdynamic` linking option is off.
    ```
    configure:7558: checking for -rdynamic linking option
    configure:7573: gcc -o conftest -g -O2 -rdynamic conftest.c -lm >&5
    conftest.c:108:22: fatal error: execinfo.h: No such file or directory
    compilation terminated.
    configure:7573: $? = 1
    configure: failed program was:
    | /* confdefs.h */
    | #define PACKAGE_NAME "Zabbix"
    | #define PACKAGE_TARNAME "zabbix"
    | #define PACKAGE_VERSION "3.4.12"
    | #define PACKAGE_STRING "Zabbix 3.4.12"
    ......
    | #define HAVE_PROC_CPUINFO 1
    | #define HAVE_PROC_LOADAVG 1
    | #define HAVE_PROC_NET_DEV 1
    | /* end confdefs.h. */
    | #include <execinfo.h>
    | int
    | main ()
    | {
    | void *bcktrc[6];
    | (void)backtrace(bcktrc, 6);
    | return 0;
    | }
    configure:7579: result: no

    ```

    After try, I found I can export a new environment variable LDFLAGS, and then run configure to force dynamic compile.
    ```
    export LDFLAGS="-rdynamic"
    ./configure --enable-agent

    ```

    Could zabbix team add a tip in [loadablemodules documentation](https://www.zabbix.com/documentation...oadablemodules), or do something else?
Working...