Bug 57068 - Error: linker command failed with exit code 1
Summary: Error: linker command failed with exit code 1
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 10.10 (d15-2)
Hardware: PC Mac OS
: --- normal
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
Depends on:
Reported: 2017-06-01 19:10 UTC by nazar
Modified: 2017-06-08 08:47 UTC (History)
6 users (show)

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

Test project (47.91 KB, application/zip)
2017-06-01 19:10 UTC, nazar

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:

Description nazar 2017-06-01 19:10:14 UTC
Created attachment 22631 [details]
Test project

So I've tried to create the bare binding project, to reproduce the issue with generating interfaces, and faced the following issues:

- clang Error: linker command failed with exit code 1 (use -v to see invocation) (TestProjectConsumer)
- MTOUCH: Error MT5216: Native linking failed for '/Users/nazar/Documents/scichart_root/TestProjectBindingLib/TestProjectConsumer/obj/iPhone/Debug/device-builds/iphone9.4-10.3.1/mtouch-cache/arm64/libTestProjectBindingLib.dll.dylib'. Please file a bug report at http://bugzilla.xamarin.com (MT5216) (TestProjectConsumer)

Please see attached projects and system details below.

Hopefully, you can help us as soon as possible 

System details

Visual Studio Community 2017 for Mac
Version 7.0.1 (build 24)
Installation UUID: bcd7446a-2da8-46e3-a77f-108755216a5a
	Mono (2017-02/5077205) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 500010001


.NET Core
Runtime: Not installed
SDK: Not installed
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/msbuild/15.0/bin/Sdks

'/Applications/Xamarin Profiler.app' not found

Apple Developer Tools
Xcode 8.3.2 (12175)
Build 8E2002

Version: (Visual Studio Community)
Android SDK: /Users/nazar/Library/Android/sdk
	Supported Android versions:
		7.1 (API level 25)

SDK Tools Version: 26.0.1
SDK Platform Tools Version: 25.0.5
SDK Build Tools Version: 25.0.2

Java SDK: /usr
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

Android Designer EPL code available here:

Version: (Visual Studio Community)
Hash: d2270eec
Branch: d15-2
Build date: 2017-05-22 16:30:53-0400

Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.

Xamarin Inspector
Not Installed

Build Information
Release ID: 700010024
Git revision: 7ab1ca2ced6f584e56b7a0d4d321d00775cd95c9
Build date: 2017-05-19 05:44:51-04
Xamarin addins: 08d17158f3365beee5e60f67999e607cce4b3f93
Build lane: monodevelop-lion-d15-2

Operating System
Mac OS X 10.12.5
Darwin 16.6.0 Darwin Kernel Version 16.6.0
    Fri Apr 14 16:21:16 PDT 2017
    root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64
Comment 1 nazar 2017-06-07 08:41:28 UTC
Are there any ideas what am I doing wrong?
Comment 2 Manuel de la Peña [MSFT] 2017-06-07 10:28:54 UTC
Adding @alex in cc since he is a good point of contact for bindings.
Comment 3 Alex Soto [MSFT] 2017-06-07 15:22:44 UTC
The issue is that it can't load the ObjectBuilder class because it does not exist in the native library, this happens because the library wasn't built correctly

>    Undefined symbols for architecture arm64:
>      "_OBJC_CLASS_$_ObjectBuilder", referenced from:
>         -u command line option
>    ld: symbol(s) not found for architecture arm64
>    clang : error : linker command failed with exit code 1 (use -v to see invocation)

You can see what it is in the library using nm

> TestProject.framework nm -Umo TestProject
> TestProject: 0000000000007c98 (__TEXT,__text) non-external -[Interface isInterface]
> TestProject: 0000000000007cc8 (__TEXT,__text) non-external -[Interface setIsInterface:]
> TestProject: 0000000000008500 (__DATA,__objc_data) external _OBJC_CLASS_$_Interface
> TestProject: 00000000000084d0 (__DATA,__objc_ivar) non-external (was a private external) _OBJC_IVAR_$_Interface.isInterface
> TestProject: 00000000000084d8 (__DATA,__objc_data) external _OBJC_METACLASS_$_Interface
> TestProject: 0000000000007fa8 (__TEXT,__const) external _TestProjectVersionNumber
> TestProject: 0000000000007f78 (__TEXT,__const) external _TestProjectVersionString

I think this is happening because while ObjectBuilder is declared in a header, it lacks the implementation.
Comment 4 nazar 2017-06-08 08:47:46 UTC
Hi Alex,

You are definitely right, I was sure that it's there.

Thanks for pointing me and now I created the ticket (https://bugzilla.xamarin.com/show_bug.cgi?id=57268) with an essential problem for us, could you take a look? 

Thanks in advance.