Repository navigation
Conversation
The `DLL_EXPORT` macro is automatically set by autotools when building the libssh2 DLL. Certain toolchains might require this to correctly export symbols, so make sure to respect it in `libssh2.h` to enable `declspec(dllexport)`. With this patch we have a manual macro for that (`LIBSSH2_EXPORT`), this autotools one, the CMake one, and `_WINDLL` (added in c355d31), possibly defined by Visual Studio.
vszakats
added a commit
to curl/curl-for-win
that referenced
this pull request
Jul 29, 2023
This libssh2 commit caused that when a dependent (like curl) is built in shared mode, libssh2 is also setup for shared mode linking (on Windows): libssh2/libssh2#917 libssh2/libssh2@fb1195c We want to link libssh2 statically to a shared libcurl, so force linking statically with `-DLIBSSH2_API=`. Another option is to revert the libssh2 change, though that doesn't seem correct in different ways. Or, to add support for `LIBSSH2_STATICLIB` in libssh2 to make the solution more obvious.
vszakats
added a commit
to vszakats/libssh2
that referenced
this pull request
Jul 29, 2023
Reverts fb1195c libssh2#917 On a second look this change did not improve anything with autotools builds. autotools seems to handle the dll export matter without it. On the other hand, this patch broke (e.g.) curl-for-win autotools builds, where the curl build defines `DLL_EXPORT` while building libcurl DLL. `libssh2.h` picks it up, resulting in unresolved symbols while trying to link a static libssh2. The best fix seems to be to revert this, instead of adding extra tweaks to dependents. Fixes: https://ci.appveyor.com/project/curlorg/curl-for-win/builds/47667412#L11035 ``` d.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_block_directions >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_do) >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_connect) >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_multi_statemach) >>> referenced 8 more times ld.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_init_ex >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_connect) ld.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_set_read_timeout [...] ``` Closes #xxxx
vszakats
added a commit
to curl/curl-for-win
that referenced
this pull request
Jul 29, 2023
…n [ci skip] This libssh2 commit caused that when a dependent (like curl) is built in shared mode with autotools on Windows, libssh2 is also setup for shared mode linking: libssh2/libssh2#917 libssh2/libssh2@fb1195c We want to link libssh2 statically to a shared libcurl, so force linking statically with `-DLIBSSH2_API=` as a workaround (which is equivalent to setting `-DLIBNAME_STATICLIB` as seen with other libs). Because the libssh2 commit turned out to be not useful anyway, I opted to revert it to avoid fallouts like this. PR: libssh2/libssh2#1141 Fixes: https://ci.appveyor.com/project/curlorg/curl-for-win/builds/47667412#L11035 ``` ld.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_block_directions >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_do) >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_connect) >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_multi_statemach) >>> referenced 8 more times ld.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_init_ex >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_connect) ld.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_set_read_timeout [...] ```
vszakats
added a commit
that referenced
this pull request
Jul 29, 2023
Revert fb1195c #917 On a second look this change did not improve anything with autotools builds. autotools seems to handle the dll export matter without it. This patch also broke (e.g.) curl-for-win autotools builds, where the curl build defines `DLL_EXPORT` while building libcurl DLL. `libssh2.h` picks it up, resulting in unresolved symbols while trying to link a static libssh2 on Windows. The best fix seems to be to revert this, instead of adding extra tweaks to dependents. Fixes: https://ci.appveyor.com/project/curlorg/curl-for-win/builds/47667412#L11035 ``` ld.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_block_directions >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_do) >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_connect) >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_multi_statemach) >>> referenced 8 more times ld.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_init_ex >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_connect) ld.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_set_read_timeout [...] ``` Closes #1141
lampmanyao
pushed a commit
to lampmanyao/libssh2
that referenced
this pull request
Sep 3, 2023
Revert fb1195c libssh2#917 On a second look this change did not improve anything with autotools builds. autotools seems to handle the dll export matter without it. This patch also broke (e.g.) curl-for-win autotools builds, where the curl build defines `DLL_EXPORT` while building libcurl DLL. `libssh2.h` picks it up, resulting in unresolved symbols while trying to link a static libssh2 on Windows. The best fix seems to be to revert this, instead of adding extra tweaks to dependents. Fixes: https://ci.appveyor.com/project/curlorg/curl-for-win/builds/47667412#L11035 ``` ld.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_block_directions >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_do) >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_connect) >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_multi_statemach) >>> referenced 8 more times ld.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_init_ex >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_connect) ld.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_set_read_timeout [...] ``` Closes libssh2#1141
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
The `DLL_EXPORT` macro is automatically set by autotools when building the libssh2 DLL. Certain toolchains might require this to correctly export symbols, so make sure to respect it in `libssh2.h` to enable `declspec(dllexport)`. With this patch we have a manual macro for that (`LIBSSH2_EXPORT`), this autotools one, the CMake one, and `_WINDLL` (added in c355d31), possibly defined by Visual Studio. Closes libssh2#917
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Revert fb1195c libssh2#917 On a second look this change did not improve anything with autotools builds. autotools seems to handle the dll export matter without it. This patch also broke (e.g.) curl-for-win autotools builds, where the curl build defines `DLL_EXPORT` while building libcurl DLL. `libssh2.h` picks it up, resulting in unresolved symbols while trying to link a static libssh2 on Windows. The best fix seems to be to revert this, instead of adding extra tweaks to dependents. Fixes: https://ci.appveyor.com/project/curlorg/curl-for-win/builds/47667412#L11035 ``` ld.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_block_directions >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_do) >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_connect) >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_multi_statemach) >>> referenced 8 more times ld.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_init_ex >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_connect) ld.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_set_read_timeout [...] ``` Closes libssh2#1141
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
DLL_EXPORTmacro is automatically set by autotools when building the libssh2 DLL. Certain toolchains might require this to correctly export symbols, so make sure to respect it inlibssh2.hto enabledeclspec(dllexport).With this patch we have a manual macro for that (
LIBSSH2_EXPORT), this autotools one, the CMake one, and_WINDLL(added in c355d31), possibly defined by Visual Studio.