Skip to content

[backend_cuda] Unable to import the CUDA backend (FMT linkage)

Description

I'm currently unable to work with the CUDA backend, because of an issue with the linkage of fmt.

Here is the log when i try to import aidge_backend_cuda :

Traceback (most recent call last):
  File "/data1/is156025/bh277217/workspace/dev_cuda/test-backend.py", line 7, in <module>
    import aidge_backend_cuda
  File "/data1/is156025/bh277217/miniconda3/envs/main/lib/python3.10/site-packages/aidge_backend_cuda/__init__.py", line 1, in <module>
    from aidge_backend_cuda.aidge_backend_cuda import *  # import so generated by PyBind
ImportError: /data1/is156025/bh277217/miniconda3/envs/main/lib/python3.10/site-packages/aidge_backend_cuda/aidge_backend_cuda.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZNK3fmt3v106detail10locale_ref3getISt6localeEET_v

I attempted to manually link fmt using the following snippet :

Include(FetchContent)
FetchContent_Declare(
    fmt
    GIT_REPOSITORY https://github.com/fmtlib/fmt.git
    GIT_TAG        10.2.1 # or a later release
)
set(FMT_SYSTEM_HEADERS ON)
FetchContent_MakeAvailable(fmt)
set_property(TARGET fmt PROPERTY POSITION_INDEPENDENT_CODE ON)

# ...

target_link_libraries(${module_name} PUBLIC fmt::fmt)

But it creates a conflict :

  CMake Error at build/_deps/fmt-src/CMakeLists.txt:288 (add_library):
    add_library cannot create ALIAS target "fmt::fmt" because another target
    with the same name already exists.


  CMake Error at build/_deps/fmt-src/CMakeLists.txt:340 (add_library):
    add_library cannot create ALIAS target "fmt::fmt-header-only" because
    another target with the same name already exists.

Any help would be appreciated !

EDIT : @olivierbichler Any idea about this ? :)

Edited by Benjamin Halimi