ld: warning: has malformed LC_DYSYMTAB

1.5k Views Asked by At

Working on building a react-native wrapper for the WireGuardKit library, but I'm having trouble getting it to work in a swift app for testing purposes. The library compiles, the app compiles, but when the library is linked, it throws this error:

ld: warning: '/Users/zach/Library/Developer/Xcode/DerivedData/vpn-testing-2-bwlltvgctdybzvheohentkkatmte/Build/Products/Debug-iphonesimulator/libwg-go.a[arm64][2](go.o)' has malformed LC_DYSYMTAB, expected 67 undefined symbols to start at index 4740, found 79 undefined symbols starting at index 15
ld: Undefined symbols:
  _darwin_arm_init_mach_exception_handler, referenced from:
      _x_cgo_init in libwg-go.a[arm64][9](000006.o)
  _darwin_arm_init_thread_exception_port, referenced from:
      _threadentry in libwg-go.a[arm64][9](000006.o)
      _x_cgo_init in libwg-go.a[arm64][9](000006.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Other info: MacBook Pro 2023 - M2 Pro Xcode 15

I've tried installing different versions of go and trying to mess with build settings. Every time throws that error.

1

There are 1 best solutions below

2
On

I ended up figuring out the solution to my problem after a few days. It was entirely due to the fact I was using the simulator built into Xcode and not a native device.

If you encounter this issue, just plug in an iPhone or other iOS device, then go to Product -> Destination and select the iOS device.

Doesn't hurt to clean (Cmd + Shift + K) before rebuilding.