Compile works on Linux, not Windows

When I compile my program on Linux, it runs as expected. However, when i try to on Windows, I get this error that I can't seem to fix:

(tl;dr error):

error: linking with `link.exe` failed: exit code: 1169
error LNK2005: sha3_512_inc_init already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: sha3_512_inc_absorb already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o)

Full Error:

{"reason":"compiler-message","package_id":"hyxe_user 0.1.0 (path+file:///C:/hyxe_wave/hyxe_user)","target":{"kind":["test"],"crate_types":["bin"],"name":"primary","src_path":"C:\\hyxe_wave\\hyxe_user\\tests\\primary.rs","edition":"2018","doctest":false},"message":{"rendered":"error: linking with `link.exe` failed: exit code: 1169\n  |\n  = note: \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2017\\\\Enterprise\\\\VC\\\\Tools\\\\MSVC\\\\14.16.27023\\\\bin\\\\HostX64\\\\x64\\\\link.exe\" \"/NOLOGO\" \"/NXCOMPAT\" \"/LIBPATH:C:\\\\Users\\\\tbrau\\\\.rustup\\\\toolchains\\\\nightly-x86_64-pc-windows-msvc\\\\lib\\\\rustlib\\\\x86_64-pc-windows-msvc\\\\lib\" \"C:\\\\hyxe_wave\\\\target\\\\debug\\\\deps\\\\primary-04405a5c7d13b802.106d73h0y1p28n5t.rcgu.o\" \"C:\\\\hyxe_wave\\\\target\\\\debug\\\\deps\\\\primary-04405a5c7d13b802.11pz7ff7rdzcd3ru.rcgu.o\" \"C:\\\\hyxe_wave\\\\target\\\\debug\\\\deps\\\\primary-04405a5c7d13b802.12zugmmf4au7f3y6.rcgu.o\" \"C:\\\\hyxe_wave\\\\target\\\\debug\\\\deps\\\\primary-04405a5c7d13b802.13a1w41d97r84w3g.rcgu.o\" \"C:\\\\hyxe_wave\\\\target\\\\debug\\\\deps\\\\primary-04405a5c7d13b802.14fvg9ae7d1dqgz6.rcgu.o\" \"C:\\\\hyxe_wave\\\\target\\\\debug\\\\deps\\\\primary-04405a5c7d13b802.15nqtjcj767d86is.rcgu.o\" \"C:\\\\hyxe_wave\\\\target\\\\debug\\\\deps\\\\primary-04405a5c7d13b802.15oe8djy79o2gcmb.rcgu.o\" \"C:\\\\hyxe_wave\\\\target\\\\debug\\\\deps\\\\primary-04405a5c7d13b802.164xbxwaohh4yzli.rcgu.o\" \"C:\\\\hyxe_wave\\\\target\\\\debug\\\\deps\\\\primary-04405a5c7d13b802.17gna51kr4u3rpdj.rcgu.o\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-classicmceliece-09e3348f9ba4b5ac\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-dilithium-bdb2797a7ce60027\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-dilithium-bdb2797a7ce60027\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-dilithium-bdb2797a7ce60027\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-dilithium-bdb2797a7ce60027\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-falcon-94867070eaf9e8c6\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-falcon-94867070eaf9e8c6\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-falcon-94867070eaf9e8c6\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-frodo-2936a2b12343d2f6\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-frodo-2936a2b12343d2f6\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-frodo-2936a2b12343d2f6\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-frodo-2936a2b12343d2f6\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-frodo-2936a2b12343d2f6\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\
debug\\\\build\\\\pqcrypto-frodo-2936a2b12343d2f6\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-frodo-2936a2b12343d2f6\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-frodo-2936a2b12343d2f6\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-frodo-2936a2b12343d2f6\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-frodo-2936a2b12343d2f6\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-frodo-2936a2b12343d2f6\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-frodo-2936a2b12343d2f6\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-frodo-2936a2b12343d2f6\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-hqc-bd45b7d119b9d04c\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-hqc-bd45b7d119b9d04c\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-hqc-bd45b7d119b9d04c\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-hqc-bd45b7d119b9d04c\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-hqc-bd45b7d119b9d04c\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-hqc-bd45b7d119b9d04c\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-hqc-bd45b7d119b9d04c\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-kyber-2da0e4ba0d3091cb\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-kyber-2da0e4ba0d3091cb\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-kyber-2da0e4ba0d3091cb\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-kyber-2da0e4ba0d3091cb\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-kyber-2da0e4ba0d3091cb\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-kyber-2da0e4ba0d3091cb\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-kyber-2da0e4ba0d3091cb\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-ledacryptkem-413e4c2cfcdcaa8f\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-ledacryptkem-413e4c2cfcdcaa8f\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-ledacryptkem-413e4c2cfcdcaa8f\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\
pqcrypto-ledacryptkem-413e4c2cfcdcaa8f\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-mqdss-b2480caceca315a4\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-mqdss-b2480caceca315a4\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-mqdss-b2480caceca315a4\\\\out\" \"/LIBPATH:C:\\\\hyxe_wave\\\\target\\\\debug\\\\build\\\\pqcrypto-newhope-1c636eac07448132\\\\out\" d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: shake128_squeezeblocks already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: shake128_inc_init already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: shake128_inc_absorb already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: shake128_inc_finalize already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: shake128_inc_squeeze already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: shake256_absorb already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlib
pqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: shake256_squeezeblocks already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: shake256_inc_init already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: shake256_inc_absorb already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: shake256_inc_finalize already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: shake256_inc_squeeze already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: shake128 already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: shake256 already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: sha3_256_inc_init already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: sha3_256_inc_absorb already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: sha3_256_inc_finalize already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: sha3_256 already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: sha3_384_inc_init already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: sha3_384_inc_absorb already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: sha3_384_inc_finalize already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: sha3_384 already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e
68eddd8c6bef5.rlib(fips202.o) : error LNK2005: sha3_512_inc_init already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: sha3_512_inc_absorb already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: sha3_512_inc_finalize already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nlibpqcrypto_newhope-d5e68eddd8c6bef5.rlib(fips202.o) : error LNK2005: sha3_512 already defined in libpqcrypto_threebears-d03df1b8fd0970e6.rlib(fips202.o)\r\nC:\\hyxe_wave\\target\\debug\\deps\\primary-04405a5c7d13b802.exe : fatal error LNK1169: one or more multiply defined symbols found\r\n","rendered":null,"spans":[]}],"code":null,"level":"error","message":"linking with `link.exe` failed: exit code: 1169","spans":[]}}
error: aborting due to previous error

error: could not compile `hyxe_user`.
To learn more, run the command again with --verbose.

Process finished with exit code 101

It's weird, because the program use to compile 2-3 months ago. After taking that long of a break, I updated rustc through rustup, and then I encounter this error. Of course, I tried reinstalling rust and reverted to the working version, but I still get the problem. I don't know what to do

Windows rust version:

nightly-2020-01-25-x86_64-pc-windows-gnu installed - rustc 1.42.0-nightly (c2d141df5 2020-01-24)

Linux:

nightly-2020-01-25-x86_64-unknown-linux-gnu

Check your dependency tree. You probably have incompatible versions of some of the pqcrypto crates. Don't know if I can offer any more advice than that, given just an error message.

2 Likes

cargo tree -d finds these (requires cargo install cargo-tree)

2 Likes

I couldn't find any dependency cycles, so I am using a new version of pqcrypto pulled straight from git. It compiles and runs fine on Linux, but with windows, it appears the custom compile process using gcc is running into some problems:

cargo:warning=gcc.exe: error: pqclean/common\aes.c: No such file or directory
cargo:warning=gcc.exe: fatal error: no input files
cargo:warning=compilation terminated.
exit code: 1
running: "gcc.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "pqclean/common" "-Wall" "-Wextra" "-std=c99" "-o" "C:\\hyxe_wave\\target\\debug\\build\\pqcrypto-qtesla-1a419fa1873d1b50\\out\\pqclean/common\\randombytes.o" "-c" "pqclean/common\\randombytes.c"
cargo:warning=gcc.exe: error: pqclean/common\sha2.c: No such file or directory
cargo:warning=gcc.exe: fatal error: no input files
cargo:warning=compilation terminated.
exit code: 1
cargo:warning=gcc.exe: error: pqclean/common\fips202.c: No such file or directory
cargo:warning=gcc.exe: fatal error: no input files
cargo:warning=compilation terminated.
cargo:warning=gcc.exe: error: pqclean/common\randombytes.c: No such file or directory
cargo:warning=gcc.exe: fatal error: no input files
cargo:warning=compilation terminated.

I am using MinGW (pointer in $PATH) for the compilation. Has anyone encountered a similar error before?

If one wishes to reproduce the error, try adding this line as a dependency in cargo.toml:

pqcrypto = { git = "https://github.com/rustpq/pqcrypto" }

Pqcrypto requires the compilation of a C library, thus the use of gcc. I have tried using both MinGW and Msys compilers, but both have returned the same error.