Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix -Wcast-function-type build issues #1972

Merged
merged 2 commits into from
Nov 8, 2024
Merged

Conversation

vszakats
Copy link
Contributor

@vszakats vszakats commented Nov 6, 2024

Issues:

Resolves #1971

Description of changes:

Call-outs:

Testing:

I build-tested both changes.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

```
crypto/rand_extra/windows.c:68:22: error: cast from 'FARPROC' (aka 'long long (*)()')
to 'ProcessPrngFunction' (aka 'int (*)(unsigned char *, unsigned long long)') converts
to incompatible function type [-Werror,-Wcast-function-type-mismatch]
   68 |   g_processprng_fn = (ProcessPrngFunction)GetProcAddress(hmod, "ProcessPrng");
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Fixes aws#1971
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.75%. Comparing base (0cfd3ed) to head (9e785fe).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1972      +/-   ##
==========================================
- Coverage   78.77%   78.75%   -0.03%     
==========================================
  Files         590      590              
  Lines      101482   101482              
  Branches    14396    14394       -2     
==========================================
- Hits        79945    79918      -27     
- Misses      20902    20928      +26     
- Partials      635      636       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

vszakats added a commit to curl/curl-for-win that referenced this pull request Nov 7, 2024
Experimental. Not working.

The goal is to make it possible to test and compare it with BoringSSL.

Also:

- disable Perl (it's not present on Alpine by default).
  Needed for FIPS only.

- add new Windows-specific AWS-LC build issue where it force-sets
  `_WIN32_WINNT` to Win7.

- address the above by patching out `_WIN32_WINNT` force-set.

- address the above by bumping Windows target to Win7.
  Yet to be seen if this is a true requirement or an arbitrary
  value that's newer than the default they intended to avoid in
  some mingw builds.

- fix clang 19? deprecation warning triggered in mingw-w64 builds
  ```
  /usr/lib/llvm-19/lib/clang/19/include/mm3dnow.h:16:2: error: "The <mm3dnow.h> header is deprecated, and 3dNow! intrinsics are unsupported. For other intrinsics, include <x86intrin.h>, instead." [-Werror,-W#warnings]
     16 | #warning "The <mm3dnow.h> header is deprecated, and 3dNow! intrinsics are unsupported. For other intrinsics, include <x86intrin.h>, instead."
        |  ^
  1 error generated.
  ```
  https://github.com/curl/curl-for-win/actions/runs/11714432529/job/32629108727#step:3:4286

- patch AWS-LC to avoid `-Werror,-Wcast-function-type-mismatch`
  on Windows:
  ```
  /path/to/awslc/crypto/rand_extra/windows.c:68:22: error: cast from 'FARPROC' (aka 'long long (*)()')
  to 'ProcessPrngFunction' (aka 'int (*)(unsigned char *, unsigned long long)') converts
  to incompatible function type [-Werror,-Wcast-function-type-mismatch]
     68 |   g_processprng_fn = (ProcessPrngFunction)GetProcAddress(hmod, "ProcessPrng");
        |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  ```
  https://github.com/curl/curl-for-win/actions/runs/11712448493/job/32623148501#step:3:3996
  Upstream report and patch:
  aws/aws-lc#1971
  aws/aws-lc#1972

Unfixed issues:

- curl cmake is trying and failing to detect ECH support:
  ```
  -- Looking for SSL_set1_ech_config_list - not found
  [...]
           "/usr/bin/ld.lld-19" --sysroot=/usr/x86_64-w64-mingw32 -m i386pep -Bdynamic -o cmTC_d97c0.exe /usr/x86_64-w64-mingw32/lib/crt2.o /usr/x86_64-w64-mingw32/lib/crtbegin.o -L/usr/lib/gcc/x86_64-w64-mingw32/13-posix -L/usr/x86_64-w64-mingw32/x86_64-w64-mingw32/lib -L/usr/x86_64-w64-mingw32/x86_64-w64-mingw32/mingw/lib -L/usr/x86_64-w64-mingw32/lib -lucrt -Xlink=-cetcompat --gc-sections --icf=all -s -Bstatic -Map curl.map -lpthread CMakeFiles/cmTC_d97c0.dir/CheckSymbolExists.c.obj --out-implib libcmTC_d97c0.dll.a --major-image-version 0 --minor-image-version 0 /home/runner/work/curl-for-win/curl-for-win/awslc/_x64-win-ucrt/usr/lib/libssl.a /home/runner/work/curl-for-win/curl-for-win/awslc/_x64-win-ucrt/usr/lib/libcrypto.a /home/runner/work/curl-for-win/curl-for-win/zlib/_x64-win-ucrt/usr/lib/libz.a -lws2_32 -lbcrypt -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -lkernel32 /usr/x86_64-w64-mingw32/lib/crtend.o
          ld.lld-19: error: libcrypto.a(err.o): invalid symbol index in addrsig section
          clang-19: error: linker command failed with exit code 1 (use -v to see invocation)
  ```
  https://github.com/curl/curl-for-win/actions/runs/11714665857/job/32629738265#step:3:6997
Copy link
Contributor

@torben-hansen torben-hansen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add license statement in PR description.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

@vszakats
Copy link
Contributor Author

vszakats commented Nov 8, 2024

Done.

@torben-hansen torben-hansen merged commit a11d73c into aws:main Nov 8, 2024
114 of 116 checks passed
@torben-hansen
Copy link
Contributor

Thanks! Merged it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows clang build fails with -Werror,-Wcast-function-type-mismatch
5 participants