Posts

Post marked as solved
6 Replies
1.7k Views
Building my libraries on Mac suddenly started to fail with XCode Version 11.3 (11C29).I was able to isolate one problem:It seems that when you use sin and cos in the same function, the optimizer will use __sincosf_stret to calculate both at once but this result in a link error.So what did I do:Create a new XCode project, cmd line tool, objectiv-cChange the main.m to main.mm to allow C++Change main as:#import <Foundation/Foundation.h> #include <cmath> void coordinateCalculator(float angle, float radius, float& x, float& y) { float mySin = sin(angle); float myCos = cos(angle); x = radius * myCos; y = radius * mySin; } int main(int argc, const char * argv[]) { @autoreleasepool { float myAngle = 0.0; float theX, theY; float radius = 100.0; while (myAngle < 360.0) { coordinateCalculator(myAngle, radius, theX, theY); NSLog(@"My coordinates: %f, %f",theX,theY); myAngle += 1.0; } } return 0; }I'm using in my project:C++: C++14, libC++Base SDK: MacOSDeployment target 10.14Building in Debug works fine, building for profiling (Release version with optimization) will fail giving the following error message:Undefined symbols for architecture x86_64: "___sincosf_stret", referenced from: coordinateCalculator(float, float, float&, float&) in main.o _main in main.old: symbol(s) not found for architecture x86_64When I change the deployment target to 10.7, the sincosf_stret is found, but I get 2 ARC errors:Undefined symbols for architecture x86_64: "_objc_loadClassref", referenced from: __ARCLite__load() in libarclite_macosx.a(arclite.o) "_objc_readClassPair", referenced from: __ARCLite__load() in libarclite_macosx.a(arclite.o)ld: symbol(s) not found for architecture x86_64Trying different deployment targets give:10.7: 2 ARC link errors10.10: 2 ARC link errors AND _sincosf_ret error10.12 or higher: _sincosf_ret errorI can't belief that it is not possible to use sin/cos in one function. So I hope someone has a hint to resolve this problem. I have to build multiplatform libraries. It worked fine for years. Recently I switched to XCode 11 and to BaseSDK "MacOS". Before I used some special tool to reinstall BaseSDK 10.7 for XCode 9. I wanted to get rid of the necessety of using this special tool for reinstalling BaseSDK 10.7 after each XCode update.Thanks,Rudi
Posted
by rbartels.
Last updated
.