Tests, examples fail to build with GGML_BACKEND_DL=ON
envgap__ggml-org__ggml-1120
01 / FAILURE SIGNATURE
As reported upstream
test-opt.cpp:(.text.startup+0xbf): undefined reference to `ggml_backend_is_cpu'
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
06b715f4c170232af261425240914fa49c44f982- Manifest
examples/CMakeLists.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
ggml-org/ggml #1120 · read the original issue
When building with `GGML_BACKEND_DL=ON`, linker failures start to appear. For example, from [test-opt.c:843](https://github.com/ggml-org/ggml/blob/master/tests/test-opt.cpp#L843): ```shell $ cmake -B build -DGGML_NATIVE=OFF -DGGML_BACKEND_DL=ON ... $ cmake --build build ... [ 25%] Building CXX object tests/CMakeFiles/test-opt.dir/test-opt.cpp.o [ 26%] Linking CXX executable ../bin/test-opt /usr/bin/ld: CMakeFiles/test-opt.dir/test-opt.cpp.o: in function `main': test-opt.cpp:(.text.startup+0xbf): undefined reference to `ggml_backend_is_cpu' /usr/bin/ld: test-opt.cpp:(.text.startup+0xd4): undefined reference to `ggml_backend_cpu_set_n_threads' collect2: error: ld returned 1 exit status gmake[2]: *** [tests/CMakeFiles/test-opt.dir/build.make:102: bin/test-opt] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:633: tests/CMakeFiles/test-opt.dir/all] Error 2 gmake: *** [Makefile:146: all] Error 2 ``` I was looking into a PR to fix this, but I'm not sure to best go about it, or if this even needs fixing because it's working as intended. Using the above example, when using `GGML_BACKEND_DL`, how would upstream guide to use `ggml_backend_cpu_set_n_threads` correctly? Should these be `dlsym`ed by the caller? My naive approach would have been to expect that there is some shim that takes care of this and that errors out when certain functionality is not available, which could be guarded by a `ggml_backend_is_<foo>`, but the latter two seems to be defined in the modules. But I'm not that familiar with the codebase yet, so perhaps this already exists.
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]