Bug 24553 - Undefined symbols from Accelerate Framework
Summary: Undefined symbols from Accelerate Framework
Status: RESOLVED INVALID
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: mmp ()
Version: 1.11.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Chris Hamons
URL:
Depends on:
Blocks:
 
Reported: 2014-11-15 17:26 UTC by Frank A. Krueger
Modified: 2014-11-15 17:35 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:
Status:
RESOLVED INVALID

Description Frank A. Krueger 2014-11-15 17:26:05 UTC
I have the following definitions in my code, and they work great when I run my Mac app *not including the mono runtime*.

	[System.Runtime.InteropServices.DllImport("__Internal", EntryPoint = "dgetrf_")]
	unsafe static extern int dgetrf (int* m, int* n, double* a, int* lda, int* ipiv, int* info);

	[System.Runtime.InteropServices.DllImport("__Internal", EntryPoint = "dgetrs_")]
	unsafe static extern int dgetrs (byte *trans, int* n, int* nrhs, double* a, int* lda, int* ipiv, double* b, int* ldb, int* info);

However, if I bundle the runtime (with either linking or no linking, it doesn't seem to matter), I get the following errors:

	Merging Mono Runtime into app bundle
    /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/bin/mmp -linksdkonly -sgen "-minos=10.6" --sdkroot "/Applications/Xcode.app/Contents/Developer" -o "/Users/fak/Dropbox/Projects/Circuit/CircuitMac/bin/Release" -n "iCircuit" --profile "4.5" -a "/Library/Frameworks/Mono.framework/Versions/3.10.0/lib/mono/4.5/System.dll" -a "/Library/Frameworks/Mono.framework/Versions/3.10.0/lib/mono/4.5/System.Xml.dll" -a "/Library/Frameworks/Mono.framework/Versions/3.10.0/lib/mono/4.5/System.Core.dll" -a "/Library/Frameworks/Mono.framework/Versions/3.10.0/lib/mono/4.5/System.Xml.Linq.dll" -a "/Library/Frameworks/Mono.framework/Versions/3.10.0/lib/mono/4.5/System.Drawing.dll" -a "/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/XamMac.dll" -a "/Library/Frameworks/Mono.framework/Versions/3.10.0/lib/mono/4.5/System.Core.dll" "/Users/fak/Dropbox/Projects/Circuit/CircuitMac/bin/Release/iCircuit.exe"
    Xamarin.Mac 1.11.1 Priority Edition
    Process exited with code 1, command:
    xcrun -sdk macosx clang -mmacosx-version-min=10.6 -arch i386  -u _dgetrf_ -u _dgetrs_ -u _xamarin_release_managed_ref -u _xamarin_create_managed_ref -u _xamarin_get_block_descriptor /Library/Frameworks/Xamarin.Mac.framework/Versions/1.11.1.3/lib/libxammac.a -o /Users/fak/Dropbox/Projects/Circuit/CircuitMac/bin/Release/iCircuit.app/Contents/MacOS/iCircuit -D_THREAD_SAFE -I/Library/Frameworks/Mono.framework/Versions/3.10.0/lib/pkgconfig/../../include/mono-2.0   /Library/Frameworks/Mono.framework/Versions/3.10.0/lib/pkgconfig/../../lib/libmonosgen-2.0.a -framework AppKit -liconv -x objective-c -I/Library/Frameworks/Xamarin.Mac.framework/Versions/1.11.1.3/include -
    Undefined symbols for architecture i386:
      "_dgetrf_", referenced from:
         -u command line option
      "_dgetrs_", referenced from:
         -u command line option
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    
    error MM5103: Failed to compile. Please file a bug report at http://bugzilla.xamarin.com

In the past I forced the inclusion of the Accelerate framework with the following code, but it doesn't seem to be working its magic anymore.

	[Preserve]
	static vImageError ForceInclusionOfAccelerate ()
	{
		var src = new vImageBuffer ();
		var dest = new vImageBuffer ();
		var flags = vImageFlags.NoFlags;
		return vImage.MatrixMultiplyARGB8888 (ref src, ref dest, null, 0, null, null, flags);
	}

My versions:

=== Xamarin Studio ===

Version 5.6.2 (build 5)
Installation UUID: e51e2705-c52a-4ae8-aa07-c481d6ab8a7a
Runtime:
	Mono 3.10.0 ((detached/633e444)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000020

=== Xamarin.Android ===

Version: 4.99.0 (Enterprise Edition)
Android SDK: /Users/fak/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.4   (API level 19)
Java SDK: /usr
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

=== Apple Developer Tools ===

Xcode 6.1 (6604)
Build 6A1052d

=== Xamarin.iOS ===

Version: 8.2.0.193 (Enterprise Edition)
Hash: 959c1e4
Branch: 
Build date: 2014-10-03 00:25:37-0400

=== Xamarin.Mac ===

Version: 1.11.1.3 (Enterprise Edition)

=== Build Information ===

Release ID: 506020005
Git revision: 19bc3b64b70332bfab18faf9cf1ce7d3aa191b36
Build date: 2014-10-17 14:49:01-04

=== Operating System ===

Mac OS X 10.10.0
Darwin lepton.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 1 Frank A. Krueger 2014-11-15 17:35:47 UTC
I fixed it by using the proper path to the library:

[System.Runtime.InteropServices.DllImport(Constants.AccelerateImageLibrary, EntryPoint = "dgetrf_")]
unsafe static extern int dgetrf (int* m, int* n, double* a, int* lda, int* ipiv, int* info);

[System.Runtime.InteropServices.DllImport(Constants.AccelerateImageLibrary, EntryPoint = "dgetrs_")]
unsafe static extern int dgetrs (byte *trans, int* n, int* nrhs, double* a, int* lda, int* ipiv, double* b, int* ldb, int* info);

Marking this bug as invalid.