Skip to content

Conversation

vszakats
Copy link
Member

@vszakats vszakats commented 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

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 vszakats added the build label Jul 29, 2023
@vszakats vszakats changed the title build: revert: respect autotools DLL_EXPORT in libssh2.h revert: build: respect autotools DLL_EXPORT in libssh2.h Jul 29, 2023
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 vszakats closed this in 481be04 Jul 29, 2023
@vszakats vszakats deleted the revert-DLL_EXPORT branch July 29, 2023 23:53
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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant