aws-samples / aws-iot-securetunneling-localproxy

AWS Iot Secure Tunneling local proxy reference C++ implementation
https://docs.aws.amazon.com/iot/latest/developerguide/what-is-secure-tunneling.html
Apache License 2.0
74 stars 71 forks source link

Error in building localproxy in Windows #37

Closed yilin01 closed 3 years ago

yilin01 commented 3 years ago

I am trying to build localproxy in windows (x64) by following the steps in https://github.com/aws-samples/aws-iot-securetunneling-localproxy/blob/master/windows-localproxy-build.md

All the steps are completed successfully except the last step (msbuild localproxy.vcxproj -p:Configuration=Release). I am getting the following build error:

"c:\aws\aws-iot-securetunneling-localproxy\build\localproxy.vcxproj" (default target) (1) -> (Link target) -> TcpAdapterProxy.obj : error LNK2038: mismatch detected for 'boost_log_abi': value 'v2s_mt_nt6' doesn't match value 'v 2s_mt_nt5' in main.obj [c:\aws\aws-iot-securetunneling-localproxy\build\localproxy.vcxproj] libboost_log-vc141-mt-x64-1_69.lib(attribute_set.obj) : error LNK2038: mismatch detected for 'boost_log_abi': value ' v2s_mt_nt6' doesn't match value 'v2s_mt_nt5' in main.obj [c:\aws\aws-iot-securetunneling-localproxy\build\localproxy.vc xproj] libboost_log-vc141-mt-x64-1_69.lib(core.obj) : error LNK2038: mismatch detected for 'boost_log_abi': value 'v2s_mt_nt 6' doesn't match value 'v2s_mt_nt5' in main.obj [c:\aws\aws-iot-securetunneling-localproxy\build\localproxy.vcxproj] libboost_log-vc141-mt-x64-1_69.lib(default_attribute_names.obj) : error LNK2038: mismatch detected for 'boost_log_abi ': value 'v2s_mt_nt6' doesn't match value 'v2s_mt_nt5' in main.obj [c:\aws\aws-iot-securetunneling-localproxy\build\loc alproxy.vcxproj]

... ic initializer for 'log''(void)" (??__Elog@config_file@securedtunneling@iot@aws@@YAXXZ) [c:\aws\aws-iot-securetunnelin g-localproxy\build\localproxy.vcxproj] C:\aws\aws-iot-securetunneling-localproxy\build\bin\Release\localproxy.exe : fatal error LNK1120: 48 unresolved exter nals [c:\aws\aws-iot-securetunneling-localproxy\build\localproxy.vcxproj]

204 Warning(s)
80 Error(s) 

Any idea how to fix this issue?

kareali commented 3 years ago

Which windows version are you using? and could share the exact full command you used to install boost and the command you used to build the cmake project?

yilin01 commented 3 years ago

In order to do a clean installation, I created a new EC2 instance with windows server 2019 OS. I used the following command for Boost .\b2 toolset=msvc address-model=64 install define=BOOST_WINAPI_VERSION_WIN10

And I used the following command for cmake: cmake -DWIN32_WINNT=_WIN32_WINNT_WIN10 -DBoost_USE_STATIC_LIBS=ON -DCMAKE_PREFIX_PATH="C:\Boost;C:\Program Files (x86)\Catch2;C:\Program Files (x86)\protobuf;C:\Program Files\OpenSSL" -G "Visual Studio 15 2017 Win64" ..\

kareali commented 3 years ago

Could you try the following cmake command to build the project

cmake -DWIN32_WINNT=0x0A00 -DBoost_USE_STATIC_LIBS=ON -DCMAKE_PREFIX_PATH="C:\Boost;C:\Program Files (x86)\Catch2;C:\Program Files (x86)\protobuf;C:\Program Files\OpenSSL" -G "Visual Studio 15 2017 Win64" ..\
yilin01 commented 3 years ago

Thanks @KareemAliAWS , I just tried it and it can build successfully.

harikiran27 commented 1 year ago

Hi @kareali, is it possible to share the localproxy.exe file you built?😅 I have been trying to build it for days but end up with LNK2019 and LNK2001 errors.

main.obj : error LNK2019: unresolved external symbol "private: static unsigned int cdecl boost::log::v2s_mt_nt62::att ribute_name::get_id_from_string(char const *)" (?get_id_from_string@attribute_name@v2s_mt_nt62@log@boost@@CAIPEBD@Z) re ferenced in function "void cdecl init_logging(unsigned short &)" (?init_logging@@YAXAEAG@Z) [C:\Users\gh2\Downloads\b uilding_localproxy\aws-iot-securetunneling-localproxy\build\localproxy.vcxproj]

. . .

C:\Users\gh2\Downloads\building_localproxy\aws-iot-securetunneling-localproxy\build\bin\Release\localproxy.exe : fata l error LNK1120: 44 unresolved externals [C:\Users\gh2\Downloads\building_localproxy\aws-iot-securetunneling-localproxy \build\localproxy.vcxproj]

303 Warning(s) 92 Error(s)

Could you try the following cmake command to build the project

cmake -DWIN32_WINNT=0x0A00 -DBoost_USE_STATIC_LIBS=ON -DCMAKE_PREFIX_PATH="C:\Boost;C:\Program Files (x86)\Catch2;C:\Program Files (x86)\protobuf;C:\Program Files\OpenSSL" -G "Visual Studio 15 2017 Win64" ..\

I also tried this, but didn't help. Any help in solving the error would also be great!