You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: gpu tests link failure with static lib (#4137)
Summary:
# The bug
build gpu test with static lib failed undefined reference from gpu source code to cpu source, e.g.
`GpuAutoTune.cpp:(.text+0x3bc): undefined reference to 'typeinfo for faiss::Index'`
# build config:
`cmake -S . -B build -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -DFAISS_ENABLE_GPU=ON`
the link command would be like: `c++ -o faiss/gpu/test/TestCodePacking faiss/libfaiss.a -Wl,--push-state,--whole-archive faiss/gpu/libfaiss_gpu.a -Wl,--pop-state ...`
key point is linking to faiss_gpu after faiss which is a classic link order issue of "undefined reference"
# my fix:
make faiss_gpu an `OBJECT` library.
# Bouns
TestXXX files get small because '--whole-archive' propagated to test link command.
Pull Request resolved: #4137
Reviewed By: asadoughi
Differential Revision: D68639371
Pulled By: gtwang01
fbshipit-source-id: 1d482b4311f8e52de0d709b03348eae72c64c544
0 commit comments