Navigation Menu

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

build error on macos+gcc #8846

Closed
egorpugin opened this issue May 13, 2022 · 7 comments
Closed

build error on macos+gcc #8846

egorpugin opened this issue May 13, 2022 · 7 comments
Labels

Comments

@egorpugin
Copy link

There is a long history of this issue.
https://github.com/curl/curl/issues?q=is%3Aissue+SecTrustEvaluateAsync+is%3Aclosed

curl 7.83.1
macos sdk12.3, gcc11 from homebrew

Error:

[org.sw.demo.badger.curl.libcurl-7.83.1]/lib/vtls/sectransp.c
/Users/egor/.sw/storage/pkg/3e/f5/47f6/src/sdir/lib/vtls/sectransp.c: In function 'collect_server_cert':
/Users/egor/.sw/storage/pkg/3e/f5/47f6/src/sdir/lib/vtls/sectransp.c:2967:6: error: 'SecTrustEvaluateAsync' undeclared (first use in this function); did you mean 'SecTrustEvaluate'?
 2967 |   if(SecTrustEvaluateAsync) {
      |      ^~~~~~~~~~~~~~~~~~~~~
      |      SecTrustEvaluate

Changing it to SecTrustEvaluateWithError (not deprecated) fixes the issue.
You can compare OS version support with SecTrustEvaluateAsync.
SecTrustEvaluate works as well, but it's also deprecated.

@egorpugin
Copy link
Author

Changing it to SecTrustEvaluateWithError (not deprecated) fixes the issue.
You can compare OS version support with SecTrustEvaluateAsync.

Versions overlap, so compile check or something like this may fix the issue reliably.

@bagder bagder added the build label May 13, 2022
@bagder
Copy link
Member

bagder commented May 13, 2022

Sorry, I don't understand at all. Neither why this suddenly is a problem somewhere nor what the proposed fix is.

@egorpugin
Copy link
Author

There is a build error.
Symbol is deprecated.
Possible fix is a replacement with the newer one.

@nickzman
Copy link
Member

You can't build the Secure Transport code with GCC, because GCC (so far as I understand) does not support Grand Central Dispatch, and both SecTrustEvaluateAsync() and its replacement function SecTrustEvaluateAsyncWithError() require Grand Central Dispatch support to be present in the compiler.

If you build it with LLVM, then it will work.

If you want to patch this so it'll build using non-GCD-supporting compilers, then please file a pull request, and I'll review it. Thanks.

@egorpugin
Copy link
Author

  1. How do I check for GCD support in gcc?
  2. SecTrustEvaluateAsync is not called anywhere https://github.com/curl/curl/blob/master/lib/vtls/sectransp.c#L2967=

@nickzman
Copy link
Member

The FSF's GCC does not support GCD at all. There may be third-party forks that have support; if they do, then __BLOCKS__ will be defined as true.

And now I remember why I had to do that: the code uses old-school availability checks (that is, checking to see if the function is defined at runtime) for weak-linking purposes, and not the newer __builtin_available function (which I do not think is supported by GCC), and we couldn't check for SecTrustGetCertificateAtIndex() because that function was private API prior to macOS 10.7. Let me see if I can quickly fix that.

nickzman added a commit to nickzman/curl that referenced this issue May 15, 2022
SecTrustEvaluateAsync() is defined in the macOS 10.7 SDK, but it
requires Grand Central Dispatch to be supported by the compiler, and
some third-party macOS compilers do not support Grand Central Dispatch.
SecTrustCopyPublicKey() is not present in macOS 10.6, so this shouldn't
adversely affect anything.

Fixes curl#8846
Reported-by: Egor Pugin
@bagder bagder closed this as completed in e0b43c8 May 16, 2022
@barracuda156
Copy link

barracuda156 commented Apr 1, 2024

You can't build the Secure Transport code with GCC, because GCC (so far as I understand) does not support Grand Central Dispatch, and both SecTrustEvaluateAsync() and its replacement function SecTrustEvaluateAsyncWithError() require Grand Central Dispatch support to be present in the compiler.

@nickzman
You probably refer to blocks, which indeed are not yet supported in GCC, but those are distinct thing. There is nothing like GCD support in the compiler, AFAIK.
Pre-release headers of 10.6 did require blocks in dispatch.h, but that requirement was dropped in released versions. libdispatch itself builds with gcc from source.

Compare, for example:
10a190 header: https://github.com/barracuda156/10.6-PowerPC-SDKs/blob/1aee512fbbb7949fc33d4668eec429c73cc2b2ff/MacOSX10.6.sdk/usr/include/dispatch/dispatch.h#L12-L14
vs 10.6.x (release) header: https://github.com/alexey-lysiuk/macos-sdk/blob/2e3a0a902a4d8e641d44224ef2860a4f1ebfd9d7/MacOSX10.6.sdk/usr/include/dispatch/dispatch.h (error-out macro is gone).

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

Successfully merging a pull request may close this issue.

4 participants