Page MenuHomePhabricator

MSVC issue with 0.9.2 static lib
Closed, ResolvedPublic

Description

See https://ci.appveyor.com/project/chcg/nppftp/build/job/1whm3b6uy2gsoyrw

ssh.lib(init.c.obj) : error LNK2005: DllMain already defined in PluginInterface.obj [C:\projects\nppftp\_build\NppFTP.vcxproj]
     Creating library C:/projects/nppftp/_build/Release/NppFTP.lib and object C:/projects/nppftp/_build/Release/NppFTP.exp
ssh.lib(session.c.obj) : warning LNK4217: locally defined symbol ssh_disconnect imported in function ssh_silent_disconnect [C:\projects\nppftp\_build\NppFTP.vcxproj]
ssh.lib(config_parser.c.obj) : warning LNK4049: locally defined symbol _ssh_log imported [C:\projects\nppftp\_build\NppFTP.vcxproj]
ssh.lib(packet_cb.c.obj) : warning LNK4049: locally defined symbol _ssh_log imported [C:\projects\nppftp\_build\NppFTP.vcxproj]
ssh.lib(messages.c.obj) : warning LNK4049: locally defined symbol _ssh_log imported [C:\projects\nppftp\_build\NppFTP.vcxproj]
ssh.lib(connector.c.obj) : warning LNK4049: locally defined symbol _ssh_log imported [C:\projects\nppftp\_build\NppFTP.vcxproj]
ssh.lib(ecdh.c.obj) : warning LNK4049: locally defined symbol _ssh_log imported [C:\projects\nppftp\_build\NppFTP.vcxproj]
ssh.lib(pki_ed25519_common.c.obj) : warning LNK4049: locally defined symbol _ssh_log imported [C:\projects\nppftp\_build\NppFTP.vcxproj]
...
...

There are two ssh.lib files. One at build\x64\obj\libssh-build\src (1496kB) and one at build\x64\obj\libssh-build\src\static (1493kB). The one in the static subfolder is ok, but the other one get installed by nmake install.

Build via:

cmake -G "NMake Makefiles" -DBUILD_STATIC_LIB=ON -DBUILD_SHARED_LIBS=OFF -DWITH_EXAMPLES=OFF -DWITH_SERVER=OFF -DCMAKE_BUILD_TYPE=Release                         "-DCMAKE_C_FLAGS_RELEASE=/MP /MT /O2 /Ob2 /D NDEBUG" "-DCMAKE_CXX_FLAGS_RELEASE=/MP /MT /O2 /Ob2 /D NDEBUG"                         -DOPENSSL_INCLUDE_DIRS=C:\projects\nppftp\_build\x64\3rdparty\include -DOPENSSL_CRYPTO_LIBRARY=C:\projects\nppftp\_build\x64\3rdparty\lib\libcrypto.lib                         -DCMAKE_INSTALL_PREFIX=C:\projects\nppftp\_build\x64\3rdparty -DCMAKE_PREFIX_PATH=C:\projects\nppftp\_build\x64\3rdparty C:\projects\nppftp\_build\x64\obj\libssh
nmake install

libssh is linked statically into Notepad++ plugin nppftp (https://github.com/ashkulz/NppFTP/pull/268)
The build via mingw is ok (https://travis-ci.org/ashkulz/NppFTP/builds/611080790?utm_source=github_status&utm_medium=notification)