tch-rs
                                
                                 tch-rs copied to clipboard
                                
                                    tch-rs copied to clipboard
                            
                            
                            
                        libgomp linked twice
When building against tch-sys, libgomp is linked twice:
$ ldd target/release/syntaxdot | grep libgomp
	libgomp.so.1 => /nix/store/9ilyrqidrjbqvmnn8ykjc7lygdd86g7q-gcc-10.2.0-lib/lib/libgomp.so.1 (0x00007f8bc2423000)
	libgomp-75eea7e8.so.1 => /nix/store/kmwv690gyslwrf9ymqwv9q2xadnhs7hr-libtorch-1.8.1/lib/libgomp-75eea7e8.so.1 (0x00007f8bc17d1000)
The first occurrence is added through the -lgomp flag added through build.rs. The second occurrence is the libgomp provided by libtorch itself:
$ readelf -d ${LIBTORCH}/lib/libtorch_cpu.so | grep libgomp
 0x0000000000000001 (NEEDED)             Shared library: [libgomp-75eea7e8.so.1]
However, I am wondering what the purpose of adding the -lgomp flag is. Because even when libtorch is built against system libraries, it will already have libgomp as one of its needed shared libraries:
$ readelf -d $(nix-build '<nixpkgs>' -A python3Packages.pytorch.lib)/lib/libtorch_cpu.so | grep gomp
 0x0000000000000001 (NEEDED)             Shared library: [libgomp.so.1]
So, adding the -lgomp linker flag only seems to have a negative side-effect that the OpenMP runtime is linked twice when it's already provided (such as in the upstream libtorch library).
I don't really remember why we need this. If you can test it for both the cpu and cuda version without this flag for the msvc period, happy to have it removed.