oneapi-src / level-zero

oneAPI Level Zero Specification Headers and Loader
https://spec.oneapi.com/versions/latest/elements/l0/source/index.html
MIT License
208 stars 90 forks source link

Compilation fails with musl - ze_util.h: error: RTLD_DEEPBIND was not declared in this scope #81

Closed ConiKost closed 2 years ago

ConiKost commented 2 years ago

If level-zero is being compiled on a system with musl (glibc replacement), compilation will fail. You can get full log here: https://bugs.gentoo.org/828775


/usr/bin/x86_64-gentoo-linux-musl-g++ -DL0_LOADER_VERSION=\"1\" -DL0_VALIDATION_LAYER_SUPPORTED_VERSION=\"1\" -DLOADER_VERSION_MAJOR=1 -DLOADER_VERSION_MINOR=6 -DLOADER_VERSION_PATCH=2 -Dze_loader_EXPORTS -I/var/tmp/portage/dev-libs/level-zero-1.6.2/work/level-zero-1.6.2/include -I/var/tmp/portage/d
In file included from /var/tmp/portage/dev-libs/level-zero-1.6.2/work/level-zero-1.6.2/source/loader/ze_loader.h:15,
                 from /var/tmp/portage/dev-libs/level-zero-1.6.2/work/level-zero-1.6.2/source/loader/ze_loader.cpp:8:
/var/tmp/portage/dev-libs/level-zero-1.6.2/work/level-zero-1.6.2/source/loader/ze_loader.cpp: In member function 'ze_result_t loader::context_t::init()':
/var/tmp/portage/dev-libs/level-zero-1.6.2/work/level-zero-1.6.2/source/inc/ze_util.h:28:71: error: 'RTLD_DEEPBIND' was not declared in this scope
   28 | #  define LOAD_DRIVER_LIBRARY(NAME) dlopen(NAME, RTLD_LAZY|RTLD_LOCAL|RTLD_DEEPBIND)
      |                                                                       ^~~~~~~~~~~~~
/var/tmp/portage/dev-libs/level-zero-1.6.2/work/level-zero-1.6.2/source/loader/ze_loader.cpp:99:27: note: in expansion of macro 'LOAD_DRIVER_LIBRARY'
   99 |             auto handle = LOAD_DRIVER_LIBRARY( MAKE_LIBRARY_NAME( "ze_null", L0_LOADER_VERSION ) );
bmyates commented 2 years ago

RTLD_DEEPBIND is required for correct symbol resolution in L0 drivers that have L0 APIs in global namespace.

Does musl have an alternative way to enforce RTLD_DEEPBIND functionality?

ConiKost commented 2 years ago

It looks like, that RTLD_DEEPBIND isn't supported at all in musl. So I guess, there is no way to support musl in this case?

ConiKost commented 2 years ago

Yep, it does not. Closing here, as you say, it's a must, so we can't do anything here.