Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Our iPhone app needs to link to libsqlcipher.a.
We therefore need to get a copy of it onto the Mac Build Agent.
The only way to do this appears to be to include the file in a project and specify ‘Build Action’ = ‘Copy Always’. The problem with this is that it then gets included in the .ipa which is forbidden by Apple.
As far as I can tell, this ultimately means that it is impossible to link to external libraries and build a valid .ipa using a Mac Build Agent (unless the file exists in library location on the Mac beforehand, which will cause issues with versioning).
Here’s the build error / location that the Mac Build Agent is looking in:
"E:\CCNet\Projects\NativeApps\iPhone\trunk\Source\Psonar.Apps\Psonar.Apps.iOS\Psonar.Apps.iOS.sln" (Build target) (1) ->
"E:\CCNet\Projects\NativeApps\iPhone\trunk\Source\Psonar.Apps\Psonar.Apps.iOS\Psonar.Apps.iOS.PayPerPlay\Psonar.Apps.iOS.PayPerPlay.csproj" (default target) (2) ->
(_CompileToNative target) ->
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(700,3): error : Native linking error: file not found: /Users/xamarin/Library/Caches/Xamarin/mtbs/builds/Psonar.Apps.iOS.PayPerPlay/7cdd1df85a45ad5f48dd019c66ecc69b/libsqlcipher.a [E:\CCNet\Projects\NativeApps\iPhone\trunk\Source\Psonar.Apps\Psonar.Apps.iOS\Psonar.Apps.iOS.PayPerPlay\Psonar.Apps.iOS.PayPerPlay.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(700,3): error : Native linking failed. Please review the build log and the user flags provided to gcc: -L/Users/xamarin/Library/Caches/Xamarin/mtbs/builds/Psonar.Apps.iOS.PayPerPlay/7cdd1df85a45ad5f48dd019c66ecc69b -L/usr/lib -licucore -lsqlcipher -force_load /Users/xamarin/Library/Caches/Xamarin/mtbs/builds/Psonar.Apps.iOS.PayPerPlay/7cdd1df85a45ad5f48dd019c66ecc69b/libsqlcipher.a [E:\CCNet\Projects\NativeApps\iPhone\trunk\Source\Psonar.Apps\Psonar.Apps.iOS\Psonar.Apps.iOS.PayPerPlay\Psonar.Apps.iOS.PayPerPlay.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(700,3): error : Native linking failed. Please review the build log. [E:\CCNet\Projects\NativeApps\iPhone\trunk\Source\Psonar.Apps\Psonar.Apps.iOS\Psonar.Apps.iOS.PayPerPlay\Psonar.Apps.iOS.PayPerPlay.csproj]
We're building using MSBuild and CC.NET on Windows Server 2008 R2.
What you need to do instead is to include libsqlcipher.a as a Native Reference. I'm not sure what the UI for Visual Studio is for this (I'm on a Mac), but in Xamarin Studio, it looks like this:
1. Right-click on the project
2. Move your mouse down to the "Add >" submenu
3. Select "Add Native Reference"
At this point a dialog pops up and allows you to select a file. Select the libsqlcipher.a file.
This will create a "Native References" folder in your Solution tree and add the "libsqlcipher" native library, resulting in a view like this:
If you right-click "libsqlcipher", you'll get a context menu that allows you to select "Properties" which you can use to specify all of the linker flags:
If Visual Studio doesn't have this functionality, then I'll move this over to the VS team to implement. The msbuild functionality is there, though, and this all works.
@Richad let us know if you were able to fix your issue :)
I think it fixed it - thanks!
I'm now working through other issues though. The current one is missing files:
(_CopyResourcesToBundle target) ->
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(411,3): error : System.IO.FileNotFoundException: /Users/xamarin/Library/Caches/Xamarin/mtbs/builds/Psonar.Apps.iOS.PayPerPlay/7cdd1df85a45ad5f48dd019c66ecc69b/obj/iPhone/Production-Release-AppStore/optimized/Images/Menu/notificationIcon_empty@2x.png does not exist [E:\CCNet\Projects\NativeApps\iPhone\trunk\Source\Psonar.Apps\Psonar.Apps.iOS\Psonar.Apps.iOS.PayPerPlay\Psonar.Apps.iOS.PayPerPlay.csproj]
I think this might be related to the Build Action / Copy to Output Directory settings. We have some files as:
Build Action = Content
Copy to Output Directory = Do Not Copy
and some as:
Build Action = BundleResource
Copy to Output Directory = Do Not Copy
It seems to work when building in Xamarin Studio but not using MSBuild.
What's the difference? Should it matter what these settings are?
Are you still seeing this issue? And if so, could you provide a full build log for what's happening?
Jeffrey's solution worked and so the .ipa now builds, however it crashes during startup - we're having problems working out why.
It builds fine from Xamarin studio on a Mac though.
Comparing the .ipa files using Windiff doesn't shed any light on the situation - there are no files obviously missing, for example.
I'll attach build & device logs shortly.
Created attachment 18942 [details]
installation / crash on startup log
When I build our app with CC.NET, the .ipa builds and appears to install successfully but then it crashes on startup.
Can you see anything in this log which might indicate what's going wrong?
Device: iPhone 5 (Model A1429)
OS version: 9.3.4 (13G35)
Created attachment 18943 [details]
device crash log
Here's the device crash log too.
So let me recap:
1. The initial issue for this bug was: "Unable to build a valid .ipa using Mac Build Agent and linking to an external library".
Jeff gave the right answer by recommending to include the library as a Native Reference.
You said it solved the issue. Based on that this bug should be closed.
Note: when you have unrelated issues it's best to open a new bug and/or also ask on the forums where you might get an even quicker answer.
2. You seemed to have build issues based on notificationIcon_empty@2x.png but since comment 5 is about startup issue I assumed you fixed the build issues :P
3. So you gave us some startup logs, I can see an exception being thrown:
Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Could not load NIB in bundle: 'NSBundle </var/containers/Bundle/Application/41612C73-C2F8-44C1-8DD2-88E99F10044A/PsonarAppsiOSPayPerPlay.app> (loaded)' with name '
That can sometimes happen when files are corrupted, have been renamed and removing, adding them / recreating them might solve the issue. In your case you're having issues with one of your xib, now we don't have your solution (or a test case to be able to indicate exactly where/what the issue is). You might also want to check your csproj to see if your files have the right names.
Since this original bug is now fixed I'm gonna close it.
If you're still experiencing the issue rest assured we will help you find the answer but I will have to ask you to create a new bug for that including:
- Your XS/VS about information.
- All logs (build output, application output, device logs...).
- Potentially a test case or your original solution that you can send privately.
Apologies for the delay!
Taking your points in turn:
1 - OK!
2 - the build issue with 'notificationIcon_empty@2x.png' only occurs when we try to build the AppStore configuration. We can build our other configurations OK - I can't see why this file is only a problem in a specific configuration. Any ideas?
3 - i'll try deleting / re-adding
I'll create a new issue once I've addressed issues 1 - 3.