Qt XCode iOS entry point - ios

I am trying to port QT5 application to iOS. It builds and runs fine with QtCreator, but now I am trying to make manual XCode project. Next steps are gatheres from another topics, here is my final path:
It builds and runs, but I got runtime error:
Error: You are creating QApplication before calling UIApplicationMain.
I've found, that I should replace main -> qtmn, but then I got error about no entry point.
The declaration of main is inside of libqios.a, but I am unable to tell linker "Take main() from libqios, not from cpp files."
I tried it with
-Wl,-force_load,$(QT_SDK)/plugins/platforms/libqios.a - but it does nothing.
I found, that QT preprocessor makes something with object files (renaming main into something others), but it looks too horrible. How can it be solved?

Succeeded in by: renaming main -> qtmn (in qt sourced), rebuilt QT, and called qt_main_wrapper from my main().

Related

aapt2 Removing resource * without required default value

When building a Xamarin.Android project it is written in the output window that aapt2 has removed resources due to a missing default value.
Xamarin.Android.Aapt2.targets(160,3): warning APT2000: warn: removing resource com.companyname.demo_app:drawable/parking_slot without required default value.
The removed resource is part of a Xamarin.Android binding project and is also included in the aar-file under drawables and in the R.txt.
Because it is only a log-statement in the build output, the project builds and the app can be started. But when using one part of the binding-project the following error will be thrown:
Java.Lang.NoSuchFieldError: 'No static field parking_slot of type l in class Lcom/company/sample/R$drawable; or its superclasses (declaration of 'com.company.sample.R$drawable' appears in /data/app/com.companyname.demo_app-Ab0cDefG==/base.apk)'
What does cause the removal of the resource and how can it be prevented?
Edit 1:
The missing resource parking_slot is not in the drawable folder but in drawable-xhdpi-v4 for example. To check this I renamed the aar to zip and extracted it.
I then copied parking_slot it to the drawable folder, zipped and renamed it to aar again. Building is now without the aapt2 warning. Yet the app crashes again with:
Java.Lang.NoClassDefFoundError: 'Failed resolution of: Lcom/company/sample/R$drawable;'
I tested the aar-file with a native non-Xamarin app and no issue came to my attention which brings me to the conclusion that something might be broken with the way the Xamarin app is build.
Nevertheless the fix (or the workaround if you want) looks like this:
Rename aar to zip and unzip.
Search for the missing resource. In my case parking_slot
Copy the missing resource into your app-project
I think this works because of the way Androids fallback-system works.

Build failed - Check imports - Dart Angular Tutorial - angular_tour_of_heroes - part 2

While following tutorail - Angular-dart tutorial - Tour of Heroes - part 2
with using IntelliJ IDEA in Windows 10 while using chrome, I got following error(s) -
[SEVERE] build_web_compilers|entrypoint on web/main.dart (cached):
Unable to find modules for some sources, this is usually the result of either a
bad import, a missing dependency in a package (or possibly a dev_dependency
needs to move to a real dependency), or a build failure (if importing a
generated file).
Please check the following imports:
import 'package:angular_app/app_component.css.shim.dart' as import0; from angular_app|lib/app_component.template.dart at 12:1
[SEVERE] Failed after 1.3s
Serving web on http://localhost:53323
I have checked multiple times & I have replaced all - 5 files - namely
lib/app_component.css, lib/app_component.dart, lib/app_component.html, lib/src/hero.dart & lib/src/mock_heroes.dart from Review the app structure but I am still getting the above mentioned error & -
I could not find any app_component.template.dart
Nor could found any instance of imported package:angular_app/app_component.css.shim.dart or shim using IntelliJ Find in Path (Ctrl+Shift+F)
I have tried to delete build and rebuild.
I have also re-installed dart 2.1.0 using windows package manager & changed the location of dart-sdk accordingly in IntelliJ IDEA Settings/Dart, as for brief period I was getting dart-sdk error, but that is fixed.
This my first time asking question on stacksoverflow, but I have checked similar questions, could not resolve that issue.
the most likely reason for that build failure is due to the stylesUrls files not being found. This could be because the name in that array doesn't match the name in the file system or is not the expected place in the file system.
To confirm, I started from scratch, downloaded the quickstart-master.zip to get the project structure.
And followed the steps all the way through the step you were stuck on.
The only time I was able to generate that error while following the steps is when I added thestyleUrls: ['app_component.css'], to app_component.dart prior to creating the file.
I got the same:
[SEVERE] build_web_compilers|entrypoint on test/app_test.dart.browser_test.dart:
Unable to find modules for some sources, this is usually the result of either a
bad import, a missing dependency in a package (or possibly a dev_dependency
needs to move to a real dependency), or a build failure (if importing a
generated file).
Please check the following imports:
import 'package:angular_app/app_components.css.shim.dart' as import0; from angular_app|lib/app_component.template.dart at 12:1
Once i created the css file, the error went away and everything worked fine.
I completed the entire step you were up to and my app was working fine.
I then did as you did and copied each file from the step and replaced my work with it, still worked.
So confirm my hunch, i changed the name of the css file, and received the same error.
regarding app_component.template.dart that file is auto generated by dart and can be found in your project under .dart_tool/build/generated/angular_app/lib
I had a very similar problem. I ran webdev build and then webdev serve and it fixed it right up.

iOS Metal: Unable to create compute pipeline state with function

I was trying to make a simple app for sudoku solving on GPU with iOS Metal Framework.
I was following instructions from this blog post:
http://memkite.com/blog/2014/12/15/data-parallel-programming-with-metal-and-swift-for-iphoneipad-gpu/
I version my code here:
https://github.com/mateuszbuda/Sudoku
(As of writing this question HEAD is commit c3e06e0)
And I've encountered error when calling
newComputePipelineStateWithFunction
that is while setting up MTLDevice in ViewController (line 95):
https://github.com/mateuszbuda/Sudoku/blob/c3e06e0e1edc724eea20962f32e49f0df8143b7d/Sudoku/ViewController.swift
The error I get is:
Error Domain=AGXMetal Code=1 "Compiler encountered an internal error"
I'm running this on iPhone 6 Plus with iOS 8.1.3
Have someone any idea what can cause the error I get?
You are experiencing one of the unfinished matters in Metal. The reason the error says "internal" is because this is a compiler error, CAUSED by the compiler. Not you. Try this:
Copy all of the code in the ".metal" file that is not compilable.
Delete the .metal file (NOT just the reference).
Remove all of the content of the "DerivedData" folder located at users/yourUser/Library/Developer/Xcode/DerivedData
Create a new .metal file and paste the old code in this new metal file.
Now build and run, you should be good to go.
Anybody who finds this error make sure to send some sort of error report to Apple so that they can properly debug it and fix it in the next release of Xcode.
For anyone having the same problem, I've figured it out.
It just means that there is something wrong with a kernel function. Most probably it doesn't compile, even if you don't see any errors in Xcode.

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

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

Not Able To Compile Neon Code on Xcode: "bad instruction"

I have a code base which under Xcode get the error "bad instruction" for every NEON instruction I call. It basically seems like NEON is not detected.
I am attempting to build a static library, I went to New Project, selected Cocoa Touch Static Library, then added my existing files.
Everything I'm reading indicates that NEON should be already enabled. I removed all references to armv6, and am targeting iOS 5.1
Also the code in question is all contained as routines defined in ".s" files -- pure assembly. I am not using the intrinsic method calls.
this is the error which I get whenever I try to run the code:
unknown directive .fpu neon
Command /Applications/Xcode.app/Contents/Developer/Toolchains/
XcodeDefault.xctoolchain /usr/bin/clang failed with exit code 1
also when I delete .fpu neon command from my code, it compiles and I get the .o file but then it fails to link as I still am not able to use the programs defined in the code file.
Try the answer on my similar question https://stackoverflow.com/a/10507325/571778
Sort answer, in my case, was I was porting assembly from another compiler. A few points:
Xcode requires all lower case instructions
The pseudo-ops are different (try http://www.shervinemami.info/armAssembly.html#template)
you must start your assembly function names with "_", because that's how the linker finds them (in C, call "foo()", but in ASM name your function "_foo")

Resources