<div dir="ltr">Hello all,<br><div class="gmail_quote"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><br></div><div>After reading CMake Cookbook I have written my first "complex" CMake build script based on the superbuild pattern. I am excited to heave a better understanding on CMake, but I definitely will learn much more from experience and your kind help.</div><div>In summary, the standalone google test application `standalone_gtests` publicly links to `libdatareader.so` and to pytorch libraries (`libc10.so`,`libcafee2.so`, `libtorch.so`).</div><div>`libdatareader.so` also publicly links to pytorch libraries (I have a theoretical question on why `standalone_gtests` had to link to pytorch libraries if `libdatareader.so` already did, but that can wait).</div><div><br></div><div>Compilation finishes successfully, but when I try to run `standalone_gtests`, it aborts because it cant find `libc10.so`. </div><div>After executing `ldd standalone_gtests`, the weird result was that there were two entries for `libc10.so`. </div><div>The first one maps to "not found" while the second had the correct path to the library. `libcaffe2.so`, which is also a pytorch library, has a single occurrence with full path.</div><div>If I add the (...)/pytorch_external/(...) (see ldd output below) path to LD_LIBRARY_PATH, then everything works, but I would like to avoid this, if possible.</div><div><br></div><div>`ldd ./subprojects/Build/datareaders_core_test/standalone_gtests </div><div><div><span class="m_6325779115560189611gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>libdatareader.so => /home/dev/miniconda3/datareaders_py37/build/stage/datareader/lib/libdatareader.so<br></div><div><span class="m_6325779115560189611gmail-Apple-tab-span" style="white-space:pre-wrap">   l</span>ibcaffe2.so => /home/dev/miniconda3/datareaders_py37/build/subprojects/Source/pytorch_external/torch/lib/libcaffe2.so</div><div><span class="m_6325779115560189611gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>libc10.so => not found</div><div><span class="m_6325779115560189611gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>libc10.so => /home/dev/miniconda3/datareaders_py37/build/subprojects/Source/pytorch_external/torch/lib/libc10.so</div><div>(...)`</div></div><div><br></div><div>Have anyone seen multiple entries for the same library on ldd before? Why is that? Is it because `standalone_gtests` links to libc10.so and to `libdatareader.so`, which in turn also links to `libc10.so`?</div><div>Both CMakeLists.txt (libdatareader and standalone_gtests) succeeds at find_package(Torch REQUIRED QUIET) commands (${TORCH_LIBRARY} returns the correct path).</div><div><br></div><div><br></div><div>I run the same build on my Mac and everything works fine, so that is confined to linux environment. I have destroyed my conda environment and performed multiple clean builds in the process and no luck :(</div><div>Hoping this was some sort of ldconfig issue, I tried `sudo ldconfig` and `sudo rm /etc/ld.so.cache`, but that doesn't fix it.<br></div><div dir="ltr" class="m_6325779115560189611gmail_signature"><div dir="ltr"><div><div dir="ltr"><br></div><div>Any ideas?</div><div><br></div><div dir="ltr"><div></div>best regards,</div><div dir="ltr">Thiago</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>