Build error for FABS, Xcode uses different header file (math.h vs tgmath.h) - ios

I have a method which uses FABS
return (fabs(x - y) <= EPSILON);
It compiles and builds fine on four of my machines, but when I recently tried to configure another new machine i get a weird build error whereby it says
"ApplicationBackgroundColor.m:146:14: Called object type 'int' is not a function or function pointer"
On closer inspection it seems that the FABS is pointing [when i command click it in Xcode] to tgmath.h; while for the other machines that is working it is supposed to be redirected to math.h in /usr/include of the iOS simulator.
The entire repository is directly cloned from git and there are no difference between those working and those not working - the code and the project workspaces. Therefore, as far as I can tell, there must be something else I'm missing.
Could someone help me?

Try doing it:
Open terminal
type --> xcode-select --install
It could be related to not find the math.h where it is defined
It is for installing the command-line tool again. Many times it solves this kind of problems. And after doing it restart XCode

Related

Unable to locate sdkmanager.bat. Did you run Android Studio and install cmdline-tools after installing?

i was trying to make use of unreal engine 4 template for AR but i got this error. This step kinda connect android studio with unreal but i just don't work.
Ran into the same issue and fixed it by editing the SetupAndroid.bat file.
Example of adjusted code
Not sure why it doesnt set the location of the SDKManager after it fails the first one. But manually replacing the first location works.
if you encountered this issue when running "SetupAndroid.bat", the reason might be simple. If you check the "SetupAndroid.bat"(right click, edit. Or turn it into a txt), the default sdkmanager path might be different from the actual location.
You might need to search "sdkmanager" from the Android Studio SDK root folder manually(it suppose to display on the cmd interface), find the actual directory and correct the "SetupAndroid.bat", then try it again.
the same here, i tried to search "sdkmanager" at both of my Drive and couldn't find any.
couldn't find any cmdline-tools drive as well.
Try next:
Go to your AppData\Local\Android\Sdk folder
Search for sdkmanager.bat
Navigate to its location and copy it
Open SetupAndroid.bat with Notepad (or other editor of your choice)
Find the line(s) which contains sdkmanager.bat
Paste the copied location (for example \cmdline-tools\latest\bin\sdkmanager.bat)
Save, exit, and run the edited file
This worked for me.
I spent 2 hours to figure out what's wrong with it.
So, provided earlier solutions should fix it:
Simply just replace incorrect path to correct one or, just DELETE most outer IF block and first line where %SDKMANAGER% var first set to invalid (I suppose, outdated path) value.
This is a part of the source code of SetupAndroid.bat from Epic Games. I've checked version 4.27 and 5.1. These lines are kind of identical in both versions (however version 5.1 still has the same exact error, but it works due to changing the order of which path is tried first):
set SDKMANAGER=%STUDIO_SDK_PATH%\tools\bin\sdkmanager.bat
IF EXIST "%SDKMANAGER%" (
echo Using sdkmanager: %SDKMANAGER%
) ELSE (
set SDKMANAGER=%STUDIO_SDK_PATH%\cmdline-tools\latest\bin\sdkmanager.bat
IF EXIST "%SDKMANAGER%" (
echo Using sdkmanager: %SDKMANAGER%
) ELSE (
echo Unable to locate sdkmanager.bat. Did you run Android Studio and install cmdline-tools after installing?
pause
exit /b 1
)
)
And this specific part does not work! I don't know why those who developed that did not check it or they simply don't know how batch file variables work.
The thing here is that on recent Android SDK installations there's no folder tools at the path %STUDIO_SDK_PATH%. So the first condition check fails and then they try to overwrite variable value to correct one with path %STUDIO_SDK_PATH%\cmdline-tools\latest\bin. But this overwrite DOES NOT WORK. You can't just do that in a batch file (which is kind of stupid, but it is). More on that issue with batch vars here: How to overwrite an existing variable using another variable in batch files?
"Good" job! Epic Games

Google Protobufs in iOS app crashing at GPBDescriptor

This one is a real head-scratcher...
PART ONE
We have a swift iOS application with different targets for Dev and Prod (normal stuff).
We've incorporated Google Protobufs into it for one of our latest features. This was done using Google's J2ObjC library and the pod 'Protobuf', '= 3.11.4' pod. (Our .proto files were made with v3.11.4).
Running our Dev target works fine (mostly, see Part Two). Running our Prod target crashes in the constructor of any GPBMessage object.
It crashes within the + (GPBDescriptor *)descriptor function of the pbobc.m file of our message object...eventually getting to this error within GPBDescriptor.m
Line:
enumHandling_.enumDescriptor_ = coreDesc->dataTypeSpecific.enumDescFunc();
Error:
(lldb) po coreDesc->dataTpeSpecific
error: <user expression 2>:1:11: no member named 'dataTpeSpecific' in 'GPBMessageFieldDescription'
coreDesc->dataTpeSpecific
~~~~~~~~ ^
What's weird is this crashes in Prod and not Dev. Combing through both targets' Build Settings...they're identical. Build Phases are the same, Build Rules are the same, Plists are basically the same...
I don't know what else to check.
PART TWO
There is one GPB message that crashes on init in both our Dev and Prod targets. (We can run without it, so I've commented it out during development.)
The difference between this message and the others is that this one is a list of enums.
It crashes on the same line. ¯\(ツ)/¯
Thank you SO MUCH in advance! :D
of course immediately after I post the question I find the answer...
Google protocol buffers on iOS
Needed to add -fno-objc-arc to every ...pbobjc.m file in the Compile Sources of Build Phases.
I had already done this for a few files in Dev, hence the (very subtle!) difference.

Xcode12 po command in lldb in console cannot find variables in scope

Ever since I updated to Xcode 12, I have not been able to print out variables in the console while debugging with lldb.
Using print() statements directly in Swift code outputs to the console as expected.
A command in the console such as po "hi" outputs "hi" to the console as expected.
Trying to run po <variable_name>, instead, always outputs this line:
error: <EXPR>:3:1: error: cannot find 'variable_name' in scope
instead of the expected variable's value.
Steps I took
Add these lines to Swift code
let example = "hi"
print(example)
Put a breakpoint on the second line, the one with the print() statement
Run the code and wait for the breakpoint to be hit
Try to run po example in the debug console
Expected result
It should print "hi" in the console
Actual result
It prints this error line
error: <EXPR>:3:1: error: cannot find 'example' in scope
It's the same when running on the simulator or a device. I've tried activating the console, and restarting Xcode.
I've tried creating a new project in Xcode12 and that works fine, my other older projects created with previous versions of Xcode work fine in Xcode 12.
I've tried confronting the Build settings both with the other projects and with a newly created project and it seems nothing's wrong: optimization is set to None as it should for debug build configurations and the run scheme is set to launch a debug build configuration.
Where else could the problem be?
I had this issue as well, everything was set correctly in build settings, I had the same situation as in the question.
For me the problem was solved after I moved all my SPM dependencies back to CocoaPods, but that's not the silver bullet because I have other projects where some dependencies are on CocoaPods and some on SPM and those work perfectly fine.
What can be useful, though, is that to come to this solution I checked out older commits until I found a working one and then tried to restore things that changed since that commit. This should help find the cause in every specific case.
This issue is so unpredictable that, if you are experiencing it, I think it's worth filing a feedback to Apple, if you can, attaching your projects to the feedbacks.
You can change optimization level to "none" value in build settings. Its works for me.
In my case the problem was caused by 'GoogleAPIClientForREST' installed as Cocoapod dependency in a project containing also a Swift Package.
You can find the issue reported here: https://github.com/google/google-api-objectivec-client-for-rest/issues/478
I don't know if the responsible for the problem is SPM or GoogleAPIClientForREST, but a good workaround for now is to install a previous version of GoogleAPIClientForREST:
pod 'GoogleAPIClientForREST/Drive', '~> 1.3.11'
pod 'GoogleAPIClientForREST/Calendar', '~> 1.3.11'

Xcode export localization throws error "Argument list too long"

I've got a very curious error to share regarding Xcode localization process. I will try to share as much detail as legally possible.
From Xcode, I am trying to export an XLIFF file to send to our translators, via "Editor > Export for Localizations". However, this immediately throws error with the message:
The operation couldn't be completed. Argument list too long
This is indeed confusing, as I cannot find a more verbose log anywhere (I have already tried checking my Console.app). So, I spent quite a few time googling – to no avail. I couldn't find similar case like this. The error itself happens only when I am trying to export for localization. I can build and run the app just fine.
Facts
~ $ xcodebuild -version
Xcode 8.2
Build version 8C38
~ $ xcode-select -version
xcode-select version 2347.
~ $ echo $PATH
/Users/david.christiandy/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/david.christiandy/arctools/arcanist/bin:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
I am using Xcode 8.2 on macOS Sierra 10.12.5.
The error happens only when I try exporting from localization. This is also true when I run the localization process via xcodebuild -exportLocalizations.
I can build and run the app just fine. (I believe) there's no problem with my header search paths.
Attempts
Thought there was something wrong in the code, so I tried to run the export process (via xcodebuild command) in a CI. Somehow, it's working. For the record, I am using Bitrise CI with the same stack as my system (Xcode 8.2.x, macOS 10.12)
Asked colleagues to run export process on their machines, and they have the same error.
This leads me to think that there must be something wrong with the configuration. So I made a standalone project to confirm that the export process fails consistently. Turns out, it works just fine!
So, the hypothesis I got currently is:
There's probably something wrong in the code, and
There might be tools/software (that most of our iOS engineers installed) that might contribute to the error (since the CI completes just fine).
I don't know why the CI can run the export process just fine, and I don't know when it might suddenly stop functioning (just like our local machines).
Appreciate any help on this matter. Thank you!
I also asked this question on Apple developer forums, here is the link: https://forums.developer.apple.com/thread/86762
“Argument list too long” sounds like E2BIG, which you get when you try to run a child process with a huge argument list (I believe the current limit is 256 KiB). I suspect that Export for Localizations is running some sort of command line tool to do that work (probably the extractLocStrings tool, which you’ll find lurking within Xcode’s app bundle) and passing it full paths to each of the files in your project. Depending on how many files you have and how long those paths are, it’s easy to run into problems like this.
One of the ‘fun’ things about bugs like this is that they are dependent on where you place your project. Things might work if the project is at the top of your home directory but fail if it’s nested deep inside a subdirectory.
That also suggests a potential workaround, namely, to move your project further up in the directory hierarchy.
Finally, you should definitely file a bug about this. I believe we’ve seen this before (r. 30703294) but your report will help reinforce that this is causing problems for developers in the field. Please post your bug number, just for the record.
Several days ago before I read this answer, I managed to get the export working by deleting some folders via Xcode (remove references only). Initially I suspected that there's an invalid format within the folders that I deleted, but when I tried deleting other folders, the export process works just fine.
I also tried exporting strings using Xcode 9, and I didn't encounter the problem. So hopefully this bug is only for Xcode 8.3.3 and below.

Couldn't get Xamarin projects working with Rider-EAP on OSX

I was really excited, when JetBrains launched the Project Rider-EAP. First thing I've tried was to get a Xamarin-iOS project to run in Rider-EAP, but it doesn't work out of the box.
Update 1: This issue is now listed as critical bug with fix in EAP 2: https://youtrack.jetbrains.com/issue/RIDER-618
1. Problem (fixed) Projects didn't load with the exception that Xamarin.iOS.targets could not be found.
I fixed this with a simple Symlink:
ln -s /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/ “/Applications/Rider EAP.app/Contents/lib/ReSharperHost/macos-x64/mono/lib/mono/xbuild/”
2. Problem
References are not loaded correctly. Therefore the whole syntax highlighting and everything beyond is broken.
See screenshot: References are not loaded correctly
I get the following error as well:
Error:null: Error initializing task MakeDir: Could not load file or assembly '/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Tasks.dll' or one of its dependencies
Switching the xbuild to mono 4.2.2 removes the error but not solves the problem.
PS: It seams that the references are loaded correctly for Xamarin Android projects.
Basic Xamarin Support like open and build is added with EAP 8 of Project Rider.
More advanced features will come with the next Builds and are tracked here: https://youtrack.jetbrains.com/issue/RIDER-1533

Resources