Skip to content

OS X 10.9 gcc-4.8 unknown symbol `__objc_empty_table`

I'm not sure if and how far the ghc-7.6.3 support for OS X is planned, but I hit a (possible) linker error with 7.6.3.

I installed a homebrew gcc-4.8 and changed the ghc config to use it. I tried to compile the bindings-GLFW package, which was successful, and run cabal test on it, which fails with following error:

final link ... ghc:
lookupSymbol failed in relocateSection (relocate external)
dist/build/HSbindings-GLFW-3.0.3.o: unknown symbol `__objc_empty_vtable'
linking extra libraries/objects failed

After some research I discovered that this symbol (surely just the first which fails) is part of the Objective-C Runtime. The /usr/lib/libobjc.dylib exports this symbol.

In desperation I think I nearly reached the google quota with my research, further steps I tried:

Explicitly link the libobjc lib

ghci -lobjc dist/build/HSbindings-GLFW-3.0.3.o -framework Foundation -framework Cocoa -framework IOKit

With the same result as above:

GHCi, version 7.6.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading object (static) dist/build/HSbindings-GLFW-3.0.3.o ... done
Loading object (dynamic) /usr/lib/libobjc.dylib ... done
Loading object (framework) IOKit ... done
Loading object (framework) Cocoa ... done
Loading object (framework) Foundation ... done
final link ... ghc:
lookupSymbol failed in relocateSection (relocate external)
dist/build/HSbindings-GLFW-3.0.3.o: unknown symbol `__objc_empty_vtable'
linking extra libraries/objects failed

I found a homebrew issue related to gcc and the Apple switch from libstdc++to libc++ in 10.9 and i tried to force linking with explicit -stdlib=libstdc++ in the cabal file (ld-options). But i guess this issue isn't related to the __objc_*** problem, just tried it in desperation.

Last week I managed to build ghc HEAD with clang bootstrapped with 7.4.6: the new linker mechanic seems to resolves this problem in a way (sadly some other packages aren't jet compatible with 7.8)

So I'm not sure if this report is okay, if not, pardon me :)

I'm aware of the problems with the current ghc-7.6.3 and the the changes OS X 10.9 brings with it (according to reddit/haskell cafe). The current suggestions is to not use the XCode-5.0.1/clang together with ghc-7.6.3. So I tried gcc from homebrew. I know that 7.8 will bring better linker capabilities, maybe there are just some flags to fix this specific problem with 7.6.3...? I didn't find it. So I thought it's better to report it.

If further informations are required, I will try to provide them as fast as possible but I will have to downgrade to 10.8 tomorrow around 6 a.m. UTC.

Trac metadata
Trac field Value
Version 7.6.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information