Skip to content

QuickJSR 1.8.0 undefined atomic_fetch_add symbol with Rv4.5.0 #89

@sfishback

Description

@sfishback

I cannot figure out why this module will not install on R v4.5.0 with gcc v12.2.0 on rhel9.

$ R CMD INSTALL QuickJSR_1.8.0.tar.gz

  • installing to library ‘/nas/rhel9/apps/r/4.5.0/lib64/R/library’
  • installing source package ‘QuickJSR’ ...
    ** this is package ‘QuickJSR’ version ‘1.8.0’
    ** package ‘QuickJSR’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs
    using C compiler: ‘gcc (GCC) 12.2.0’
    using C++ compiler: ‘g++ (GCC) 12.2.0’
    gcc -I"/nas/rhel9/apps/r/4.5.0/lib64/R/include" -DNDEBUG -I"../inst/include/" -I"quickjs" -D_GNU_SOURCE -I/usr/local/include -fpic -g -O2 -funsigned-char -std=gnu11 -c libquickjs.c
    In file included from libquickjs.c:5:
    quickjs/quickjs.c: In function ‘js_atomics_op’:
    quickjs/quickjs.c:56641:17: warning: implicit declaration of function ‘atomic_fetch_add’ [-Wimplicit-function-declaration]
    56641 | OP(ADD, atomic_fetch_add)
    | ^~~~~~~~~~~~~~~~
    quickjs/quickjs.c:56630:12: note: in definition of macro ‘OP’
    56630 | a = func_name((_Atomic uint8_t *)ptr, v);
    | ^~~~~~~~~
    quickjs/quickjs.c:56642:17: warning: implicit declaration of function ‘atomic_fetch_and’ [-Wimplicit-function-declaration]
    56642 | OP(AND, atomic_fetch_and)
    | ^~~~~~~~~~~~~~~~
    quickjs/quickjs.c:56630:12: note: in definition of macro ‘OP’
    56630 | a = func_name((_Atomic uint8_t *)ptr, v);
    | ^~~~~~~~~
    quickjs/quickjs.c:56643:16: warning: implicit declaration of function ‘atomic_fetch_or’ [-Wimplicit-function-declaration]
    56643 | OP(OR, atomic_fetch_or)
    | ^~~~~~~~~~~~~~~
    quickjs/quickjs.c:56630:12: note: in definition of macro ‘OP’
    56630 | a = func_name((_Atomic uint8_t *)ptr, v);
    | ^~~~~~~~~
    quickjs/quickjs.c:56644:17: warning: implicit declaration of function ‘atomic_fetch_sub’ [-Wimplicit-function-declaration]
    56644 | OP(SUB, atomic_fetch_sub)
    | ^~~~~~~~~~~~~~~~
    quickjs/quickjs.c:56630:12: note: in definition of macro ‘OP’
    56630 | a = func_name((_Atomic uint8_t *)ptr, v);
    | ^~~~~~~~~
    quickjs/quickjs.c:56645:17: warning: implicit declaration of function ‘atomic_fetch_xor’ [-Wimplicit-function-declaration]
    56645 | OP(XOR, atomic_fetch_xor)
    | ^~~~~~~~~~~~~~~~
    quickjs/quickjs.c:56630:12: note: in definition of macro ‘OP’
    56630 | a = func_name((_Atomic uint8_t *)ptr, v);
    | ^~~~~~~~~
    quickjs/quickjs.c:56646:22: warning: implicit declaration of function ‘atomic_exchange’ [-Wimplicit-function-declaration]
    56646 | OP(EXCHANGE, atomic_exchange)
    | ^~~~~~~~~~~~~~~
    quickjs/quickjs.c:56630:12: note: in definition of macro ‘OP’
    56630 | a = func_name((_Atomic uint8_t *)ptr, v);
    | ^~~~~~~~~
    quickjs/quickjs.c:56650:13: warning: implicit declaration of function ‘atomic_load’ [-Wimplicit-function-declaration]
    56650 | a = atomic_load((_Atomic uint8_t *)ptr);
    | ^~~~~~~~~~~
    quickjs/quickjs.c:56664:13: warning: implicit declaration of function ‘atomic_compare_exchange_strong’ [-Wimplicit-function-declaration]
    56664 | atomic_compare_exchange_strong((_Atomic uint8_t *)ptr, &v1, rep_val);
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    quickjs/quickjs.c: In function ‘js_atomics_store’:
    quickjs/quickjs.c:56749:9: warning: implicit declaration of function ‘atomic_store’; did you mean ‘js_atomics_store’? [-Wimplicit-function-declaration]
    56749 | atomic_store((_Atomic uint64_t *)ptr, v64);
    | ^~~~~~~~~~~~
    | js_atomics_store
    g++ -std=gnu++17 -I"/nas/rhel9/apps/r/4.5.0/lib64/R/include" -DNDEBUG -I"../inst/include/" -I"quickjs" -D_GNU_SOURCE -I/usr/local/include -fpic -g -O2 -c quickjsr.cpp -o quickjsr.o
    g++ -std=gnu++17 -I"/nas/rhel9/apps/r/4.5.0/lib64/R/include" -DNDEBUG -I"../inst/include/" -I"quickjs" -D_GNU_SOURCE -I/usr/local/include -fpic -g -O2 -c init.cpp -o init.o
    g++ -std=gnu++17 -shared -L/nas/rhel9/apps/r/4.5.0/lib64/R/lib -L/usr/local/lib64 -o QuickJSR.so quickjsr.o init.o libquickjs.o -L/nas/rhel9/apps/r/4.5.0/lib64/R/lib -lR
    installing to /nas/rhel9/apps/r/4.5.0/lib64/R/library/00LOCK-QuickJSR/00new/QuickJSR/libs
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded from temporary location
    Error: package or namespace load failed for ‘QuickJSR’ in dyn.load(file, DLLpath = DLLpath, ...):
    unable to load shared object '/nas/rhel9/apps/r/4.5.0/lib64/R/library/00LOCK-QuickJSR/00new/QuickJSR/libs/QuickJSR.so':
    /nas/rhel9/apps/r/4.5.0/lib64/R/library/00LOCK-QuickJSR/00new/QuickJSR/libs/QuickJSR.so: undefined symbol: atomic_fetch_add
    Error: loading failed
    Execution halted
    ERROR: loading failed
  • removing ‘/nas/rhel9/apps/r/4.5.0/lib64/R/library/QuickJSR’

When I manually compile the code works fine. And the atomic_fetch_add symbol is there.

$ nm QuickJSR.so | \grep atomic_fetch
U atomic_fetch_add
U atomic_fetch_and
U atomic_fetch_or
U atomic_fetch_sub
U atomic_fetch_xor

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions