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

dyld: Symbol not found: ___CFObjCIsCollectable #45042

Closed
kirelagin opened this issue Aug 14, 2018 · 17 comments
Closed

dyld: Symbol not found: ___CFObjCIsCollectable #45042

kirelagin opened this issue Aug 14, 2018 · 17 comments
Labels
0.kind: bug Something is broken 6.topic: darwin Running or building packages on Darwin

Comments

@kirelagin
Copy link
Member

This happens on macOS Mojave 10.14:

{-# LANGUAGE OverloadedStrings #-}

import Control.Monad
import Data.Default.Class
import Network.HTTP.Req

main :: IO ()
main = runReq def $
  void $ req GET (https "api.github.com" /: "meta") NoReqBody ignoreResponse mempty
› nix-shell -p 'haskellPackages.ghcWithPackages (hp: [ hp.req ])' --run 'runhaskell Main.hs'
dyld: Symbol not found: ___CFObjCIsCollectable
  Referenced from: /nix/store/wkqjqwyfi1nn2hg9k0as03lpcmalqxzj-libsecurity_utilities-osx-10.7.5/lib/libsecurity_utilities.0.dylib
  Expected in: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
 in /nix/store/wkqjqwyfi1nn2hg9k0as03lpcmalqxzj-libsecurity_utilities-osx-10.7.5/lib/libsecurity_utilities.0.dylib
Main.hs: VanillaHttpException (HttpExceptionRequest Request {
  host                 = "api.github.com"
  port                 = 443
  secure               = True
  requestHeaders       = []
  path                 = "/meta"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 (InternalException (HandshakeFailed (Error_Protocol ("certificate has unknown CA",True,UnknownCa)))))

(the expected result is a 403.)

I am not sure if it is a Mojave-specific issue as I currently don’t have a previous version of macOS to test with, but I’ll ping #42719 just in case.

@kirelagin
Copy link
Member Author

kirelagin commented Aug 14, 2018

› objdump /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation -macho -exports-trie | grep ___CFObjCIsCollectable
0x00594E50  ___CFObjCIsCollectable

🤔

@LnL7 LnL7 added the 6.topic: darwin Running or building packages on Darwin label Aug 14, 2018
@LnL7
Copy link
Member

LnL7 commented Aug 14, 2018

Hmm, I was expecting this to be the problem but that doesn't seem to be it. I was expecting our version not to have it while libsecurity is expecting it to be there.

$ nm -g /nix/store/36ph03q316x86rdyvx63ha2kl51f84dm-CF-osx-10.10.5/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation | grep ___CFObjCIsCollectable
00000000000f6970 S ___CFObjCIsCollectable
$ nm -g /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation | grep ___CFObjCIsCollectable
00000000005e68d0 S ___CFObjCIsCollectable

@kirelagin
Copy link
Member Author

Got access to macOS 10.13.6 and it works there, so, yes, a Mojave regression.

@jhenahan
Copy link
Contributor

jhenahan commented Sep 16, 2018

EDITED: Nevermind that. I understand more about how all these libraries get instantiated, now.

Also hitting this on the latest Mojave beta.

@jhenahan
Copy link
Contributor

jhenahan commented Sep 23, 2018

Due to a suggestion at

If you see errors similar to <literal>Error_Protocol ("certificate has
about this specific error message, I'm attempting a GHC build with cacert added to nativeBuildInputs to see if that gets things any further along. Will update if/when it finishes.

Update: No dice. Same ___CFObjCIsCollectable, same error about unknown CA.

@cransom
Copy link
Contributor

cransom commented Sep 25, 2018

I tried to follow the story here and I didn't see a resolution, so I assume this is still broken. I'm on the current bleeding master and trying to build haskellPackages.dhall_1_17_0 and I'm stumbling into this as well:

/private/tmp/nix-build-dhall-1.17.0.drv-0/dhall-1.17.0/src/Dhall/Tutorial.hs:440: failure in expression `input auto "https://raw.githubusercontent.com/dhall-lang/dhall-haskell/18e4e9a18dc53271146df3ccf5b4177c3552236b/examples/True" :: IO Bool'
expected: True
 but got: dyld: Symbol not found: ___CFObjCIsCollectable
            Referenced from: /nix/store/79x43vkf7r0hhyd7h6xy7kipyv9j5kj8-libsecurity_utilities-osx-10.7.5/lib/libsecurity_utilities.0.dylib
            Expected in: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
           in /nix/store/79x43vkf7r0hhyd7h6xy7kipyv9j5kj8-libsecurity_utilities-osx-10.7.5/lib/libsecurity_utilities.0.dylib
          dyld: Symbol not found: ___CFObjCIsCollectable
            Referenced from: /nix/store/79x43vkf7r0hhyd7h6xy7kipyv9j5kj8-libsecurity_utilities-osx-10.7.5/lib/libsecurity_utilities.0.dylib
            Expected in: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
           in /nix/store/79x43vkf7r0hhyd7h6xy7kipyv9j5kj8-libsecurity_utilities-osx-10.7.5/lib/libsecurity_utilities.0.dylib
<snip>

Darwin is greek to me, but from the previous commands, it looks like the symbol isn't copied or at least is undefined?

0caseys-imac:~/git/nixpkgs% nm -g /nix/store/79x43vkf7r0hhyd7h6xy7kipyv9j5kj8-libsecurity_utilities-osx-10.7.5/lib/libsecurity_utilities.0.dylib | grep ___CFObjCIsCollectable
                 U ___CFObjCIsCollectable
0caseys-imac:~/git/nixpkgs% nm -g /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation | grep ___CFObjCIsCollectable
0000000000595e60 S ___CFObjCIsCollectable

This would seem to line up with @LnL7's theory from #45042 (comment)

@jhenahan
Copy link
Contributor

@cransom For the immediate problem of dhall, you can override it with dontCheck to skip the tests. Network calls still won't work, but it'll at least be usable.

dhall = dontCheck super.dhall_1_17_0;

@matthewbauer
Copy link
Member

matthewbauer commented Sep 27, 2018

I think we should try using the impure Security framework for now. I looked at the issue and it's definitely not obvious what to do. Perhaps updating to the latest Apple open source release fixes it but just as likely could be something else.

/cc @copumpkin @pikajude

@domenkozar
Copy link
Member

Unless Apple has a separate channel for alphas/betas, we have the latest version from https://opensource.apple.com/tarballs/libsecurity_utilities/

@matthewbauer
Copy link
Member

They’ve moved it all to security. Those are from like 10.9

@domenkozar
Copy link
Member

@copumpkin @LnL7 any objections removing libsecurity_utlities in favor of impure Security?

@eyeinsky
Copy link
Contributor

eyeinsky commented Oct 2, 2018

Is this unresolved as of now?

This is my error (calling googleapis through wreq/http-client:

dyld: Symbol not found: ___CFObjCIsCollectable
  Referenced from: /nix/store/79x43vkf7r0hhyd7h6xy7kipyv9j5kj8-libsecurity_utilities-osx-10.7.5/lib/libsecurity_utilities.0.dylib
  Expected in: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
 in /nix/store/79x43vkf7r0hhyd7h6xy7kipyv9j5kj8-libsecurity_utilities-osx-10.7.5/lib/libsecurity_utilities.0.dylib
dyld: Symbol not found: ___CFObjCIsCollectable
  Referenced from: /nix/store/79x43vkf7r0hhyd7h6xy7kipyv9j5kj8-libsecurity_utilities-osx-10.7.5/lib/libsecurity_utilities.0.dylib
  Expected in: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
 in /nix/store/79x43vkf7r0hhyd7h6xy7kipyv9j5kj8-libsecurity_utilities-osx-10.7.5/lib/libsecurity_utilities.0.dylib
HttpExceptionRequest Request {
  host                 = "www.googleapis.com"
  port                 = 443
  secure               = True
  requestHeaders       = [("Content-Type","application/x-www-form-urlencoded"),("User-Agent","haskell wreq-0.5.2.1")]
  path                 = "/oauth2/v3/tokeninfo"
  queryString          = ""
  method               = "POST"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 (InternalException (HandshakeFailed (Error_Protocol ("certificate has unknown CA",True,UnknownCa))))

Strange that there is a "dyld symbol not found" error, and then "certificate has unknown CA".

@matthewbauer
Copy link
Member

I opened #47676 to fix this (temporarily at least).

@eyeinsky
Copy link
Contributor

eyeinsky commented Oct 2, 2018

@matthewbauer thank you for doing this!

matthewbauer added a commit to matthewbauer/nixpkgs that referenced this issue Oct 2, 2018
darwin.security_tool is currently broken in Mojave. See issue NixOS#45042
for more info. Our security_tool stuff comes from 10.9 so I suspect
that it needs an update.

Here I am putting in a hack to get things working again. This uses the
system provided security binary at /usr/bin/security to avoid the
issue in Haskell’s x509-system package. Unfortunately, this will break
with the sandbox. I am also working on a proper fix, but this requires
updating lots of Apple stuff (and also copumpkin’s new CF). You can
follow the progress on this branch:

  https://github.com/matthewbauer/nixpkgs/tree/xcode-security

This commit should be backported to release-18.03 and release-18.09.

/cc @copumpkin @LnL7 @pikajude
matthewbauer added a commit that referenced this issue Oct 2, 2018
darwin.security_tool is currently broken in Mojave. See issue #45042
for more info. Our security_tool stuff comes from 10.9 so I suspect
that it needs an update.

Here I am putting in a hack to get things working again. This uses the
system provided security binary at /usr/bin/security to avoid the
issue in Haskell’s x509-system package. Unfortunately, this will break
with the sandbox. I am also working on a proper fix, but this requires
updating lots of Apple stuff (and also copumpkin’s new CF). You can
follow the progress on this branch:

  https://github.com/matthewbauer/nixpkgs/tree/xcode-security

This commit should be backported to release-18.03 and release-18.09.

/cc @copumpkin @LnL7 @pikajude
matthewbauer added a commit that referenced this issue Oct 2, 2018
darwin.security_tool is currently broken in Mojave. See issue #45042
for more info. Our security_tool stuff comes from 10.9 so I suspect
that it needs an update.

Here I am putting in a hack to get things working again. This uses the
system provided security binary at /usr/bin/security to avoid the
issue in Haskell’s x509-system package. Unfortunately, this will break
with the sandbox. I am also working on a proper fix, but this requires
updating lots of Apple stuff (and also copumpkin’s new CF). You can
follow the progress on this branch:

  https://github.com/matthewbauer/nixpkgs/tree/xcode-security

This commit should be backported to release-18.03 and release-18.09.

/cc @copumpkin @LnL7 @pikajude
@copumpkin
Copy link
Member

@domenkozar no objections

@Ekleog
Copy link
Member

Ekleog commented Oct 18, 2018

(triage) If I read it correctly, this is currently solved by #47676?

@matthewbauer
Copy link
Member

Yeah as well as we can until we can update Security.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: darwin Running or building packages on Darwin
Projects
None yet
Development

No branches or pull requests

9 participants