Neumann-A / my-vcpkg-triplets

my collection of vcpkg triplets
MIT License
70 stars 12 forks source link

What is the purpose of "VCPKG_USE_COMPILER_FOR_LINKAGE"? #16

Closed nickanthony-dgl closed 4 months ago

nickanthony-dgl commented 4 months ago

When trying to use the "x64-win-llvm-san-rel" triplet I get a failure on the "nlopt" port due to linker errors: install-x64-win-llvm-san-rel-rel-out_backup.log

I was able to resolve this issue by adding nlopt to the list of ports that do not support "VCPKG_USE_COMPILER_FOR_LINKAGE" in "extra_setup.cmake".

I am just opening this issue in hopes of getting a better understanding of why "VCPKG_USE_COMPILER_FOR_LINKAGE" is used in the first place and why it results in "duplicate symbol" linker errors in the case of nlopt.

Neumann-A commented 4 months ago

VCPKG_USE_COMPILER_FOR_LINKAGE avoids the need to specify the correct ASAN libs since the compiler will correctly invoke the linker with the required libs. This should in general be a bit more stable to compiler version changes compared to manually passing the required libs.

why it results in "duplicate symbol" linker errors in the case of nlopt.

That is something I cannot answer without knowing what exactly nlopt does and what the error is.

nickanthony-dgl commented 4 months ago

Thanks for the explanation. It looks like nlopt fails while linking a test .EXE due to multiple definitions of nlopt_nrand, nlopt_iurand, etc.