Skip to content

Building with CentOS causes libtorch linker errors #619

@ngrupen

Description

@ngrupen

CentOS 7.8.2003 (Core)
cmake version 3.18.4
clang version 10.0.1
Python 3.8.8

I have successfully built/run OpenSpiel + libtorch on macOS and Ubuntu, but am running into issues when building with CentOS. It is a lab cluster (more compute needed for complex games), so cuda is also installed in a non-standard location. I already fixed a few issues installing libtorch from source because of this (namely, this one) but am now stumped on some linker errors during the torch tests---or really anytime find_package(Torch REQUIRED) is used. I know this is really more of a libtorch issue, but I am curious if anyone else has solved this while building OpenSpiel, because the solution from the libtorch forums seems to be to use a different compiler (see solutions here and here). Of course, clang is required for OpenSpiel, so this is not an option in my case.

Anyways, here is the error:

/home/fs01/nag83/anaconda2/envs/spiel/bin/ld: /home/fs01/nag83/open_spiel/open_spiel/libtorch/libtorch/lib/libgomp-75eea7e8.so.1: undefined reference to `clock_gettime@GLIBC_2.17'
/home/fs01/nag83/anaconda2/envs/spiel/bin/ld: /home/fs01/nag83/open_spiel/open_spiel/libtorch/libtorch/lib/libgomp-75eea7e8.so.1: undefined reference to `clock_getres@GLIBC_2.17'
/home/fs01/nag83/anaconda2/envs/spiel/bin/ld: /home/fs01/nag83/open_spiel/open_spiel/libtorch/libtorch/lib/libc10.so: undefined reference to `memcpy@GLIBC_2.14'
/home/fs01/nag83/anaconda2/envs/spiel/bin/ld: /home/fs01/nag83/open_spiel/open_spiel/libtorch/libtorch/lib/libtorch_cpu.so: undefined reference to `lgammaf@GLIBC_2.23'
/home/fs01/nag83/anaconda2/envs/spiel/bin/ld: /home/fs01/nag83/open_spiel/open_spiel/libtorch/libtorch/lib/libtorch_cpu.so: undefined reference to `lgamma@GLIBC_2.23'
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [algorithms/dqn_torch/dqn_torch_test] Error 1
make[1]: *** [algorithms/dqn_torch/CMakeFiles/dqn_torch_test.dir/all] Error 2
/home/fs01/nag83/anaconda2/envs/spiel/bin/ld: /home/fs01/nag83/open_spiel/open_spiel/libtorch/libtorch/lib/libgomp-75eea7e8.so.1: undefined reference to `clock_gettime@GLIBC_2.17'
/home/fs01/nag83/anaconda2/envs/spiel/bin/ld: /home/fs01/nag83/open_spiel/open_spiel/libtorch/libtorch/lib/libgomp-75eea7e8.so.1: undefined reference to `clock_getres@GLIBC_2.17'
/home/fs01/nag83/anaconda2/envs/spiel/bin/ld: /home/fs01/nag83/open_spiel/open_spiel/libtorch/libtorch/lib/libc10.so: undefined reference to `memcpy@GLIBC_2.14'
/home/fs01/nag83/anaconda2/envs/spiel/bin/ld: /home/fs01/nag83/open_spiel/open_spiel/libtorch/libtorch/lib/libtorch_cpu.so: undefined reference to `lgammaf@GLIBC_2.23'
/home/fs01/nag83/anaconda2/envs/spiel/bin/ld: /home/fs01/nag83/open_spiel/open_spiel/libtorch/libtorch/lib/libtorch_cpu.so: undefined reference to `lgamma@GLIBC_2.23'
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [algorithms/alpha_zero_torch/torch_vpnet_test] Error 1
make[1]: *** [algorithms/alpha_zero_torch/CMakeFiles/torch_vpnet_test.dir/all] Error 2

Any advice is much appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions