Skip to content

build: add support for clang-cl, add CI job - #1484

Closed
vszakats wants to merge 10 commits into
libssh2:masterfrom
vszakats:ci-clang-cl
Closed

vszakats wants to merge 10 commits into
libssh2:masterfrom
vszakats:ci-clang-cl

Conversation

@vszakats

@vszakats vszakats commented Oct 29, 2024 •

Copy link
Copy Markdown
Member
  • ci/appveyor: add clang-cl job.
  • ci/appvayor: optimize setting an env.
  • build: fix clang-cl builds.
  • build: fix -Wcast-function-type compiler warnings for OpenSSL 3.
  • build: use stdint.h with MSVC when supported.
  • src: use PRId64 for MSVC where supported.
  • src: avoid recursive macro definition for recv() and send().
  • session: silence -Wcast-function-type for libssh2_session_callback_set2().
    Sadly this function is still not fully warning-clean, and it
    seems we'd need separate setter-getters for each callback
    to avoid all warnings.

  • split to multiple PRs.

@vszakats vszakats added the build label Oct 29, 2024
@vszakats vszakats changed the title ci/appveyor: add clang-dl job ci/appveyor: add clang-cl job Oct 29, 2024
@vszakats
vszakats force-pushed the ci-clang-cl branch 16 times, most recently from ae76a6a to cdad06f Compare November 4, 2024 20:52
vszakats added a commit that referenced this pull request Nov 15, 2024
@vszakats
vszakats force-pushed the ci-clang-cl branch 3 times, most recently from d58eac3 to 5995cc6 Compare November 25, 2024 14:10
@vszakats
vszakats force-pushed the ci-clang-cl branch 3 times, most recently from 90de28c to d3c9b67 Compare January 30, 2025 00:04
vszakats added a commit that referenced this pull request Jan 31, 2025
…obs with tests

- add Linux jobs with old OpenSSL versions: 1.1.1, 1.1.0, 1.0.2, with
  tests.
  (Meaning we test these again after losing them in AppVeyor CI)
- add LibreSSL Linux job with tests.
- cache most dependency packages built from source.
  (exception: wolfSSL, which would have added too much complexity
  due to the multiple versions, and it's fast to build anyway.)
- change source tarball sources to GitHub for better stability and
  performance.
- move dependency versions to the env.
- set `persist-credentials: false` for checkout steps for security.
- pin actions to hash for security.
- checkout repo later, right before use.
- skip building BoringSSL tests to finish quicker.
- set `fail-fast: false` in the BSD build matrix.
- cmake: move UWP workaround from GHA to `CMakeLists.txt`, making it
  available for everyone.
- list installed packages in OpenBSD job.
- bump BoringSSL, mbedTLS, wolfSSL, OpenSSL.
- bump cross-platform-actions to v0.26.
- bump docker/build-push-action to v6.
- bump actions/upload-artifact to v4.
- bump NetBSD to 10.1.
- drop `--quiet 2` `apt-get` option to keep useful output.
- drop `--no-install-suggests --no-install-recommends` `apt-get`
  options. They are the defaults with the `ubuntu-24.04` image.
- tidy up quotes.

Cherry-picked from #1484

Closes #1528
vszakats added a commit that referenced this pull request Jan 31, 2025
vszakats added a commit that referenced this pull request Jan 31, 2025
Cherry-picked from #1484
vszakats added a commit that referenced this pull request Jan 31, 2025
vszakats added a commit that referenced this pull request Jan 31, 2025
Also:
- switch to non-deprecated alternative in examples.
- add pointers and deprecation warning to libssh2_scp_send man page.

Cherry-picked from #1484
vszakats added a commit that referenced this pull request Jan 31, 2025
vszakats added a commit that referenced this pull request Jan 31, 2025
@vszakats vszakats changed the title ci/appveyor: add clang-cl job ci/appveyor: add clang-cl job and make it build cleanly Jan 31, 2025
openssl formatting

use USE_OPENSSL_3
```
  In file included from C:\projects\libssh2\_builds\src\CMakeFiles\libssh2_static.dir\Unity\unity_0_c.c:46:
149C:/projects/libssh2/src/misc.c(162,10): error : disabled expansion of recursive macro [-Werror,-Wdisabled-macro-expansion] [C:\projects\libssh2\_builds\src\libssh2_static.vcxproj]
150C:/projects/libssh2/src/misc.c(53,27): message : expanded from macro 'recv' [C:\projects\libssh2\_builds\src\libssh2_static.vcxproj]
151C:/projects/libssh2/src/misc.c(201,10): error : disabled expansion of recursive macro [-Werror,-Wdisabled-macro-expansion] [C:\projects\libssh2\_builds\src\libssh2_static.vcxproj]
152C:/projects/libssh2/src/misc.c(54,27): message : expanded from macro 'send' [C:\projects\libssh2\_builds\src\libssh2_static.vcxproj]
```
https://ci.appveyor.com/project/libssh2org/libssh2/builds/50910997/job/rj8015to7ivll0up#L148
to fix this clang-cl fallout:
```
C:/projects/libssh2/src/scp.c(1050,22): error : 'I64' length modifier is not supported by ISO C [-Werror,-Wformat-non-iso] [C:\projects\libssh2\_builds\src\libssh2_static.vcxproj]
C:/projects/libssh2/src/libssh2_priv.h(1261,33): message : expanded from macro 'LIBSSH2_INT64_T_FORMAT' [C:\projects\libssh2\_builds\src\libssh2_static.vcxproj]
```
https://ci.appveyor.com/project/libssh2org/libssh2/builds/50911222/job/2550bjw5rf1mpgu5#L151
libssh2.h: fixup ssize_t for _MSC_VER
Sadly the 1.11.1-introduced new API is still not good enough.
It looks like individual APIs are necessary to set callbacks with
different prototypes.
@vszakats vszakats changed the title ci/appveyor: add clang-cl job and make it build cleanly ci/appveyor: add clang-cl job, make it build cleanly Jan 31, 2025
@vszakats vszakats changed the title ci/appveyor: add clang-cl job, make it build cleanly build: add support for clang-cl, add job to CI Jan 31, 2025
@vszakats vszakats changed the title build: add support for clang-cl, add job to CI build: add support for clang-cl, add CI job Jan 31, 2025
@vszakats vszakats closed this in 784446b Jan 31, 2025
@vszakats
vszakats deleted the ci-clang-cl branch January 31, 2025 04:14
vszakats added a commit that referenced this pull request Jun 7, 2026
Drop local worker functions, to avoid passing around function pointers,
with a local typedef that needs to be different (and matching upstream
exactly) dependening  on crypto backend/version and key type.

Also:
- fix ed25519 callback function for non-OpenSSL3.
  (detected by MSVC after dropping casts.)
- drop local compiler warning silencing.
- tried to use local macros. It saved 30 lines of code, but I opted for
  the simplicity/clarity of duplicating the BIO calls around each call.

Follow-up to 04ecdb2 #1972
Follow-up to 784446b #1484
Follow-up to b0ab005 #1207
Follow-up to 231a97a

Closes #1991
MingcongBai pushed a commit to AOSC-Tracking/libssh2 that referenced this pull request Jun 26, 2026
- enable compiler warning `-Wcast-qual`.
- add `LIBSSH2_UNCONST()` macro to strip const where absolutely
  necessary to avoid compiler warnings.
- fix const stripping by constifying where necessary.
- fix const stripping by using `LIBSSH2_UNCONST()`.
- libgcrypt.h: drop unnecessary casts.
- openssl: fix to use new `BIO_new_mem_buf()` parameter types
  with wolfSSL.

Cherry-picked from libssh2#1484
Closes libssh2#1527

Signed-off-by: Mingcong Bai <[email protected]>
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