evaluation version of monotouch failing to build to native code - xamarin.ios

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.

Related

Which ghdl (llvm/gcc) and which VUnit are a known good combination?

I'm trying to get into the VUnit stuff and have been playing around with some tutorials which worked nicely so far. So, I became curious and found the example array_axis_vcs inside the VUnit GitHub repo. First things first, I cloned the VUnit nightly (02/13/23) and tested the example without any changes to it, using GHDL V1.0.0 which is the Ubuntu 22.04 default version. The result is that the example fails on execution of run.py *.test with the following output:
Starting lib.tb_axis_loop.test Output file: /home/me/vunit/examples/vhdl/array_axis_vcs/vunit_out/test_output/lib.tb_axis_loop.test_260bb5c8c675e898eca5dc9024a4420ede12c0bc/output.txt
******************** GHDL Bug occurred ***************************
Please report this bug on https://github.com/ghdl/ghdl/issues
GHDL release: 1.0.0 (Ubuntu 1.0.0+dfsg-6) [Dunoon edition]
Compiled with GNAT Version: 10.3.1 20211117
Target: x86_64-linux-gnu
/home/me/vunit/examples/vhdl/array_axis_vcs/
Command line: /usr/bin/ghdl-mcode --elab-run --std=08 --work=lib
--workdir=/home/me/vunit/examples/vhdl/array_axis_vcs/vunit_out/ghdl/libraries/lib
-P/home/me/vunit/examples/vhdl/array_axis_vcs/vunit_out/ghdl/libraries/vunit_lib
-P/home/me/vunit/examples/vhdl/array_axis_vcs/vunit_out/ghdl/libraries/osvvm
-P/home/me/vunit/examples/vhdl/array_axis_vcs/vunit_out/ghdl/libraries/lib tb_axis_loop tb
-gtb_path=/home/me/vunit/examples/vhdl/array_axis_vcs/src/test/
-grunner_cfg=active python runner : true,enabled_test_cases : test,output path : /home/me/vunit/examples/vhdl/array_axis_vcs/vunit_out/test_output/lib.tb_axis_loop.test_260bb5c8c675e898eca5dc9024a4420ede12c0bc/,tb path : home/me/vunit/examples/vhdl/array_axis_vcs/src/test/,use_color : true --assert-level=error Exception SYSTEM.ASSERTIONS.ASSERT_FAILURE raised Exception information: raised SYSTEM.ASSERTIONS.ASSERT_FAILURE :
ortho_code-x86-emits.adb:1724 Call stack traceback locations:
0x7f1b6d0c1542 0x5605bde1ce35 0x5605bde1ede4 0x5605bde1ff55 0x5605bde15a9f 0x5605bde15c4f 0x5605bde08ef8 0x5605bde214df 0x5605be0d0c82 0x5605be0e3957 0x5605be078bd5 0x5605be0e39b2 0x5605be0d1bef 0x5605be0bc882 0x5605be0cddbe 0x5605be0c80a0 0x5605be10db55 0x5605be04c250 0x5605bdf8469e 0x5605be1114b3 0x5605bdd3cb07 0x7f1b6cc43d8e 0x7f1b6cc43e3e 0x5605bdd3b243 0xfffffffffffffffe
******************************************************************
Ok, maybe the pretty outdated GHDL Version is a problem here? Let's try the latest GHDL nightly. Perhaps it's already solved there. That's what I thought and downloaded the latest GHDL nightly to a clean testVM and also downloaded the latest VUnit there.
Different setup, different (more interesting) issues.
VUnit appears to be unable to identify the LLVM backend of ghdl:
me#testVM:~\testprj$ python run.py *test
ERROR - Could not detect known LLVM backend by parsing 'ghdl --version' Expected to find one of dict_keys(['mcode code generator', 'llvm code generator', 'GCC back-end code generator'])
== Output of 'ghdl --version'============================================================
GHDL 3.0.0-dev (2.0.0.r1367.g803edb716) [Dunoon edition]
Compiled with GNAT Version: 10.4.0
llvm 14.0.0 code generator
Written by Tristan Gingold.
Copyright (C) 2003 - 2022 Tristan Gingold.
GHDL is free software, covered by the GNU General Public License.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =========================================================================================
For my current work, I'll go and try a prebuild docker container now, but I'm still interested in solving this issue. Any ideas? Anybody tried the actual VUnit build against the actual ghdl build? I would be interested if it is a concern on my machine or a more general difficulty. 
Greets Stefan

How do I fix "ld: error: unable to find library -lgcc" when cross-compiling rust to android?

I'm trying to get rust working on android. However, when I try to cross-compile to android I get the following linking error:
$ cargo build --target=arm-linux-androideabi
Compiling <project> v0.1.0 (<project>)
error: linking with `/opt/android-sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi31-clang` failed: exit status: 1
(very long toolchain command from cargo)
ld: error: unable to find library -lgcc
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
I have installed the ndk and changed the linker in .cargo/config to the android clang linker. I also tried the standalone toolchains with the same result. The guide I used was the following: https://mozilla.github.io/firefox-browser-architecture/experiments/2017-09-21-rust-on-android.html
Cross-compilation does work when using crate-type = ["rlib"] instead of crate-type = ["cdylib"], but I need an .so file not an .rlib file.
In case it's relevant, i'm using Manjaro Linux.
UPDATE:
I found the following pull request: https://github.com/rust-lang/rust/pull/85806 After switching to ndk22 it worked. I havn't tried if the pull request fixes the issue (probably does).
Without switching to an older NDK version, I found using the workaround provided by ssrlive to work for me. Here's their comment:
Fixing build error for NDK 23 and above
find out all the 4 folders containing file libunwind.a, in my PC,
it's
C:\Users\Administrator\AppData\Local\Android\Sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\lib64\clang\12.0.8\lib\linux\x86_64\
and more. create 4 text files named libgcc.a in the same folders
with this contents
INPUT(-lunwind)
reference
link
In macOS, the paths are
~/Library/Android/sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/14.0.1/lib/linux/i386/libunwind.a
~/Library/Android/sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/14.0.1/lib/linux/arm/libunwind.a
~/Library/Android/sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/14.0.1/lib/linux/aarch64/libunwind.a
~/Library/Android/sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/14.0.1/lib/linux/x86_64/libunwind.a
In Linux, the paths are
~/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.1/lib/linux/i386/libunwind.a
~/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.1/lib/linux/aarch64/libunwind.a
~/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.1/lib/linux/x86_64/libunwind.a
~/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.1/lib/linux/arm/libunwind.a
In Windows, the paths are
~/AppData/Local/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.1/lib/linux/aarch64/libunwind.a
~/AppData/Local/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.1/lib/linux/arm/libunwind.a
~/AppData/Local/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.1/lib/linux/i386/libunwind.a
~/AppData/Local/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.1/lib/linux/x86_64/libunwind.a
create file command in Linux/macOS
cat << EOF > libgcc.a
INPUT(-lunwind)
EOF
This is of course extremely brittle and not the "right" solution, but the workaround works fine as of 2022-10-12 with ndk version 25.1.8937393.

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

Monotouch Facebook Binding - "make" results in errors

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.

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.

Resources