Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release build fails: BLAS_LAPACK_AppStore_Workaround.mm:67:12: error: no matching function for call to 'lsamen_' #13

Closed
1agora opened this issue Apr 15, 2021 · 13 comments

Comments

@1agora
Copy link

1agora commented Apr 15, 2021

Example.app build seems to error out on Release builds only.

for simulator: SUCCESS
for actual connected device: SUCCESS
for any iOS device (arm64): FAIL

/Library/Developer/Xcode/DerivedData/Example-enfwrrnnudmnedajzbdpxbxthcuj/SourcePackages/checkouts/BLAS-LAPACK-AppStore-Workaround/Sources/BLAS-LAPACK-AppStore-Workaround/BLAS_LAPACK_AppStore_Workaround.mm:67:12: error: no matching function for call to 'lsamen_'
    return lsamen_(&n, ca, cb);
           ^~~~~~~
In file included from /Library/Developer/Xcode/DerivedData/Example-enfwrrnnudmnedajzbdpxbxthcuj/SourcePackages/checkouts/BLAS-LAPACK-AppStore-Workaround/Sources/BLAS-LAPACK-AppStore-Workaround/BLAS_LAPACK_AppStore_Workaround.mm:25:
In file included from /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.5.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h:20:
In file included from /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.5.sdk/System/Library/Frameworks/Accelerate.framework/Headers/../Frameworks/vecLib.framework/Headers/vecLib.h:55:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.5.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/clapack.h:5278:16: note: candidate function not viable: no known conversion from 'int *' to '__CLPK_integer *' (aka 'long *') for 1st argument
__CLPK_logical lsamen_(__CLPK_integer *__n, char *__ca,
               ^
1 error generated.

My app with Open3D embedded:

Archive (release): fail with same above errors.
Archive (debug): SUCCESS + uploaded to appstore - crashes on launch:

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000019e02eaa8
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [6863]
Triggered by Thread:  0

Thread 0 name:
Thread 0 Crashed:
0   libswiftCore.dylib            	0x000000019e02eaa8 _assertionFailure(_:_:file:line:flags:) + 488 (AssertCommon.swift:132)
1   libswiftCore.dylib            	0x000000019e02eaa8 _assertionFailure(_:_:file:line:flags:) + 488 (AssertCommon.swift:132)
2   TrueDepthScanning             	0x0000000100a384b8 0x100968000 + 853176
3   TrueDepthScanning             	0x0000000100a382b8 0x100968000 + 852664
4   libdispatch.dylib             	0x000000019a242280 _dispatch_client_callout + 16 (object.m:559)
5   libdispatch.dylib             	0x000000019a213cd8 _dispatch_once_callout + 28 (once.c:52)
6   libswiftCore.dylib            	0x000000019e31bd68 swift_once + 44 (once.h:111)
7   TrueDepthScanning             	0x0000000100a38748 0x100968000 + 853832
8   TrueDepthScanning             	0x0000000100a39170 static PythonLibrary.loadSymbol<A>(name:legacyName:type:) + 580 (PythonLibrary.swift:70)
9   TrueDepthScanning             	0x0000000100a34bbc 0x100968000 + 838588
10  libdispatch.dylib             	0x000000019a242280 _dispatch_client_callout + 16 (object.m:559)
11  libdispatch.dylib             	0x000000019a213cd8 _dispatch_once_callout + 28 (once.c:52)
12  libswiftCore.dylib            	0x000000019e31bd68 swift_once + 44 (once.h:111)
13  TrueDepthScanning             	0x0000000100a34c18 0x100968000 + 838680
14  TrueDepthScanning             	0x0000000100a263b8 PythonInterface.init() + 28 (Python.swift:646)
15  TrueDepthScanning             	0x0000000100a26388 one-time initialization function for Python + 12 (Python.swift:631)
16  libdispatch.dylib             	0x000000019a242280 _dispatch_client_callout + 16 (object.m:559)
17  libdispatch.dylib             	0x000000019a213cd8 _dispatch_once_callout + 28 (once.c:52)
18  libswiftCore.dylib            	0x000000019e31bd68 swift_once + 44 (once.h:111)
19  TrueDepthScanning             	0x0000000100a2092c Python.unsafeMutableAddressor + 64 (Python.swift:631)
20  TrueDepthScanning             	0x000000010097b67c Open3D.init() + 1000 (Open3D.swift:77)
@1agora 1agora changed the title BLAS_LAPACK_AppStore_Workaround.mm:67:12: error: no matching function for call to 'lsamen_' Release build fails: BLAS_LAPACK_AppStore_Workaround.mm:67:12: error: no matching function for call to 'lsamen_' Apr 15, 2021
@1agora
Copy link
Author

1agora commented Apr 15, 2021

Uploaded Example.app also crashes on launch: (Archive with Debug config...)

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000019e02eaa8
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [6911]
Triggered by Thread:  0

Thread 0 name:
Thread 0 Crashed:
0   libswiftCore.dylib            	0x000000019e02eaa8 _assertionFailure(_:_:file:line:flags:) + 488 (AssertCommon.swift:132)
1   libswiftCore.dylib            	0x000000019e02eaa8 _assertionFailure(_:_:file:line:flags:) + 488 (AssertCommon.swift:132)
2   Example                       	0x0000000102c901a8 closure #1 in variable initialization expression of static PythonLibrary.pythonLibraryHandle + 496 (PythonLibrary.swift:46)
3   Example                       	0x0000000102c8ffa8 one-time initialization function for pythonLibraryHandle + 12 (PythonLibrary.swift:43)
4   libdispatch.dylib             	0x000000019a242280 _dispatch_client_callout + 16 (object.m:559)
5   libdispatch.dylib             	0x000000019a213cd8 _dispatch_once_callout + 28 (once.c:52)
6   libswiftCore.dylib            	0x000000019e31bd68 swift_once + 44 (once.h:111)
7   Example                       	0x0000000102c90438 PythonLibrary.pythonLibraryHandle.unsafeMutableAddressor + 64 (PythonLibrary.swift:43)
8   Example                       	0x0000000102c90e60 static PythonLibrary.loadSymbol<A>(name:legacyName:type:) + 580 (PythonLibrary.swift:70)
9   Example                       	0x0000000102c8c8ac one-time initialization function for Py_Initialize + 132 (PythonLibrary+Symbols.swift:41)
10  libdispatch.dylib             	0x000000019a242280 _dispatch_client_callout + 16 (object.m:559)
11  libdispatch.dylib             	0x000000019a213cd8 _dispatch_once_callout + 28 (once.c:52)
12  libswiftCore.dylib            	0x000000019e31bd68 swift_once + 44 (once.h:111)
13  Example                       	0x0000000102c8c908 Py_Initialize.unsafeMutableAddressor + 64 (PythonLibrary+Symbols.swift:40)
14  Example                       	0x0000000102c7e0a8 PythonInterface.init() + 28 (Python.swift:646)
15  Example                       	0x0000000102c7e078 one-time initialization function for Python + 12 (Python.swift:631)
16  libdispatch.dylib             	0x000000019a242280 _dispatch_client_callout + 16 (object.m:559)
17  libdispatch.dylib             	0x000000019a213cd8 _dispatch_once_callout + 28 (once.c:52)
18  libswiftCore.dylib            	0x000000019e31bd68 swift_once + 44 (once.h:111)
19  Example                       	0x0000000102c7861c Python.unsafeMutableAddressor + 64 (Python.swift:631)
20  Example                       	0x0000000102c7322c Model.doIt() + 212 (ExampleApp.swift:44)
21  Example                       	0x0000000102c74e20 partial apply for closure #1 in closure #1 in ExampleApp.body.getter + 76 (ExampleApp.swift:24)
22  SwiftUI                       	0x00000001a0bf7228 thunk for @escaping @callee_guaranteed () -> () + 20 (<compiler-generated>:0)
23  SwiftUI                       	0x00000001a0bf7244 thunk for @escaping @callee_guaranteed () -> (@out ()) + 20 (<compiler-generated>:0)
24  SwiftUI                       	0x00000001a0bf7228 thunk for @escaping @callee_guaranteed () -> () + 20 (<compiler-generated>:0)
25  SwiftUI                       	0x00000001a0fcf260 closure #1 in ViewRendererHost.render(interval:updateDisplayList:) + 1628 (<compiler-generated>:0)
26  SwiftUI                       	0x00000001a0fc7470 ViewRendererHost.render(interval:updateDisplayList:) + 316 (ViewRendererHost.swift:160)
27  SwiftUI                       	0x00000001a1122f24 _UIHostingView.layoutSubviews() + 168 (UIHostingView.swift:1547)
28  SwiftUI                       	0x00000001a1122f50 @objc _UIHostingView.layoutSubviews() + 24 (<compiler-generated>:0)
29  UIKitCore                     	0x000000019d37e398 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2468 (UIView.m:17526)
30  QuartzCore                    	0x000000019d883df4 -[CALayer layoutSublayers] + 288 (CALayer.mm:10147)
31  QuartzCore                    	0x000000019d88a398 CA::Layer::layout_if_needed(CA::Transaction*) + 520 (CALayer.mm:10014)
32  QuartzCore                    	0x000000019d8956e8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 140 (CALayer.mm:2485)
33  QuartzCore                    	0x000000019d7e0d7c CA::Context::commit_transaction(CA::Transaction*, double, double*) + 416 (CAContextInternal.mm:2449)
34  QuartzCore                    	0x000000019d80af40 CA::Transaction::commit() + 728 (CATransactionInternal.mm:449)
35  UIKitCore                     	0x000000019ce91984 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 80 (UIApplication.m:10895)
36  CoreFoundation                	0x000000019a589950 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20 (CFRunLoop.c:1815)
37  CoreFoundation                	0x000000019a588bd8 __CFRunLoopDoBlocks + 404 (CFRunLoop.c:1857)
38  CoreFoundation                	0x000000019a5833f4 __CFRunLoopRun + 796 (CFRunLoop.c:2927)
39  CoreFoundation                	0x000000019a582ba0 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3242)
40  GraphicsServices              	0x00000001b12eb598 GSEventRunModal + 160 (GSEvent.c:2259)
41  UIKitCore                     	0x000000019ce742f4 -[UIApplication _run] + 1052 (UIApplication.m:3253)
42  UIKitCore                     	0x000000019ce79874 UIApplicationMain + 164 (UIApplication.m:4707)
43  SwiftUI                       	0x00000001a10025dc closure #1 in KitRendererCommon(_:) + 108 (UIKitApp.swift:34)
44  SwiftUI                       	0x00000001a100256c runApp<A>(_:) + 176 (<compiler-generated>:0)
45  SwiftUI                       	0x00000001a0bd3d18 static App.main() + 96 (App.swift:113)
46  Example                       	0x0000000102c7224c 0x102c6c000 + 25164
47  libdyld.dylib                 	0x000000019a261568 start + 4

Thread 1:
0   libsystem_pthread.dylib       	0x00000001e2d9c86c _pthread_dependency_fulfill_slow + 192 (pthread_dependency.c:57)

Thread 2:
0   libsystem_pthread.dylib       	0x00000001e2d9c86c _pthread_dependency_fulfill_slow + 192 (pthread_dependency.c:57)

Thread 3:
0   libsystem_pthread.dylib       	0x00000001e2d9c86c _pthread_dependency_fulfill_slow + 192 (pthread_dependency.c:57)

Thread 4:
0   libsystem_pthread.dylib       	0x00000001e2d9c86c _pthread_dependency_fulfill_slow + 192 (pthread_dependency.c:57)

Thread 5:
0   libsystem_pthread.dylib       	0x00000001e2d9c86c _pthread_dependency_fulfill_slow + 192 (pthread_dependency.c:57)

Thread 6:
0   libsystem_pthread.dylib       	0x00000001e2d9c86c _pthread_dependency_fulfill_slow + 192 (pthread_dependency.c:57)

Thread 7:
0   libsystem_pthread.dylib       	0x00000001e2d9c86c _pthread_dependency_fulfill_slow + 192 (pthread_dependency.c:57)

Thread 8 name:
Thread 8:
0   libsystem_kernel.dylib        	0x00000001c64aa644 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001c64a9a48 mach_msg + 72 (mach_msg.c:103)
2   CoreFoundation                	0x000000019a5890fc __CFRunLoopServiceMachPort + 376 (CFRunLoop.c:2641)
3   CoreFoundation                	0x000000019a583570 __CFRunLoopRun + 1176 (CFRunLoop.c:2974)
4   CoreFoundation                	0x000000019a582ba0 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3242)
5   Foundation                    	0x000000019b7a27f8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 228 (NSRunLoop.m:374)
6   Foundation                    	0x000000019b7a26d8 -[NSRunLoop(NSRunLoop) runUntilDate:] + 88 (NSRunLoop.m:421)
7   UIKitCore                     	0x000000019cf20054 -[UIEventFetcher threadMain] + 504 (UIEventFetcher.m:838)
8   Foundation                    	0x000000019b8ff4bc __NSThread__start__ + 848 (NSThread.m:724)
9   libsystem_pthread.dylib       	0x00000001e2d97c9c _pthread_start + 288 (pthread.c:881)
10  libsystem_pthread.dylib       	0x00000001e2d9c880 thread_start + 8

Thread 9:
0   libsystem_pthread.dylib       	0x00000001e2d9c86c _pthread_dependency_fulfill_slow + 192 (pthread_dependency.c:57)

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x00000002800c6100   x1: 0x000000019e2fccb4   x2: 0x0000000000000007   x3: 0x00000001a99aef64
    x4: 0x0000000000000000   x5: 0x0000000000000013   x6: 0x0000000000000020   x7: 0x0000000000000001
    x8: 0x00000002800c6108   x9: 0x0000000200000003  x10: 0xfffffffe00000000  x11: 0x0000000000000000
   x12: 0x0000000000000003  x13: 0x00000000d5002ffb  x14: 0x00000000d5203000  x15: 0x0000000000000006
   x16: 0x0000000080000000  x17: 0x0000000055200000  x18: 0x0000000000000000  x19: 0x0000000103fce5e0
   x20: 0x0000000000000000  x21: 0x0000000000000000  x22: 0x000000000000002e  x23: 0x0000000103fcf490
   x24: 0x00000002800c6100  x25: 0xf000000000000068  x26: 0x000000000000000b  x27: 0x0000000000000002
   x28: 0x0000000000000001   fp: 0x000000016d18f490   lr: 0x000000019e02eaa8
    sp: 0x000000016d18f410   pc: 0x000000019e02eaa8 cpsr: 0x60000000
   esr: 0xf2000001  Address size fault

Binary Images:

@1agora
Copy link
Author

1agora commented Apr 16, 2021

it builds for Release using the following tweak (i am not sure if this would reintroduce the Private API issues though...)

lapack_logical LAPACK_lsame( char* ca,  char* cb,
                              lapack_int lca, lapack_int lcb )
{
    __CLPK_integer n = 1;
    //lapack_int n = 1;
    return lsamen_(&n, ca, cb);
}

@kewlbear
Copy link
Owner

Thanks for reporting. Fixed release build failure. Running from Xcode doesn't crash. But TestFlight build still crash. Will let you know if I get more info.

@1agora
Copy link
Author

1agora commented Apr 16, 2021

thanks, release works now.

crash seems to be related to Python (PythonKit) not found

Thread 0 name:
Thread 0 Crashed:
0   libswiftCore.dylib            	0x000000019e02eaa8 _assertionFailure(_:_:file:line:flags:) + 488 (AssertCommon.swift:132)
1   libswiftCore.dylib            	0x000000019e02eaa8 _assertionFailure(_:_:file:line:flags:) + 488 (AssertCommon.swift:132)
2   Example                       	0x0000000102c901a8 closure #1 in variable initialization expression of static PythonLibrary.pythonLibraryHandle + 496 (PythonLibrary.swift:46)
3   Example                       	0x0000000102c8ffa8 one-time initialization function for pythonLibraryHandle + 12 (PythonLibrary.swift:43)
4   libdispatch.dylib             	0x000000019a242280 _dispatch_client_callout + 16 (object.m:559)
5   libdispatch.dylib             	0x000000019a213cd8 _dispatch_once_callout + 28 (once.c:52)
6   libswiftCore.dylib            	0x000000019e31bd68 swift_once + 44 (once.h:111)
7   Example                       	0x0000000102c90438 PythonLibrary.pythonLibraryHandle.unsafeMutableAddressor + 64 (PythonLibrary.swift:43)

@kewlbear
Copy link
Owner

Wondering if bitcode compilation by App Store causes stripping Python library symbols used by PythonKit.

@1agora
Copy link
Author

1agora commented Apr 16, 2021

then uploading without bitcode should work, trying now ->

same crash, but app size didn't change without bitcode

@1agora
Copy link
Author

1agora commented Apr 16, 2021

running from XCode on device using Release Config crashes same way on Python.import("open3d")

image

@kewlbear
Copy link
Owner

then uploading without bitcode should work, trying now ->

same crash, but app size didn't change without bitcode

Yeah, I also verified that.

@kewlbear
Copy link
Owner

running from XCode on device using Release Config crashes same way on Python.import("open3d")

image

Weird. I can run release build on my device without crash. Have you updated all packages?

@kewlbear
Copy link
Owner

By the way I'm searching for a TestFlight solution. It will take some time, I guess.

@kewlbear
Copy link
Owner

By the way I'm searching for a TestFlight solution. It will take some time, I guess.

Found it! Basically STRIP_STYLE=debugging and not uploading bitcode. Turning bitcode off might work. Will push updated Example app soon.

@kewlbear
Copy link
Owner

Will push updated Example app soon.

Done.

@1agora
Copy link
Author

1agora commented Apr 21, 2021

bitcode: off - works! 🥳
testflight build not crashing. big thanks! ☕️
last step to confirm this solution would be to go through AppStore review process, but this step i am not ready to do yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants