ServiceStack Monotouch iPhone/Release Build Fails - xamarin.ios

UPDATE - This indeed fails only in release builds, but only when the LLVM compiler option is used. Creating a self-contained test case for Xamarin that I'll post as the answer.
I have a project which uses the ServiceStack.Common.Monotouch.dll, ServiceStack.Interfaces.Monotouch.dll, and ServiceStack.Text.Monotouch.dll. I can build this project in Simulator/Release & Debug, and iPhone/Debug, but when I build in iPhone/Release, I get the following error:
...
MONO_PATH=/Users/pseabury/Projects/IMDSS_iOS/IMDSSMobile_iOS/bin/iPhone/Release/IMDSSMobile_iOS.app /Developer/MonoTouch/usr/bin/arm-darwin-mono --llvm --aot=mtriple=armv7-darwin,full,static,asmonly,nodebug,llvm-path=/Developer/MonoTouch/LLVM/bin/,outfile=/var/folders/mt/b7h3_pgs3lxgpvpm2h1_2ppc0000gn/T/tmp39b8b8c7.tmp/System.Data.dll.7.s "/Users/pseabury/Projects/IMDSS_iOS/IMDSSMobile_iOS/bin/iPhone/Release/IMDSSMobile_iOS.app/System.Data.dll"
AOT Compilation exited with code 134, command:
MONO_PATH=/Users/pseabury/Projects/IMDSS_iOS/IMDSSMobile_iOS/bin/iPhone/Release/IMDSSMobile_iOS.app /Developer/MonoTouch/usr/bin/arm-darwin-mono --llvm --aot=mtriple=armv7-darwin,full,static,asmonly,nodebug,llvm-path=/Developer/MonoTouch/LLVM/bin/,outfile=/var/folders/mt/b7h3_pgs3lxgpvpm2h1_2ppc0000gn/T/tmp39b8b8c7.tmp/ServiceStack.Text.MonoTouch.dll.7.s "/Users/pseabury/Projects/IMDSS_iOS/IMDSSMobile_iOS/bin/iPhone/Release/IMDSSMobile_iOS.app/ServiceStack.Text.MonoTouch.dll"
Mono Ahead of Time compiler - compiling assembly /Users/pseabury/Projects/IMDSS_iOS/IMDSSMobile_iOS/bin/iPhone/Release/IMDSSMobile_iOS.app/ServiceStack.Text.MonoTouch.dll
* Assertion at ../../../../../mono/mono/mini/mini-llvm.c:4535, condition `LLVMTypeOf (values [sreg1]) == LLVMTypeOf (values [phi->dreg])' not met
...
mtouch exited with code 1
If necessary I can put together an example project, but all you should need is the latest ServiceStack dlls or sources for Monotouch and a sample/contrived DTO for a ServiceClient in order to reproduce this.

Bug submitted to Xamarin - https://bugzilla.xamarin.com/show_bug.cgi?id=6066 .

Related

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.

How much the libgit2 test failed? (How should I interpret the results?)

I have fetched/merged the last changes from the libgit2 repository (the commit 4ae29053d5), created the build subdirectory, and compiled the library on Windows 7 using Visual Studio 2010 this way:
e:\Software\libgit2\build>cmake .. -G"Visual Studio 10" -DTHREADSAFE=ON -DSTDCALL=OFF
-- The C compiler identification is MSVC 16.0.40219.1
-- Check for working C compiler using: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
zlib was not found; using bundled 3rd-party sources.
-- Found PythonInterp: c:/Python26/python.exe (found version "2.6.5")
-- Configuring done
-- Generating done
-- Build files have been written to: E:/Software/libgit2/build
e:\Software\libgit2\build>cmake --build .
Microsoft (R) Visual Studio Version 10.0.40219.1.
Copyright (C) Microsoft Corp. All rights reserved.
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
1> Checking Build System
1> CMake does not need to re-run because E:/Software/libgit2/build/CMakeFiles/g
enerate.stamp is up-to-date.
2>------ Build started: Project: git2, Configuration: Debug Win32 ------
3>------ Build started: Project: libgit2_clar, Configuration: Debug Win32 ------
2> Building Custom Rule E:/Software/libgit2/CMakeLists.txt
2> CMake does not need to re-run because E:\Software\libgit2\build\CMakeFiles\g
enerate.stamp is up-to-date.
2> precompiled.c
3> Building Custom Rule E:/Software/libgit2/CMakeLists.txt
[...]
3> renames.c
3> submodules.c
3> lookup.c
3> status.c
3> basic.c
3> trace.c
3> Creating library E:/Software/libgit2/build/Debug/libgit2_clar.lib and obj
ect E:/Software/libgit2/build/Debug/libgit2_clar.exp
3> Creating library E:/Software/libgit2/build/Debug/libgit2_clar.lib and obj
ect E:/Software/libgit2/build/Debug/libgit2_clar.exp
3> libgit2_clar.vcxproj -> E:\Software\libgit2\build\Debug\libgit2_clar.exe
4>------ Build started: Project: ALL_BUILD, Configuration: Debug Win32 ------
4> Building Custom Rule E:/Software/libgit2/CMakeLists.txt
4> CMake does not need to re-run because E:\Software\libgit2\build\CMakeFiles\g
enerate.stamp is up-to-date.
4> Build all projects
========== Build: 4 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Everything seems OK. When launching the test, it fails:
e:\Software\libgit2\build>ctest -V
UpdateCTestConfiguration from :E:/Software/libgit2/build/DartConfiguration.tcl
UpdateCTestConfiguration from :E:/Software/libgit2/build/DartConfiguration.tcl
Test project E:/Software/libgit2/build
Constructing a list of tests
Done constructing a list of tests
Checking test dependency graph...
Checking test dependency graph end
test 1
Start 1: libgit2_clar
1: Test command: E:\Software\libgit2\build\Debug\libgit2_clar.exe "-ionline"
1: Test timeout computed to be: 9.99988e+006
1: Loaded 195 suites:
1: Started
1:
1: attr::file....
1: attr::flags...
1: attr::ignore.....
[...]
1: status::submodules......
1: status::worktree..................................
1: status::worktree::init........
1: submodule::lookup.....
1: submodule::modify....
1: submodule::status.......
1: threads::basic.
1: trace::trace......
1:
1: 1) Failure:
1: diff::workdir::submodules [..\tests-clar\diff\workdir.c:825]
1: 33 != exp.lines
1: 33 != 35
1:
1/1 Test #1: libgit2_clar .....................***Failed 250.12 sec
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 250.20 sec
The following tests FAILED:
1 - libgit2_clar (Failed)
Errors while running CTest
Is it a know situation? It seems that a lot of (sub)tests passed. I do not know the test framework. Does the messages at the end mean that only the diff::workdir::submodules failed?
I do not know the test framework.
Libgit2 relies on the Clar test framework.
Does the messages at the end mean that only the diff::workdir::submodules failed?
Yes. More precisely, it points you to the failing assertion
Is it a known situation?
No. The libgit2 team works hard to always have the tests passing.
I've tried locally and I cannot reproduce this issue. This gist contains the build and test run against libgit2#4ae29053.
This has been run on Win 7 (32 bits) platform against Visual Studio 2010 as well.
The only difference I see is that you're running an older version of Python, but that shouldn't be a problem. Clar relies on Python to generate the test suite (more info about this in the README file of the project) and supports Python back to version 2.5.
If you can successfully reproduce this failure, please open an issue in the libgit2 issue tracker as this may require a more deeper troubleshooting that may not fit to the StackOverflow format.

Error when compiling with luajit and lua-iup libs [visual c++ 2012]

I wrote an app with luajit and lua-iup, and link my app with static libs. But I got the following error:
------ Build started: Project: ConsoleApplication1, Configuration: Release Win32 ------
Creating library C:\Users\root\Documents\Visual Studio 2012\Projects\ConsoleApplication1\Release\ConsoleApplication1.lib and object C:\Users\root\Documents\Visual Studio 2012\Projects\ConsoleApplication1\Release\ConsoleApplication1.exp
iup.lib(iupwindows_main.obj) : error LNK2001: unresolved external symbol _main
C:\Users\root\Documents\Visual Studio 2012\Projects\ConsoleApplication1\Release\ConsoleApplication1.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Am I missing some libs and any idea about this?
As far as I know, IUP's Lua bindings are partially written in Lua. That wouldn't ordinarily be a problem, except that the Lua parts are compiled into the library as pre-compiled bytecode. Lua bytecode and LuaJIT bytecode are different.
The right answer is to change IUP so that it builds with Lua source compiled in rather than bytecode. That will conceivably slow down the startup of an IUP application, but it will make it easier to cross compile IUP and make it possible to use LuaJIT instead of standard Lua.
Here is the answer form the author of IUP, hope this would be helpful to someone that met the same problem as me
It seems that you are building a console application. This means you
need a “main” function. If you try instead to build a Windows
application without a console, then IUP will implement the WinMain
function for you and call your “main” function. In both cases you need
the “main” function.

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.

Resources