Embeddinator-4000 icon indicating copy to clipboard operation
Embeddinator-4000 copied to clipboard

[ObjC] Embeddinating a Mac dll as shared library causes following error...

Open equinox2k opened this issue 7 years ago • 2 comments

Embeddinating a Mac dll as shared library causes following error...

objcgen.exe --debug --platform=macosmodern --abi=x86_64 --target=sharedlibrary --outdir=output --compile PNIPhotoLibraryEmbedded.dll

Creating output directory `/Users/petertribe/Documents/Git/PNI.Mobile.Xamarin.Research/PNI.Photo.Library.Embedded/PNI.Photo.Library.Embedded.Mac/output`
Parsing assemblies...
	Parsed '/Users/petertribe/Documents/Git/PNI.Mobile.Xamarin.Research/PNI.Photo.Library.Embedded/PNI.Photo.Library.Embedded.Mac/bin/Debug/PNIPhotoLibraryEmbedded.dll'
Processing assemblies...
	2 types found
Generating binding code...
	Generated: output/bindings.h
	Generated: output/bindings-private.h
	Generated: output/bindings.m
	Generated: output/bindings.xml
	Generated: output/embeddinator.h
	Generated: output/glib.h
	Generated: output/mono_embeddinator.h
	Generated: output/mono-support.h
	Generated: output/objc-support.h
	Generated: output/glib.c
	Generated: output/mono_embeddinator.c
	Generated: output/objc-support.m
	Generated: output/Make.config
Compiling binding code...
Found Mono 5.4.1.4 (between 5.0.0.18 and 5.2.99)
Found Xamarin.Mac 4.0.0.93 (between 3.5.0.144 and 3.5.0.144)
	xcode-select -p
	xcrun clang -g -O0 -fobjc-arc -ObjC -Wall -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -mmacosx-version-min=10.7 -I/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/include -DXAMARIN_MAC -DMONO_EMBEDDINATOR_DLL_EXPORT  -c output/glib.c -o output/x86_64/glib.o 
	xcrun clang -g -O0 -fobjc-arc -ObjC -Wall -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -mmacosx-version-min=10.7 -I/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/include -DXAMARIN_MAC -DMONO_EMBEDDINATOR_DLL_EXPORT  -c output/mono_embeddinator.c -o output/x86_64/mono_embeddinator.o 
	xcrun clang -g -O0 -fobjc-arc -ObjC -Wall -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -mmacosx-version-min=10.7 -I/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/include -DXAMARIN_MAC -DMONO_EMBEDDINATOR_DLL_EXPORT  -c output/objc-support.m -o output/x86_64/objc-support.o 
	xcrun clang -g -O0 -fobjc-arc -ObjC -Wall -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -mmacosx-version-min=10.7 -I/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/include -DXAMARIN_MAC -DMONO_EMBEDDINATOR_DLL_EXPORT  -c output/bindings.m -o output/x86_64/bindings.o 
	xcrun clang -g -O0 -fobjc-arc -ObjC -Wall -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -mmacosx-version-min=10.7 -I/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/include -DXAMARIN_MAC -dynamiclib  -lobjc -framework CoreFoundation -framework Foundation -install_name @rpath/libPNIPhotoLibraryEmbedded.dylib output/x86_64/glib.o output/x86_64/mono_embeddinator.o output/x86_64/objc-support.o output/x86_64/bindings.o -o output/x86_64/libPNIPhotoLibraryEmbedded.dylib -L/Library/Frameworks/Mono.framework/Versions/Current/lib/ -lmonosgen-2.0 
Undefined symbols for architecture x86_64:
  "_xamarin_initialize_embedded", referenced from:
      _mono_embeddinator_init in mono_embeddinator.o
  "_xamarin_open_assembly", referenced from:
      _mono_embeddinator_load_assembly in mono_embeddinator.o
      _mono_embeddinator_find_assembly_in_bundle in objc-support.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Done
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Deleting expired sessions...none found.

[Process completed]

equinox2k avatar Nov 07 '17 19:11 equinox2k

I can confirm this with latest master.

In general, framework is the preferred mechanism (should we disable this?) but in any case it shouldn't have this failure mode.

chamons avatar Mar 21 '18 16:03 chamons

So with https://github.com/mono/Embeddinator-4000/pull/627 we're at least warning that this is unsupported and pointing people to use frameworks.

I'm not going to close this, since dylibs are broken, but it's much lower priority.

chamons avatar Mar 21 '18 19:03 chamons