Assertion failed: (LHSCst != RHSCst && "Compares not folded above?") - llvm

I'm trying to compile ICU v4.8.1 with Alchemy, but am running into an LLVM problem:
Assertion failed: (LHSCst != RHSCst && "Compares not folded above?"), function visitAnd, file /Volumes/data/dev/FlaCC/llvm-2.1/lib/Transforms/Scalar/InstructionCombining.cpp, line 3465.
0 llvm-ld 0x00264aee _ZNSt8_Rb_treeIN4llvm3sys4PathES2_St9_IdentityIS2_ESt4lessIS2_ESaIS2_EE13insert_uniqueERKS2_ + 6078
1 llvm-ld 0x00265092 _ZNSt8_Rb_treeIN4llvm3sys4PathES2_St9_IdentityIS2_ESt4lessIS2_ESaIS2_EE13insert_uniqueERKS2_ + 7522
2 libSystem.B.dylib 0x970a805b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 libSystem.B.dylib 0x971355a5 raise + 26
5 libSystem.B.dylib 0x9714b6e4 abort + 93
6 libSystem.B.dylib 0x9713820f __assert_rtn + 252
7 llvm-ld 0x000a0816 _ZN4llvm15callDefaultCtorIN91_GLOBAL__N__Volumes_data_dev_FlaCC_llvm_2.1_lib_Transforms_Scalar_GVN.cpp_00000000_4964B02A3GVNEEEPNS_4PassEv + 252214
8 llvm-ld 0x000cf25e _ZN4llvm11InstVisitorIN108_GLOBAL__N__Volumes_data_dev_FlaCC_llvm_2.1_lib_Transforms_Scalar_InstructionCombining.cpp_00000000_6BB61AFF12InstCombinerEPNS_11InstructionEE5visitERS3_ + 766
9 llvm-ld 0x000c5895 _ZN4llvm15callDefaultCtorIN91_GLOBAL__N__Volumes_data_dev_FlaCC_llvm_2.1_lib_Transforms_Scalar_GVN.cpp_00000000_4964B02A3GVNEEEPNS_4PassEv + 403893
10 llvm-ld 0x000c631c _ZN4llvm15callDefaultCtorIN91_GLOBAL__N__Volumes_data_dev_FlaCC_llvm_2.1_lib_Transforms_Scalar_GVN.cpp_00000000_4964B02A3GVNEEEPNS_4PassEv + 406588
11 llvm-ld 0x002004a6 _ZN4llvm12FunctionPassD1Ev + 20998
12 llvm-ld 0x002008fa _ZN4llvm12FunctionPassD1Ev + 22106
13 llvm-ld 0x00200e51 _ZN4llvm12FunctionPassD1Ev + 23473
14 llvm-ld 0x0020125a _ZN4llvm12FunctionPassD1Ev + 24506
15 llvm-ld 0x002012da _ZN4llvm12FunctionPassD1Ev + 24634
16 llvm-ld 0x00002f10 0x0 + 12048
17 llvm-ld 0x000091e2 _ZN4llvm2cl3optINS_12PluginLoaderELb0ENS0_6parserISsEEE16handleOccurrenceEjPKcRKSs + 11986
18 llvm-ld 0x00002706 0x0 + 9990
make[2]: *** [../../bin/genrb] Error 6
make[1]: *** [all-recursive] Error 2
make: *** [all-recursive] Error 2
What kind of code leads to this problem in the linker? It seems to have something to do with casting ("left-hand-side-cast != right-hand-side-cast"). I'm not above modifying the ICU code to make it compile, but I'm not sure what to modify.

Could be any number of things. The likely cause is bad llvm IR being fed into the linker. Your best bet is to talk to the Alchemy guys and see what they're doing and get them to debug it.

Related

MAC audioUnit AudioComponentInstanceDispose crash

the audio unit subType is kAudioUnitSubType_VoiceProcessingIO,
and use kAudioOutputUnitProperty_CurrentDevice to set Device ID for the audio unit
OSStatus result = AudioOutputUnitStop(audio_unit);
result = AudioUnitUninitialize(audio_unit);
result = AudioComponentInstanceDispose(audio_unit);
Thread trace:
3 ExceptionHandling 0x00007fff3c64ef31 -[NSExceptionHandler _handleException:mask:] + 364
4 ExceptionHandling 0x00007fff3c64ecac NSExceptionHandlerUncaughtSignalHandler + 35
5 libsystem_platform.dylib 0x00007fff204d3d7d _sigtramp + 29
6 CoreFoundation 0x00007fff2050f381 CFStringGetLength + 11
7 CoreFoundation 0x00007fff205225c7 CFStringCompare + 24
8 CoreAudio 0x00007fff221e83f5 _ZN9HALDevice4DuckEfPK14AudioTimeStampf + 921
9 CoreAudio 0x00007fff21d3ed48 AudioDeviceDuck + 843
10 AudioDSP 0x00000001390d7d4a _Z14DuckOtherAudiojff + 51
11 AudioDSP 0x0000000139213e06 _ZN16AUVoiceProcessor22DestroyAggregateDeviceEv + 974
12 AudioDSP 0x0000000139215459 _ZN16AUVoiceProcessorD2Ev + 417
13 AudioDSP 0x00000001392efdec _ZN13ComponentBase8AP_CloseEPv + 30
14 AudioToolboxCore 0x00007fff219e4b6a AudioComponentInstanceDispose + 55
You are disposing of an Audio Instance before it is stopped.
Note that AudioOutputUnitStop may not stop an audio unit immediately, since the audio thread runs asynchronously. If you delay for a half second after stopping the audio unit, that other thread is likely stopped by then and then you can more safely dispose of its resources.

Crash reported generated by Compiler in Swift 5 xcode 11

My app has been rejected from Apple quite a long time now.
They say that I get crash on dashboard but although it works fine on simulator and device
I implemented 2 approaches to get the crash report
Firebase Analytics
Symbolised the crash reported shared by Apple.
.init(coder:)
It says error generated by compiler
8 SSBS 0x10521c174 DashboardViewController.init(coder:) + 5308788 (<compiler-generated>:0)
9 SSBS 0x10521c238 #objc DashboardViewController.init(coder:) + 5308984 (<compiler-generated>:0)
In this case, what do I need to implement in my ViewController Class file
So the crash report generated fr
om that is :
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
*Last Exception Backtrace:
0 CoreFoundation 0x1adc3b794 0x1adb11000 + 1222548
1 libobjc.A.dylib 0x1ad95dbcc 0x1ad958000 + 23500
2 CoreFoundation 0x1adb31b98 0x1adb11000 + 134040
3 UIKitCore 0x1b1652c74 0x1b12b4000 + 3796084
4 UIFoundation 0x1b123fe94 0x1b11d5000 + 437908
5 UIFoundation 0x1b12400b4 0x1b11d5000 + 438452
6 UIFoundation 0x1b11dccac 0x1b11d5000 + 31916
7 UIKitCore 0x1b1699dd0 0x1b12b4000 + 4087248
8 SSBS 0x10521c174 DashboardViewController.init(coder:) + 5308788 (<compiler-generated>:0)
9 SSBS 0x10521c238 #objc DashboardViewController.init(coder:) + 5308984 (<compiler-generated>:0)
10 UIKitCore 0x1b1973c40 0x1b12b4000 + 7076928
11 UIFoundation 0x1b123fe94 0x1b11d5000 + 437908
12 UIFoundation 0x1b11dccac 0x1b11d5000 + 31916
13 UIKitCore 0x1b1977bbc 0x1b12b4000 + 7093180
14 UIFoundation 0x1b123fe94 0x1b11d5000 + 437908
15 UIFoundation 0x1b12400b4 0x1b11d5000 + 438452
16 UIFoundation 0x1b11dccac 0x1b11d5000 + 31916
17 UIKitCore 0x1b1972cd8 0x1b12b4000 + 7072984
18 UIKitCore 0x1b1975858 0x1b12b4000 + 7084120
19 UIKitCore 0x1b1e4784c 0x1b12b4000 + 12138572
20 SSBS 0x1052b55a8 closure #1 in LoginViewController.RegisterUserOnServer() + 5936552 (LoginViewController.swift:707)
21 Alamofire 0x105e47454 0x105d54000 + 996436
22 Alamofire 0x105d7ac94 0x105d54000 + 158868
23 libdispatch.dylib 0x1ad9009a8 0x1ad8a6000 + 371112
24 libdispatch.dylib 0x1ad901524 0x1ad8a6000 + 374052
25 libdispatch.dylib 0x1ad8b35b4 0x1ad8a6000 + 54708
26 CoreFoundation 0x1adbb97fc 0x1adb11000 + 690172
27 CoreFoundation 0x1adbb46d0 0x1adb11000 + 669392
28 CoreFoundation 0x1adbb3ce8 0x1adb11000 + 666856
29 GraphicsServices 0x1b7cfe38c 0x1b7cfb000 + 13196
30 UIKitCore 0x1b1ce2444 0x1b12b4000 + 10675268
31 SSBS 0x1051ba4b4 main + 4908212 (AppDelegate.swift:21)
32 libdyld.dylib 0x1ada3b8f0 0x1ada3a000 + 6384
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001ada30d88 0x1ada0b000 + 155016
1 libsystem_pthread.dylib 0x00000001ad9491e8 0x1ad947000 + 8680
2 libsystem_c.dylib 0x00000001ad89c9b0 0x1ad82a000 + 469424
3 libsystem_c.dylib 0x00000001ad89c940 0x1ad82a000 + 469312
4 libc++abi.dylib 0x00000001ada04cc0 0x1ad9f2000 + 76992
5 libc++abi.dylib 0x00000001ad9f6e10 0x1ad9f2000 + 19984
6 libobjc.A.dylib 0x00000001ad95de80 0x1ad958000 + 24192
7 SSBS 0x0000000105501948 FIRCLSTerminateHandler() + 8345928 (FIRCLSException.mm:338)
8 SSBS 0x00000001054abc90 CLSTerminateHandler+ 7994512 () + 348
9 libc++abi.dylib 0x00000001ada0414c 0x1ad9f2000 + 74060
10 libc++abi.dylib 0x00000001ada040e4 0x1ad9f2000 + 73956
11 libdispatch.dylib 0x00000001ad901538 0x1ad8a6000 + 374072
12 libdispatch.dylib 0x00000001ad8b35b4 0x1ad8a6000 + 54708
13 CoreFoundation 0x00000001adbb97fc 0x1adb11000 + 690172
14 CoreFoundation 0x00000001adbb46d0 0x1adb11000 + 669392
15 CoreFoundation 0x00000001adbb3ce8 0x1adb11000 + 666856
16 GraphicsServices 0x00000001b7cfe38c 0x1b7cfb000 + 13196
17 UIKitCore 0x00000001b1ce2444 0x1b12b4000 + 10675268
18 SSBS 0x00000001051ba4b4 main + 4908212 (AppDelegate.swift:21)
19 libdyld.dylib 0x00000001ada3b8f0 0x1ada3a000 + 6384*
code of DashboardViewController:
class DashboardViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
//navigationHeaderItem()
// Do any additional setup after loading the view.
if(self.isNewDashboard == nil || self.isNewDashboard == true){
self.newDashboardView.isHidden = false
}else{
self.newDashboardView.isHidden = true
}
let menuMangerObj = MenuDrawerManager()
let resultItem=menuMangerObj.getByItemDrawerItem("My Meetings") as NSArray
if(resultItem.count>0){
self.newDashboardView.isHidden = false
}else{
self.newDashboardView.isHidden = true
}
self.loginUserName.text=userdDefaultData.string(forKey: "loginUserName")
}
}
I initiate a view controller like:
let vcObj = self.storyboard?.instantiateViewController(withIdentifier: "DashboardController") as! DashboardViewController
vcObj.isNewDashboard = true
self.navigationController?.pushViewController(vcObj, animated: true)
Am I am missing anything here?

opencv c++ VideoCapture open() error

I'm trying to read a webcam stream in opencv c++ on OS X but when I attempt to open the feed I produce the following error:
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
Stacktrace:
*** First throw call stack:
(
0 CoreFoundation 0x00007fff86cfee7b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fff9b8e8cad objc_exception_throw + 48
2 CoreFoundation 0x00007fff86c181dc -[__NSArrayM objectAtIndex:] + 204
3 libopencv_highgui.2.4.dylib 0x0000000104b09280 _ZN13CvCaptureFileC2EPKc + 350
4 libopencv_highgui.2.4.dylib 0x0000000104b07cf2 _Z32cvCreateFileCapture_AVFoundationPKc + 34
5 libopencv_highgui.2.4.dylib 0x0000000104afb7ee cvCreateFileCapture + 14
6 libopencv_highgui.2.4.dylib 0x0000000104afba9e _ZN2cv12VideoCapture4openERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 64
7 classification.bin 0x0000000104031842 main + 370
8 libdyld.dylib 0x00007fff9c1cc255 start + 1
9 ??? 0x0000000000000005 0x0 + 5
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
Code:
VideoCapture cap;
printf("vidcap created\n"); // This message is printed
cap.open("http://192.168.1.155:80/video.cgi?dummy=.mjpg");
printf("feed opened\n"); // this one is not
What could be the reason for this error?

Crash on devices running iOS 8.4

Can anyone help here please?
I submitted version 2 of my app only to have it rejected as it crashed on a number of devices running 8.4 ….
{"bundleID":"properties.axxxxxxx.xxxxxxxxx”,”app_name”:”My App”,”share_with_app_devs":false,"name”:”My App”,”app_version":"2.0","is_first_party":false,"os_version":"iPhone OS 8.4 (12H143)","bug_type":"109","slice_uuid":"c94c9011-955b-3d2c-b949- 5797aefef990","build_version":"2.2","adam_id":0}
Incident Identifier: A3B5332C-0A28-4E48-BFEE-F1FB95495715
CrashReporter Key: 09b24a3f5088bdc521191691c1969f4d0b4b4f7a
Hardware Model: iPhone5,3
Process: My App [1147]
Path: /private/var/mobile/Containers/Bundle/Application/6E6E3FFA-11CD-4DA0-995D-D46C8E2C9624/My App.app/My App
Identifier: properties.axxxxxxx.xxxxxxxx
Version: 2.2 (2.0)
Code Type: ARM (Native)
Parent Process: launchd.development [1]
Date/Time: 2015-09-20 01:23:11.929 -0700
Launch Time: 2015-09-20 01:23:11.557 -0700
OS Version: iOS 8.4 (12H143)
UDID: b01ae3fde269ba2ac345c6dae55c505ad34d45ae
Report Version: 105
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0
Filtered syslog:
2015-09-20 01:23:11.684 Alien Rabbits[1147]: <Error> assertion failed: 12H143: libxpc.dylib + 51915 [88A50DD0-8E7B-3CD6-AC30-BA113A415E4F]: 0x7d
2015-09-20 01:23:11.885 Alien Rabbits[1147]: <Error> +[NSMutableArray newMutableArrayUsingWeakReferencesWithCapacity:]: unrecognized selector sent to class 0x31e2aaf4
2015-09-20 01:23:11.888 Alien Rabbits[1147]: <Error> *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSMutableArray newMutableArrayUsingWeakReferencesWithCapacity:]: unrecognized selector sent to class 0x31e2aaf4'
*** First throw call stack:
(0x22a86fef 0x314a2c8b 0x22a8c325 0x22a8a327 0x229b9e78 0x610f5 0xb0507 0x91771 0x9116b 0xa3599 0x2b023 0x2616f243 0x26365ad9 0x26368199 0x26372e19 0x2636693b 0x2973eec9 0x22a4cfd5 0x22a4c299 0x22a4add3 0x22997201 0x22997013 0x26168e17 0x26163a09 0x2aecb 0x31a54aaf)
Last Exception Backtrace:
(0x22a86fea 0x314a2c86 0x22a8c320 0x22a8a322 0x229b9e74 0x610f0 0xb0502 0x9176c 0x91166 0xa3594 0x2b01e 0x2616f23e 0x26365ad4 0x26368194 0x26372e14 0x26366936 0x2973eec4 0x22a4cfd0 0x22a4c294 0x22a4adce 0x229971fc 0x2299700e 0x26168e12 0x26163a04 0x2aec6 0x31a54aaa)
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x31b1edf0 0x31b0a000 + 85488
1 libsystem_pthread.dylib 0x31b9dcc2 0x31b9a000 + 15554
2 libsystem_c.dylib 0x31aba904 0x31a70000 + 305412
3 libc++abi.dylib 0x30dc29c4 0x30dc2000 + 2500
4 libc++abi.dylib 0x30ddc66c 0x30dc2000 + 108140
5 libobjc.A.dylib 0x314a2f22 0x3149c000 + 28450
6 libc++abi.dylib 0x30dd9de0 0x30dc2000 + 97760
7 libc++abi.dylib 0x30dd98aa 0x30dc2000 + 96426
8 libobjc.A.dylib 0x314a2dce 0x3149c000 + 28110
9 CoreFoundation 0x22997298 0x2297f000 + 98968
10 CoreFoundation 0x2299700e 0x2297f000 + 98318
11 UIKit 0x26168e12 0x260f4000 + 478738
12 UIKit 0x26163a04 0x260f4000 + 457220
13 My App 0x0002aec6 0x23000 + 32454
14 libdyld.dylib 0x31a54aac 0x31a53000 + 6828
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x31b0b224 0x31b0a000 + 4644
1 libdispatch.dylib 0x31a400ec 0x31a32000 + 57580
2 libdispatch.dylib 0x31a34d36 0x31a32000 + 11574
Thread 2 name: Dispatch queue: FBSSerialQueue
Thread 2:
0 libsystem_kernel.dylib 0x31b0b4c4 0x31b0a000 + 5316
1 libdispatch.dylib 0x31a3e5da 0x31a32000 + 50650
2 FrontBoardServices 0x2973eea6 0x29729000 + 89766
3 libdispatch.dylib 0x31a332e0 0x31a32000 + 4832
4 libdispatch.dylib 0x31a3b724 0x31a32000 + 38692
5 libdispatch.dylib 0x31a35aa8 0x31a32000 + 15016
6 libdispatch.dylib 0x31a3cf9c 0x31a32000 + 44956
7 libdispatch.dylib 0x31a3e3be 0x31a32000 + 50110
8 libsystem_pthread.dylib 0x31b9adbe 0x31b9a000 + 3518
9 libsystem_pthread.dylib 0x31b9ab10 0x31b9a000 + 2832
Thread 3:
0 libsystem_kernel.dylib 0x31b1f9c0 0x31b0a000 + 88512
1 libsystem_pthread.dylib 0x31b9ae38 0x31b9a000 + 3640
2 libsystem_pthread.dylib 0x31b9ab10 0x31b9a000 + 2832
Thread 4:
0 libsystem_kernel.dylib 0x31b1f9c0 0x31b0a000 + 88512
1 libsystem_pthread.dylib 0x31b9ae38 0x31b9a000 + 3640
2 libsystem_pthread.dylib 0x31b9ab10 0x31b9a000 + 2832
Thread 5:
0 libsystem_kernel.dylib 0x31b1f9c0 0x31b0a000 + 88512
1 libsystem_pthread.dylib 0x31b9ae38 0x31b9a000 + 3640
2 libsystem_pthread.dylib 0x31b9ab10 0x31b9a000 + 2832
Thread 0 crashed with ARM Thread State (32-bit):
r0: 0x00000000 r1: 0x00000000 r2: 0x00000000 r3: 0x00000003
r4: 0x00000006 r5: 0x344be9dc r6: 0x344aa840 r7: 0x003233c8
r8: 0x16e86fe0 r9: 0x00000000 r10: 0x344a9074 r11: 0x16e87004
ip: 0x00000148 sp: 0x003233bc lr: 0x31b9dcc7 pc: 0x31b1edf0
cpsr: 0x00080010
No problems for me when running the app on an iPhone 6 with 8.4 and on a variety of devices running 8.0
The only way I have found to replicate the crash is running a device iPhone 4s on 8.0 using the profile tool and then I get:
2015-09-27 17:54:47.434 My App[9161:1516779] +[NSMutableArray newMutableArrayUsingWeakReferencesWithCapacity:]: unrecognized selector sent to class 0x393e5960
2015-09-27 17:54:47.444 My APP[9161:1516779] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSMutableArray newMutableArrayUsingWeakReferencesWithCapacity:]: unrecognized selector sent to class 0x393e5960'
*** First throw call stack:
(0x2b20a5f7 0x38a7cc77 0x2b20f9d9 0x2b20d999 0x2b13eb88 0xc4501 0x11383b 0xf4a71 0xf4463 0x1068a9 0x8e523 0x2e719469 0x2e90e515 0x2e910a49 0x2e91b2f9 0x2e90f2eb 0x319800c9 0x2b1d0ffd 0x2b1d02c1 0x2b1cee1b 0x2b11bb31 0x2b11b943 0x2e713127 0x2e70df21 0x8e3cb 0x39018aaf)
libc++abi.dylib:
terminating with uncaught exception of type NSException
The app will run on that device if the profile tool is not used. When it is loaded with the profile tool it will crashes when phone is disconnected connected.
The app is crashing before its finished launching from:
-(BOOL) application: (UIApplication*) application didFinishLaunchingWithOptions: (NSDictionary*) launchOptions
and it’s the call to Initialise OpenAL:
[OALSimpleAudio sharedInstance];
in the cocos2d CCAppDelegate.m file that triggers the crash.
If I take this call out, the crash happens a second or so later and the profile tool gives;
2015-09-27 18:38:52.634 My App[9188:1523335] -[EAGLContext ensureCurrentContext]: unrecognized selector sent to instance 0x167918e0
2015-09-27 18:38:52.667 My App[9188:1523335] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[EAGLContext ensureCurrentContext]: unrecognized selector sent to instance 0x167918e0'
*** First throw call stack:
(0x2b20a5f7 0x38a7cc77 0x2b20fabd 0x2b20d999 0x2b13eb88 0x199c65 0x191f6d 0x19a063 0x19487f 0x10b4ad 0x10aa33 0x10a9fd 0x10aa75 0x1226f1 0x12341b 0x123225 0x1224e5 0x121b63 0x122a1d 0x7d5c9 0xf4ffd 0xa34b9 0xd799f 0x2e6ac19f 0x2e0d7f65 0x2e0d3951 0x2e0d37d9 0x2e0d31c7 0x2e0d2fd1 0x2e91011d 0x2e910eb5 0x2e91b2f9 0x2e90f2eb 0x319800c9 0x2b1d0ffd 0x2b1d02c1 0x2b1cea5f 0x2b11bb31 0x2b11b943 0x2e713127 0x2e70df21 0x7d3fb 0x39018aaf)
libc++abi.dylib:
terminating with uncaught exception of type NSException
I’m using:
xcode 6.2
compiling to 8.0
cocos2d 3.2.1
Hours spent so far trying to resolve this.
Thanks

Weird Adobe Alchemy compiler fail

I'm trying to build a project using OpenCV with alchemy. My idea was to isolate the parts I need from OpenCV (v.2.2), compile them with alchemy g++ and link with my code statically. So here's what I do:
First I compile needed opencv sources one by one (I need core, imgproc and some others):
alc-on; for src in *.cpp ; do g++ -I../../include -DOSX -c -Wall -O3 -o ${PWD##*/}_`basename $src .cpp`.o $src ; done ; mv -v *.o ~/dev/cut/obj/
Then I try to build this simple test of Flash—OpenCV interaction and link it against all .o's I have built as above:
#include <opencv/cv.h>
#include "AS3.h"
void testCV()
{
cv::Mat a(3,3,CV_8UC1,cv::Scalar(1.0));
cv::Mat b(3,3,CV_8UC1,cv::Scalar(2.0));
cv::Mat c;
c=a+b;
}
static AS3_Val test(void* self, AS3_Val args)
{
testCV();
return 0;
}
int main()
{
AS3_Val testMethod = AS3_Function(NULL,test);
AS3_Val result = AS3_Object("test: AS3ValType",testMethod);
AS3_Release(testMethod);
AS3_LibInit(result);
return 0;
}
Next, assuming I have the source and all needed .o's in the same folder, I try to compile them as swc:
g++ -I../include -Wall -O3 -DOSX -swc test_cv.cpp *.o -o cvtest.swc
(Note: creating a library archive with 'ar rc' and 'ranlib' and linking against it has the same effect)
And at this point, I get the following error report from alchemy tools (I guess it's llvm):
Assertion failed: (TLI.isTypeLegal(VT) && "Intrinsic uses a non-legal type?"), function visitTargetIntrinsic, file /Volumes/data/dev/FlaCC/llvm-2.1/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp, line 2465.
0 llc 0x00636dfe _ZNSt8_Rb_treeIN4llvm3sys4PathES2_St9_IdentityIS2_ESt4lessIS2_ESaIS2_EE13insert_uniqueERKS2_ + 6078
1 llc 0x006373a2 _ZNSt8_Rb_treeIN4llvm3sys4PathES2_St9_IdentityIS2_ESt4lessIS2_ESaIS2_EE13insert_uniqueERKS2_ + 7522
2 libSystem.B.dylib 0x9125e05b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 libSystem.B.dylib 0x912eb5a5 raise + 26
5 libSystem.B.dylib 0x913016e4 abort + 93
6 libSystem.B.dylib 0x912ee20f __assert_rtn + 252
7 llc 0x003f3e2a _ZN4llvm11StoreSDNodeD1Ev + 90026
8 llc 0x003f5256 _ZN4llvm11StoreSDNodeD1Ev + 95190
9 llc 0x003f817c _ZN4llvm11StoreSDNodeD1Ev + 107260
10 llc 0x0040bc68 _ZN4llvm11StoreSDNodeD1Ev + 187880
11 llc 0x0040d3f2 _ZN4llvm11StoreSDNodeD1Ev + 193906
12 llc 0x0040f92e _ZN4llvm11StoreSDNodeD1Ev + 203438
13 llc 0x005d1926 _ZN4llvm12FunctionPassD1Ev + 20998
14 llc 0x005d1f3a _ZN4llvm12FunctionPassD1Ev + 22554
15 llc 0x005d20c5 _ZN4llvm12FunctionPassD1Ev + 22949
16 llc 0x00002e44 0x0 + 11844
17 llc 0x00001f36 0x0 + 7990
18 ??? 0x00000006 0x0 + 6
I found out that the problem comes from the file matop.o (matop.cpp from OpenCV core module), but I cannot throw it out of linking because it results in undefined sym error at runtime in flash (it cannot find cv::add, if I'm not mistaken).
Can anyone suggest any way to identify the real problem and any (even dirty hacking — style) workaround for it?
My thread on the problem and workarounds at adobe alchemy forums: http://forums.adobe.com/message/3891743#3891743
Dirty hack workaround: remove defined section from top of OpenCV2.0 core arithm.cpp between
#if CV_SSE2
...
#else
and leave only the else-section. This would work for the example above.
Other parts of OpenCV might need more mindbogglingly exquisite hacking.