Getting OpenGL function error when profiling but not when running - opengl-es

I have a cocos2d-iphone project. When I run the project on simulator I don't get any error. But if I try to profile it I get multiple errors in OpenGl functions found inside CCParticleSystemQuad.m file. To make it clearer I'm posting the snapshot of the error zone.
Here's the link to the image in case you want to see it closely.
Do you have any clues?

offsetof is a macro that resolves to an LLVM compiler builtin function. It's defined in stddef.h, but it's possible your project's headers don't include that file when building for a device.

Related

Xcode beta generates App cannot be opened because of a problem

Check with the developer to make sure MyApp works with this version of macOS.
After trying to use ASWebAuthenticationSession, when the App receives the callback, it shows the error:
The same error is showed after an attempt to generate the app and open it.
The error you are seeing is because your code is referring to either a non existing library or is pointing to the wrong directory where your code should look for such library. Please check the rpath you are using. Usually, you should place any dylibs inside a Frameworks folder inside your bundle and thus your rpath should start like this: ../Frameworks/InternalAPI.framework (...)

Incorporating charls into a MacOS application

Charls is an implementation of the JPEG-LS lossless and near-lossless coder/decoder. I downloaded the source code, built it in Xcode, and ran it on MacOS. From a few tests I ran, it seems to be reliable and very fast.
Now I want to incorporate charls into my application. I added the static library libcharls.a to my Xcode project and added the header file charls.h. When I try to do a build, I get the error: library not found for -lcharls. I then added a path to libcharls.a in the Library Search Paths of the Build Settings for the Project in Xcode. Still get the same error. Anyone have suggestions for getting this to build? TIA.
To answer my own question: adding the path to libcharls.a in Library Search Paths does fix the problem, but you only add the path, but not the file libcharls.a.

Xcode unable to find Eigen in workspace

I'm working on Xcode 7.0.1. I'm working with CGAL 4.7. I have a mesh that I want to refine using fair() and refine() as shown in this example.
I initially copied the code and ran it in Xcode and it gave me this error:
/Users/.../Desktop/CGAL-4.7/include/CGAL/Polygon_mesh_processing/fair.h:133:5: Static_assert failed "The function fair requires Eigen3 version 3.2 or later."
Subsequently, I added usr/local/Cellar/eigen/3.2.6/lib and usr/local/Cellar/eigen/3.2.6/include/eigen to Library Search Path and Header Search Path. Eigen is working, I run some sample code to test. But, I'm still getting that error.
As documented here you can set the environment variable EIGEN3_INC_DIR to the directory contain the Eigen directory containing the header files before running CMake.

`po` gives `error: <EXPR>:1:1: error: use of unresolved identifier`

I have this problem with po in the console where trying to output a function works in itself, but outputting a variable or constant doesn't.
As you can see here, although you'd think the var/let holds the content of bar.boy(), Swift somehow can't find it...
So it turns out there was probably a bug in the past that when you were adding a Swift file it would add/ask a Bridging header, but it wouldn't add that line to your project
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
which means you'd stay in this state
resulting in error: <EXPR>:1:1: error: use of unresolved identifier!
I could only find that out because I moved around files in my project and when I added ObjC files to the project, it asked me about a Bridging header (although I had one already!) and luckily added that SWIFT_OPTIMIZATION_LEVEL. One could consider this is a bug to consider the default value is fastest, but then again I guess this was only a bug in the past and got fixed now.
Still, I fixed now it might be a bug the other way around, if it add none in the release build. I can't test this right now because for testing this I only had a Debug build. I'll leave that as an exercise :) for Apple's Engineers.
I set Swift Complier to "-O"
SWIFT_OPTIMIZATION_LEVEL = "-O";
and set it back to "-Onone".
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Then it works.
Fixed after setting:
Optimization Level = None[-Onone] under Swift Compiler - Code Generation
Note that setting Optimization Level under Apple LLVM 8.0 - Code Generation has no effect
I bet that bug is due to the fact that foo has been optimized out during compilation and it's symbol does not exist anymore in the compiled code (even if it shouldn't have in debug and it's still an LLDB bug)
Probably if you add some usage of foo in the next lines (even a println) its symbol will hopefully be kept in the IR and you'll be able to po foo
(I agree that that's still a bug but at least if it works you'll have a workaround and some sense of explanation)
I encountered a similar issue but I already had the correct configuration, all optimisations set to None. However I still didn't get any values.
After some further digging I found out that the issue originated from Xcode being unable to the resolve the types:
(lldb) frame variable self
<could not resolve type>
That led me to this question: xcode 8 Debugger 'Could not resolve type' where the issue is described and the bridging header seems to cause issues.
With my project not having any bridging headers I studied the build settings once more and found this setting
This was initally set to YES. After changing the it to NO symbols are working again.
SWIFT_INSTALL_OBJC_HEADER = NO
If your project is using Swift, there are two separate "Optimization Level" settings in the project/target configuration. Its not only "SWIFT_OPTIMIZATION_LEVEL". Check this link: https://stackoverflow.com/a/32984193/2060180
I'll leave it here in case it's useful to someone.
For those who are using Swift framework in an Objective-c project, and wanna debug the Swift source files in that project: (In my case, I have a mixed-language module which managed by Cocoapods, I need to debug the swift module in my Objective-c Example project)
It works for me after I added an Empty Swift file in my Objective-c project.
Otherwise, those swift compiler options won't show up in the Build Settings.

Xcode: can't find headers for device in build process

My builds for device keep failing, for simulator all is fine. I should note: in the past I could build for device just fine, but not anymore.
I've created a library that is the base for my project. As part of the library build process, the x86 and ARM code get merged into 1 binary, then the binary and the appropriate headers are copied to the directory ~/devel/bin
My other project has this directory included (no copy, a link). The library is added to the target of the project and the headers are included by setting the appropriate user header search path (a subdirectory of ~/devel/bin).
When I build for device I get the following warnings:
/Users/user/Desktop/ProjectName/ProjectName/ViewController.m:57: error: 'service' undeclared (first use in this function)
Service is pointer to an SDService instance (an object from the library).
Can anyone give me some pointers on how to fix this issue? I tried recreating the project, but without success.
This is seriously f*cked up. Been trying to fix this issue for the last 3 or 4 hours, but finally found the solution. The issue seems to be the compiler. I switched from LLVM+GCC to LLVM 2.0. Hope everything else works fine with this compiler, but at least I can build again.

Resources