0

I have a lib that provides both libxxx_x86_64.a and libxxx_arm64.a. When linking using ld x86_64.a is skipped,

ld: warning: ignoring file _pod_work_dir/Pods/____/libs/______x86_64.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64

however lld won't do so

1d64.11d: error: _pod_work_dir/Pods/_____/libs/______x86_64.a(___+___.o)has architecture x86_64 which is incompatible with target architecture arm64

Is there an option with lld I can make this behavior a warning instead of error.

the lib is downloaded directly into build dir by cmake or pods script like this. So the project just try to link x86_64.a as well. enter image description here

isudfv
  • 179
  • 1
  • 9
  • 2
    How are you building your app? That's what you need to fix. – Paul Sanders Jun 21 '22 at 07:58
  • sorry I don't understand. This is linking right? how does Debug/Release affect this? – isudfv Jun 21 '22 at 08:05
  • 1
    What I meant was: why is your build script (whatever that is) trying to link with both libraries, when you clearly want only one. – Paul Sanders Jun 21 '22 at 08:06
  • 1
    On Linux the libs should be /usr/lib/x86_64-linux-gnu/libxxx.a and /usr/lib/arm64-linux-gnu/libxxx.a (or /opt/lib/ or /usr/local/lib or whatever prefix). Then when you link -lxxx the linker will only look in one subdirectory. – Goswin von Brederlow Jun 21 '22 at 08:09
  • I'm building on mac. It seems the pods script just add the two .a as a lib and try to linking it. those libs are downloaded into _pod_work_dir directly so it would require the script guy to do the work ... – isudfv Jun 21 '22 at 08:22
  • Paul is recommending that you just link the correct one instead of both – user253751 Jun 21 '22 at 08:36
  • I can only delete the x86_64.a, but it will be downloaded back when cmake re-configure – isudfv Jun 21 '22 at 08:39
  • What IDE are you using there? Doesn't look like Xcode (or have you changed the colour scheme or something?). – Paul Sanders Jun 21 '22 at 09:05
  • it's Clion. I'm in favor of configuring directly from cmake, instead of convert to xcode or vs project – isudfv Jun 21 '22 at 09:11
  • 1
    Show the CMake code responsible for linking the `.a` files with your program. It can no doubt be made architecture-specific – Botje Jun 21 '22 at 09:21
  • I'm afraid I can't. It's company code and its too big! I just can't locate the code. Since there's no workaround with `lld`, I decided to ask the cmake script guy to do his work – isudfv Jun 21 '22 at 09:29

0 Answers0