eclipse / paho.mqtt.rust

paho.mqtt.rust
Other
516 stars 102 forks source link

compiling example dyn_subscribe #172

Closed thepperson closed 1 year ago

thepperson commented 1 year ago

I am trying to compile the dyn_sbuscribe example, but am running into a linking issue. I am using MSVC for the build.

note: libcrypto.lib(libcrypto-lib-cryptlib.obj) : error LNK2019: unresolved external symbol imp_GetProcessWindowStation referenced in function OPENSSL_isservice
libcrypto.lib(libcrypto-lib-cryptlib.obj) : error LNK2019: unresolved external symbol
imp_GetUserObjectInformationW referenced in function OPENSSL_isservice libcrypto.lib(libcrypto-lib-cryptlib.obj) : error LNK2019: unresolved external symbol __imp_MessageBoxW referenced in function OPENSSL_showfatal

fpagliughi commented 1 year ago

Which version of...

thepperson commented 1 year ago

Windows 10, Visual Studio 2022, openssl 3.0.5 (installed with vcpkg)

fpagliughi commented 1 year ago

Thanks. I'll try the Windows builds this week.

A quick Internet search finds a similar complaint in another Rust library: https://github.com/OSSystems/compress-tools-rs/issues/57

Their fix seems to be manually linking in the Windows library in build.rs, like:

println!("cargo:rustc-link-lib=User32");

I wonder if that would work for us.

fpagliughi commented 1 year ago

I wasn't able to recreate the problem - possibly because I haven't upgraded to VS 2022 yet (?). But I added the line to the build file to link in User32 on Windows. Hopefully that helps.