Monotouch Facebook Binding - "make" results in errors - xamarin.ios

I'm trying to create the Facebook DLL with following bindings: https://github.com/mono/monotouch-bindings/tree/master/facebook
When I use "make", I'm getting following errors:
error: invalid deployment target '5.0.0' for architecture 'arm64' (requires
'7.0.0' or later)
And
** BUILD FAILED **
The following build commands failed: ProcessPCH
/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/com.apple.DeveloperTools/5.0-5A1413/Xcode/SharedPrecompiledHeaders/facebook_ios_sdk_Prefix-eeghlwplbbpvmudycetfsuytcqmf/facebook_ios_sdk_Prefix.pch.pch
facebook_ios_sdk_Prefix.pch normal arm64 objective-c
com.apple.compilers.llvm.clang.1_0.compiler (1 failure) make[1]: *
[libFacebook-arm64.a] Error 65 make: * [build-binding] Error 2
Any ideas?

Ok, finally found the answer myself and posting it here in case others have the same problem.
The make file downloads the Facebook Obj C project automatically
The "BASE SDK" of this project is set to iOS7, the 64bit deployment targets are also set to iOS7, the 32bit deployment targets are set to iOS5
It then builds the Monotouch DLL with the binding project
This targets 64bit, which is not supported on iOS5
So basically, the "make" will not work. You first need to change all deployments targets in the project to iOS7. See screenshot below.
Probably there is a better solution that also supports earlier versions then iOS7, because the Obj C project is using different targets for 32bit (iOS5) and 64bit (iOS7) and my solution now only targets iOS7.

Related

How to fix: "ABI filter 'arm64-v8a' is no longer supported in NDK version x"

I'm setting up an android project from another company which involves selfmade C++ cross platform libraries. For an older version of these libraries an complete app project was made in java with a jni interface to access these libraries, which are stored as their own modules with gradle.build files. The goal is to get the app compiling for arm64-v8a architecture because of the Google requirements for app update.
The project is set up with:
gradle experimental plugin 0.11.0
gradle plugin 4.1
boost 1.64.0 for armeabi-v7a (got arm64-v8a precompiled libraries as replacement)
opencv 2.4.13.2
ndk r15c
I checked all dependencies for getting a arm64 pendant, which was only needed for the boost dependencies.
I tried changing the ABI list which is used for every project to include all architectures or all seperatly. I tried using other ndk versions. What might help but i didn't accomplish was changing the experimental gradle plugin to the normal plugin but i couldn't get that right.
I expected some compiling or linking errors but it only tells me "ABI filter 'arm64-v8a' is no longer supported in NDK version r15.2.4203891.". If i try other architectures i get the same error, but instead of the 'arm64-v8a' the current selected architecture. If i give an invalid architecture it changes to "Target ABI 'hello' is not supported.", so it recognizes the architecture i think.
Stacktrace of first error:
A problem occurred configuring project ':app'.
Exception thrown while executing model rule: NdkComponentModelPlugin.Rules#configureNativeLibrary(ModelMap, NdkConfig, NdkHandler, ModelMap, File, ServiceRegistry) > create(livestage) > withType()
Exception thrown while executing model rule: NdkComponentModelPlugin.Rules#configureNativeLibrary(ModelMap, NdkConfig, NdkHandler, ModelMap, File, ServiceRegistry) > create(lib-jni-cxx) > withType()
Exception thrown while executing model rule: NdkComponentModelPlugin.Rules#configureNativeBinary(BinaryContainer, ModelMap, NdkConfig, NdkHandler) > withType()
ABI filter 'arm64-v8a' is no longer supported in NDK version r15.2.4203891.
The experimental plugin hasn't been supported for years, so it's no surprise that it doesn't work. Migrate to externalNativeBuild: https://developer.android.com/studio/projects/add-native-code

Unable to build NDK project from latest Android Studio (version 2.1.2, Windows 64 bit)

I am unable to build a NDK project from the Android Studio environment but can build it manually using the command console.
I get the following error after building:
Error:Execution failed for task ':xxxxxx:compileReleaseNdk'.> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\xxxxx\AppData\Local\Android\SDK\android-sdk\ndk-bundle\ndk-build.cmd'' finished with non-zero exit value 2
I got a similar error while invoking ndk-build.cmd manually using the console from the jni directory where my NDK project is stored.However I fixed it by modifying the following in my Application.mk file as follows:
NDK_TOOLCHAIN_VERSION := 4.9
since 4.9 is the tool chain available on my install. I suspect from the Android Studio environment, the toolchain version is being picked incorrectly, and yet I do not know where to set this option in the GUI.
The build.gradle file has the following NDK block:
ndk{
moduleName "xxxxxx"
ldLibs "log"
cFlags "-std=c++11 -fexceptions"
stl "gnustl_static"
abiFilters "arm64-v8a armeabi armeabi-v7a mips mips64 x86 x86_64"
}
Please advise me on how to go about solving this problem.
Just out of curiosity, I moved my project directory to the desktop and tried to build that project. The build was successful.
Finally narrowed down the problem to the NDK compiler not being able to create the following intermediate object file inside my project folder:
C:\Users\xxxxx\GitRepos\REVIEWS\xxx\SMART-xxx\xxxx-xxx-androidnative\xxxLibraries\xxxlibrary\build\intermediates\ndk\debug\obj/local/arm64-v8a/objs/natXXXX/C_\Users\xxxxx\GitRepos\REVIEWS\xxx\SMART-xxxx\xxxx-xxx-androidnative\xxxLibraries\xxxlibrary\src\main\jni\NativeXXXX.o.d
The reason was the well known windows path cannot exceed 255 characters issue. As you can see above the NDK-Build utility tries to append a deep folder hierarchy like "C_\Users\xxxxx\GitRepos\REVIEWS\xxx\SMART-xxxx\xxxx-xxx-androidnative\xxxLibraries\xxxlibrary\src\main\jni\" which exceeds MAX_PATH.

Undefined "___divmodsi4" linking Monotouch project with static library in release mode

I have a Monotouch project linked to a static library containing C++ modules.
Monotouch version: 3.0.3.5
XCode version: 4.4.1
C/C++ Compiler: Apple LLVM 4.0
When building the project in debug mode for iOS simulator and iOS device everything is OK -
application is linked and runs.
However when building the release configuration for iOS device the following error appears:
Undefined symbols for architecture armv7: "___divmodsi4"
The following line from the static library code somehow causes the trouble:
int number_of_buckets = num_samples / window_samples_step;
If this line is modified as follows the problem disappears:
int number_of_buckets = (int)((float)num_samples / (float)window_samples_step);
Do you have any ideas how to fix the problem without the above modification?
Thanks,
Ury.
This occurs near the end of the build and generally depends on it's original parameters. Try to compare your options between your Release and Debug builds and check that:
you are using the same Additional mtouch arguments on both configuration;
you are using the same compiler, Mono AOT versus LLVM compilers, on both configuration;
you are using the same architecture, ARMv6 versus ARMv7, on both configuration.
Otherwise attach (e.g. preferable to a bug report or pastebin) the full build log (from the Build Output of MonoDevelop's Error Pad) for both Debug and Release builds.
To be more helpful add "-v -v -v" to the Additional mtouch arguments before re-building. This will augment the verbosity (details) about each steps.
You need to set the app's Deployment Target (in the project's options, Build / iPhone Application page) to at least 5.0.

evaluation version of monotouch failing to build to native code

this is Ajit.
I tried downloading the trial version of monotouch from the website but all the links were broken.
So I downloaded the following by digging from google.
()MonoDevelop-3.0.3.5
()MonoFramework-MRE-2.10.9_11.macos10.xamarin.x86.dmg
(*)Monotouch-eval-5.1.0.pkg
but after doing so when I run a sample ios app from the xamarin website only then it fails to build -> not being able to compile to native code.
This is error log.
Building Solution: HelloWorld_iPhone (Debug|iPhoneSimulator)
Building: HelloWorld_iPhone (Debug|iPhoneSimulator)
Performing main compilation...
/Developer/MonoTouch/usr/bin/smcs /noconfig "/out:/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/bin/iPhoneSimulator/Debug/HelloWorld_iPhone.exe" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" /nologo /warn:4 /debug:full /optimize- /codepage:utf8 "/define:DEBUG" /t:exe "/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/Main.cs" "/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/AppDelegate.cs" "/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/HelloWorld_iPhoneViewController.cs" "/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/HelloWorld_iPhoneViewController.designer.cs"
Copying content files
Copying '/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/Images/Icons/57_icon.png' to '/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/bin/iPhoneSimulator/Debug/HelloWorld_iPhone.app/57_icon.png'
Copying '/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/Images/Icons/114_icon.png' to '/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/bin/iPhoneSimulator/Debug/HelloWorld_iPhone.app/114_icon.png'
Copying '/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/Images/Icons/72_icon.png' to '/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/bin/iPhoneSimulator/Debug/HelloWorld_iPhone.app/72_icon.png'
Copying '/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/Images/Icons/29_icon.png' to '/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/bin/iPhoneSimulator/Debug/HelloWorld_iPhone.app/29_icon.png'
Copying '/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/Images/Icons/58_icon.png' to '/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/bin/iPhoneSimulator/Debug/HelloWorld_iPhone.app/58_icon.png'
Copying '/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/Images/Icons/50_icon.png' to '/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/bin/iPhoneSimulator/Debug/HelloWorld_iPhone.app/50_icon.png'
Build complete -- 0 errors, 0 warnings
Compiling to native code
/Developer/MonoTouch/usr/bin/mtouch -v --nomanifest --nosign -sim "/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/bin/iPhoneSimulator/Debug/HelloWorld_iPhone.app" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" -debug -nolink -sdk "5.1" "/Users/PBSK/Desktop/HelloWorld_iPhone/HelloWorld_iPhone/bin/iPhoneSimulator/Debug/HelloWorld_iPhone.exe"
This feature is not supported in the evaluation version
No gcc compiler found!
mtouch exited with code 1
---------------------- Done ----------------------
Build: 1 error, 0 warnings
Xcode version is 4.4 and Mac version is 10.7.4.
-Thanks!
but all the links were broken
Please email support#xamarin.com if you have any issues with the website.
Monotouch-eval-5.1.0.pkg
This is an pretty old, beta version of MonoTouch.
MonoTouch 5.2.12 is the current stable release while 5.3.5 is the current unstable release.
No gcc compiler found
This means no C compiler was found. In general you should make sure your MonoDevelop preferences (SDK Locations) are set the point to your Xcode installation directory.
However in this case I think your MonoTouch version is too old to work with Xcode 4.4. Updating your evaluation version to 5.2.12 is the first step you should try to fix this.
Below is the manual installation for MonoTouch evaluation which FINALLY works!:
Download and install packages listed below, in the order given:
1) Mono: http://download.mono-project.com/archive/2.10.9/macos-10-x86/10/MonoFramework-MDK-2.10.9_10.macos10.xamarin.x86.dmg
2) MonoDevelop: http://download.xamarin.com/monodevelop/Mac/MonoDevelop-3.0.dmg
3) Eval MonoTouch: http://download.xamarin.com/priv/d6d0ad447c01dd2bbbbbba829f6e1a/MonoTouch/Mac-eval/monotouch-eval-5.2.11.pkg
For the above mentioned environment this combination works like magic.
Just hope that they'll fix the broken links on their site too or else many other newbies would continue to get discouraged.
Thanks to support people of Xamarin who shared these links.

Compiling pjsip for iOS 4.0

I've been having issues with compiling pjsip for iOS 4.0.
I am using the latest trunk version from SVN and keep getting a portaudio error. When using the piedmontwireless guide: http://www.piemontewireless.net/PJSip155_and_iPhoneSDK312 I get a missing separator error in my build.mak file, which would indicate a whitespace/tabbing error, but for the life of me I cannot find it.
According to the pjsip mailing lists, you should be able to compile out of the box for iOS 4.0, but I get this error:
../src/pjmedia-audiodev/errno.c:23:26: error: portaudio.h: No such file or directory
../src/pjmedia-audiodev/errno.c: In function ‘pjmedia_audiodev_strerror’:
../src/pjmedia-audiodev/errno.c:104: warning: implicit declaration of function ‘Pa_GetErrorText’
make[2]: *** [output/pjmedia-audiodev-arm-apple-darwin9/errno.o] Error 1
make[1]: *** [pjmedia-audiodev] Error 2
I'll keep punching through this but any help would be really appreciated.
EDIT: I do have portaudio.h
The specific step you are missing is to have a config_site.h file in the proper location.
pjlib/include/pj/config_site.h
It needs to contain the following:
#define PJ_CONFIG_IPHONE 1
#include <pj/config_site_sample.h>
So the configuration will avoid libraries that are not needed or won't compile for the arm chip in the iPhone.
After this addition start over with:
./configure-iphone
and then
make dep && make clean && make
./configure-iphone
Fresh from SVN
Configurations for current target have been written to 'build.mak', and 'os-auto.mak' in various build directories, and pjlib/include/pj/compat/os_auto.h.
Further customizations can be put in:
- 'user.mak'
- 'pjlib/include/pj/config_site.h'
The next step now is to run 'make dep' and 'make'.
Done configuring for iPhoneOS4.2.sdk
Shouldn't ./configure-iphone setup pjlib/include/pj/config_site.h
As
#define PJ_CONFIG_IPHONE 1
#include <pj/config_site_sample.h>
Thanks for the fix #Schroedinger

Resources