문제

So generally, I know what this error means. But here's what's unique to my issue -

  1. I do have the (static) library with the symbols the linker is unable to find. I ran the 'nm' to verify this, explicitly looking for the x86_64 symbols. They're there.
  2. But - I also have a dynamic library in the same location with the same name. My guess is that the linker is grabbing the .dylib, instead of the .a, and as a result its unable to find the symbols it needs.

I did find this post about forcing static linking when you have static & dynamic libs with the same name - How can I force linking with a static library when a shared library of same name is present.

The thing is I'm using Ant build scripts and tried a few different things to incorporate the solution in the post above, without much success.

So my questions are -

  1. Is my hunch right in #2 above with the "miss" resulting from the library name?
  2. Does anyone know of an Ant script solution to this? Some of the things I've tried in Ant are -
    a. "linkerarg value="static"" <- problem with this is it tries to find a static lib for crt0.o
    b. "linkerarg value="static"" followed by "linkerarg value="llibname""

UPDATE - I was right about the linker picking up the .dylib instead of the .a - I renamed the static library (.a) to something else and its able to find all the symbols it needs. Now the question is - how do we explicitly instruct the Ant script to pick up the .a and not the .dylib?

ANSWER - its a linker flag called force_load. So -force_load filename.a would do it.

도움이 되었습니까?

해결책

Its a linker flag called *force_load*. So -force_load filename.a would do it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top