Associating issues with OS X 10.10

I am trying to compile some code in OSX 10.10 using the latest Xcode command line tools. Compilation works, but link is a nightmare. Firstly, I get an error when a character propagates. This error is true, but the definitions are identical in third-party libraries, which I do not control. I cannot figure out how to make the linker ignore this problem. It is important to note that the same code compiles, binds, and works flawlessly in my Ubuntu box under both clang and gcc. This linker issue is only under OS X. Libraries are static.

The second problem I am facing is even stranger. If I remove some (necessary) functions so that I can compile and link the program, I get the following funny message at startup: "dyld: Symbol not found: __ZNSt12future_errorD1Ev". Damn it, and how can I fix it? Google was useless on this front.

+5
source share
1 answer

Ok, so I decided all this, as far as I know. Here is what I learned. Firstly, the problem of static linking is not possible for solving on OSX using the "special" version of Clang from Apple. Except for editing the source code of the library, there seems to be no way to tell the compiler to ignore duplicate character definitions. Such parameters used to be (for example, -m), but they were all deprecated for a while. Thus, to solve this problem, I had to make at least one of the dynamic libraries.

The second problem was related to the fact that one of the libraries against which I was trying to link was somehow compiled against libstdC ++. However, Apple clang wants to compile everything compared to libC ++ by default. Thus, the problem was related to compatibility between the two libraries: std :: future_error had another distorted name in both and at runtime (when I used lib ++), the symbol from libstd ++ could not be found. The correct solution to this problem (which I destroyed the bullet and made) was to recompile any library in this project using libC ++, since the two implementations of the standard library are generally incompatible.

In any case, I hope this is useful to someone else. I find it unbelievable to be disappointed that Apple should be varied enough to ensure that assemblies that work perfectly under several Linux compilers break terribly in the OS under their own version of clang.

+3
source

Source: https://habr.com/ru/post/1206500/


All Articles