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

MAUI .NET 7 on create new Lua() System.DllNotFoundException: @rpath/liblua54.framework/liblua54 #521

Open
Jurashikku opened this issue Jan 20, 2024 · 21 comments

Comments

@Jurashikku
Copy link

Throw exception on new Lua() from other .dll project

InnerException {System.TypeInitializationException: The type initializer for 'LuaUiEngine.UiEngine' threw an exception. ---> System.DllNotFoundException: @rpath/liblua54.framework/liblua54 at KeraLua.Lua..ctor(Boolean openLibs) at NLua.Lua..ctor(Boolean openLibs) at…} System.TypeInitializationException

Lib create on debug in /bin/net7.0-maccatalyst/maccatalyst-x64/liblua54

When create ConsoleApplication is used runtimes link. When try run Maui successful running on Windows.
MacOS return exception
Library not loaded: @rpath/liblua54.framework/Versions/A/liblua54 Referenced from: <552F469E-1D26-37B0-AD62-C325D8C5042E> /Users/USER/*/MauiLuaApp.app/Contents/MacOS/MauiLuaApp Reason: tried: '/Users/yurasultanov/LuaUiEngine/LuaUiEngine/MauiLuaApp/bin/Debug/net7.0-maccatalyst/maccatalyst-x64/MauiLuaApp.app/Contents/Frameworks/liblua54.framework/Versions/A/liblua54' (no such file), '/Users/yurasultanov/LuaUiEngine/LuaUiEngine/MauiLuaApp/bin/Debug/net7.0-maccatalyst/maccatalyst-x64/MauiLuaApp.app/Contents/Frameworks/liblua54.framework/Versions/A/liblua54' (no such file)

@Jurashikku
Copy link
Author

`-------------------------------------
Translated Report (Full Report Below)

Process: MauiLuaTest [18366]
Path: /Users/USER/*/MauiLuaTest.app/Contents/MacOS/MauiLuaTest
Identifier: com.companyname.mauiluatest
Version: 1.0 (1)
Code Type: X86-64 (Native)
Parent Process: launchd [1]
User ID: 501

Date/Time: 2024-01-20 06:59:51.2118 +0300
OS Version: macOS 13.6.3 (22G436)
Report Version: 12
Bridge OS Version: 3.0 (14Y910)
Anonymous UUID: A3A6B850-4D11-D8B5-F769-235CF69CF693

Sleep/Wake UUID: B221814B-38B0-4F28-A7E7-2A27A1FC616E

Time Awake Since Boot: 57000 seconds
Time Since Wake: 14345 seconds

System Integrity Protection: enabled

Crashed Thread: 0

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Termination Reason: Namespace DYLD, Code 1 Library missing
Library not loaded: @rpath/liblua54.framework/Versions/A/liblua54
Referenced from: <3F31E251-E8A4-3ACF-A27D-39C02581249E> /Users/USER/*/MauiLuaTest.app/Contents/MacOS/MauiLuaTest
Reason: tried: '/Users/yurasultanov/LuaUiEngine/LuaUiEngine/MauiLuaTest/bin/Debug/net7.0-maccatalyst/maccatalyst-x64/MauiLuaTest.app/Contents/Frameworks/liblua54.framework/Versions/A/liblua54' (no such file), '/Users/yurasultanov/LuaUiEngine/LuaUiEngine/MauiLuaTest/bin/Debug/net7.0-maccatalyst/maccatalyst-x64/MauiLuaTest.app/Contents/Frameworks/liblua54.framework/Versions/A/liblua54' (no such file)
(terminated at launch; ignore backtrace)

Thread 0 Crashed:
0 dyld 0x7ff810c39c52 __abort_with_payload + 10
1 dyld 0x7ff810c53fd7 abort_with_payload_wrapper_internal + 82
2 dyld 0x7ff810c54009 abort_with_payload + 9
3 dyld 0x7ff810bd88f0 dyld4::halt(char const*) + 375
4 dyld 0x7ff810bd5b71 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 4526
5 dyld 0x7ff810bd43bd start + 1805

Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000002000209 rbx: 0x0000000000000000 rcx: 0x00007ff7b801d1b8 rdx: 0x00007ff7b801d620
rdi: 0x0000000000000006 rsi: 0x0000000000000001 rbp: 0x00007ff7b801d200 rsp: 0x00007ff7b801d1b8
r8: 0x00007ff7b801d220 r9: 0x0000000000000000 r10: 0x00000000000000d2 r11: 0x0000000000000246
r12: 0x00000000000000d2 r13: 0x00007ff7b801d620 r14: 0x0000000000000001 r15: 0x0000000000000006
rip: 0x00007ff810c39c52 rfl: 0x0000000000000246 cr2: 0x0000000000000000

Logical CPU: 0
Error Code: 0x02000209
Trap Number: 133

Binary Images:
0x107ee1000 - 0x1085e4fff com.companyname.mauiluatest (1.0) <3f31e251-e8a4-3acf-a27d-39c02581249e> /Users/USER//MauiLuaTest.app/Contents/MacOS/MauiLuaTest
0x7ff810bce000 - 0x7ff810c665ef dyld (
) <3400ad17-ab59-3b27-9a44-9b280fab5c3f> /usr/lib/dyld

External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 16
thread_create: 0
thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=182.5M resident=0K(0%) swapped_out_or_unallocated=182.5M(100%)
Writable regions: Total=9124K written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=9124K(100%)

                            VIRTUAL   REGION 

REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
STACK GUARD 56.0M 1
Stack 8192K 1
VM_ALLOCATE 8K 2
__DATA 1323K 3
__DATA_CONST 148K 2
__DATA_DIRTY 7K 1
__LINKEDIT 174.9M 3
__TEXT 7796K 2
dyld private memory 260K 2
shared memory 4K 1
=========== ======= =======
TOTAL 248.2M 18


Full Report

{"app_name":"MauiLuaTest","timestamp":"2024-01-20 06:59:51.00 +0300","app_version":"1.0","slice_uuid":"3f31e251-e8a4-3acf-a27d-39c02581249e","build_version":"1","platform":6,"bundleID":"com.companyname.mauiluatest","share_with_app_devs":0,"is_first_party":0,"bug_type":"309","os_version":"macOS 13.6.3 (22G436)","roots_installed":0,"name":"MauiLuaTest","incident_id":"D6A597CA-F289-49E1-A0C5-1746590F6EDF"}
{
"uptime" : 57000,
"procRole" : "Background",
"version" : 2,
"userID" : 501,
"deployVersion" : 210,
"modelCode" : "MacBookPro14,2",
"coalitionID" : 1645,
"osVersion" : {
"train" : "macOS 13.6.3",
"build" : "22G436",
"releaseType" : "User"
},
"captureTime" : "2024-01-20 06:59:51.2118 +0300",
"incident" : "D6A597CA-F289-49E1-A0C5-1746590F6EDF",
"pid" : 18366,
"cpuType" : "X86-64",
"roots_installed" : 0,
"bug_type" : "309",
"procLaunch" : "2024-01-20 06:59:49.2959 +0300",
"procStartAbsTime" : 57667560959414,
"procExitAbsTime" : 57669476414653,
"procName" : "MauiLuaTest",
"procPath" : "/Users/USER//MauiLuaTest.app/Contents/MacOS/MauiLuaTest",
"bundleInfo" : {"CFBundleShortVersionString":"1.0","CFBundleVersion":"1","CFBundleIdentifier":"com.companyname.mauiluatest"},
"storeInfo" : {"deviceIdentifierForVendor":"31733DF3-59E1-5175-B932-EEF19D840700","thirdParty":true},
"parentProc" : "launchd",
"parentPid" : 1,
"coalitionName" : "com.companyname.mauiluatest",
"crashReporterKey" : "A3A6B850-4D11-D8B5-F769-235CF69CF693",
"codeSigningID" : "com.companyname.mauiluatest",
"codeSigningTeamID" : "",
"codeSigningFlags" : 570425345,
"codeSigningValidationCategory" : 10,
"codeSigningTrustLevel" : 0,
"wakeTime" : 14345,
"bridgeVersion" : {"build":"14Y910","train":"3.0"},
"sleepWakeUUID" : "B221814B-38B0-4F28-A7E7-2A27A1FC616E",
"sip" : "enabled",
"exception" : {"codes":"0x0000000000000000, 0x0000000000000000","rawCodes":[0,0],"type":"EXC_CRASH","signal":"SIGABRT"},
"termination" : {"code":1,"flags":518,"namespace":"DYLD","indicator":"Library missing","details":["(terminated at launch; ignore backtrace)"],"reasons":["Library not loaded: @rpath/liblua54.framework/Versions/A/liblua54","Referenced from: <3F31E251-E8A4-3ACF-A27D-39C02581249E> /Users/USER/
/MauiLuaTest.app/Contents/MacOS/MauiLuaTest","Reason: tried: '/Users/yurasultanov/LuaUiEngine/LuaUiEngine/MauiLuaTest/bin/Debug/net7.0-maccatalyst/maccatalyst-x64/MauiLuaTest.app/Contents/Frameworks/liblua54.framework/Versions/A/liblua54' (no such file), '/Users/yurasultanov/LuaUiEngine/LuaUiEngine/MauiLuaTest/bin/Debug/net7.0-maccatalyst/maccatalyst-x64/MauiLuaTest.app/Contents/Frameworks/liblua54.framework/Versions/A/liblua54' (no such file)"]},
"extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":16},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
"faultingThread" : 0,
"threads" : [{"triggered":true,"id":634148,"threadState":{"r13":{"value":140701920777760},"rax":{"value":33554953},"rflags":{"value":582},"cpu":{"value":0},"r14":{"value":1},"rsi":{"value":1},"r8":{"value":140701920776736},"cr2":{"value":0},"rdx":{"value":140701920777760},"r10":{"value":210},"r9":{"value":0},"r15":{"value":6},"rbx":{"value":0},"trap":{"value":133},"err":{"value":33554953},"r11":{"value":582},"rip":{"value":140703409871954,"matchesCrashFrame":1},"rbp":{"value":140701920776704},"rsp":{"value":140701920776632},"r12":{"value":210},"rcx":{"value":140701920776632},"flavor":"x86_THREAD_STATE","rdi":{"value":6}},"frames":[{"imageOffset":441426,"symbol":"__abort_with_payload","symbolLocation":10,"imageIndex":1},{"imageOffset":548823,"symbol":"abort_with_payload_wrapper_internal","symbolLocation":82,"imageIndex":1},{"imageOffset":548873,"symbol":"abort_with_payload","symbolLocation":9,"imageIndex":1},{"imageOffset":43248,"symbol":"dyld4::halt(char const*)","symbolLocation":375,"imageIndex":1},{"imageOffset":31601,"symbol":"dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*)","symbolLocation":4526,"imageIndex":1},{"imageOffset":25533,"symbol":"start","symbolLocation":1805,"imageIndex":1}]}],
"usedImages" : [
{
"source" : "P",
"arch" : "x86_64",
"base" : 4428009472,
"CFBundleShortVersionString" : "1.0",
"CFBundleIdentifier" : "com.companyname.mauiluatest",
"size" : 7356416,
"uuid" : "3f31e251-e8a4-3acf-a27d-39c02581249e",
"path" : "/Users/USER/*/MauiLuaTest.app/Contents/MacOS/MauiLuaTest",
"name" : "MauiLuaTest",
"CFBundleVersion" : "1"
},
{
"source" : "P",
"arch" : "x86_64",
"base" : 140703409430528,
"size" : 624112,
"uuid" : "3400ad17-ab59-3b27-9a44-9b280fab5c3f",
"path" : "/usr/lib/dyld",
"name" : "dyld"
}
],
"sharedCache" : {
"base" : 140703408807936,
"size" : 21474836480,
"uuid" : "97d6888a-2705-3991-b7e9-e38694d68f1e"
},
"vmSummary" : "ReadOnly portion of Libraries: Total=182.5M resident=0K(0%) swapped_out_or_unallocated=182.5M(100%)\nWritable regions: Total=9124K written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=9124K(100%)\n\n VIRTUAL REGION \nREGION TYPE SIZE COUNT (non-coalesced) \n=========== ======= ======= \nSTACK GUARD 56.0M 1 \nStack 8192K 1 \nVM_ALLOCATE 8K 2 \n__DATA 1323K 3 \n__DATA_CONST 148K 2 \n__DATA_DIRTY 7K 1 \n__LINKEDIT 174.9M 3 \n__TEXT 7796K 2 \ndyld private memory 260K 2 \nshared memory 4K 1 \n=========== ======= ======= \nTOTAL 248.2M 18 \n",
"legacyInfo" : {
"threadTriggered" : {

}
},
"logWritingSignature" : "c86da35ff86e30f55ae1a79fcd7c095210fef1f9",
"trialInfo" : {
"rollouts" : [
{
"rolloutId" : "62c74108bcb0435c2153f963",
"factorPackIds" : {
"SIRI_TEXT_TO_SPEECH" : "657a4921d6ad146894c1b003"
},
"deploymentId" : 240000394
},
{
"rolloutId" : "60da5e84ab0ca017dace9abf",
"factorPackIds" : {

  },
  "deploymentId" : 240000008
}

],
"experiments" : [

]
}
}

Model: MacBookPro14,2, BootROM 522.0.0.0.0, 2 processors, Dual-Core Intel Core i5, 3,1 GHz, 8 GB, SMC 2.44f6
Graphics: Intel Iris Plus Graphics 650, Intel Iris Plus Graphics 650, Built-In
Display: Color LCD, 2560 x 1600 Retina, Main, MirrorOff, Online
Memory Module: BANK 0/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x802C, 0x4D5435324C3531324D3332443250462D3039
Memory Module: BANK 1/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x802C, 0x4D5435324C3531324D3332443250462D3039
AirPort: spairport_wireless_card_type_wifi (0x14E4, 0x171), Broadcom BCM43xx 1.0 (7.77.111.1 AirPortDriverBrcmNIC-1772.1)
AirPort:
Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
Network Service: iPhone 2, Ethernet, en7
USB Device: USB30Bus
USB Device: iPhone
USB Device: Apple T1 Controller
Thunderbolt Bus: MacBook Pro, Apple Inc., 41.5
Thunderbolt Bus: MacBook Pro, Apple Inc., 41.5
`

@Jurashikku
Copy link
Author

Create new MAUI .net 7 lib application
Create new MAUI .net 7 Application
Add reference lib to App
Add Lua lib in App
Build

Error

`-------------------------------------
Translated Report (Full Report Below)

Process: MauiLuaEngineApp [21362]
Path: /Users/USER/*/MauiLuaEngineApp.app/Contents/MacOS/MauiLuaEngineApp
Identifier: com.companyname.mauiluaengineapp
Version: 1.0 (1)
Code Type: X86-64 (Native)
Parent Process: launchd [1]
User ID: 501

Date/Time: 2024-01-20 14:12:03.6429 +0300
OS Version: macOS 13.6.3 (22G436)
Report Version: 12
Bridge OS Version: 3.0 (14Y910)
Anonymous UUID: A3A6B850-4D11-D8B5-F769-235CF69CF693

Sleep/Wake UUID: B7D41381-35B8-48B9-A471-96D8F2E5E9F1

Time Awake Since Boot: 63000 seconds
Time Since Wake: 3073 seconds

System Integrity Protection: enabled

Crashed Thread: 0

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Termination Reason: Namespace DYLD, Code 1 Library missing
Library not loaded: @rpath/liblua54.framework/Versions/A/liblua54
Referenced from: <626C40FE-EB25-33C0-A097-5E78D780E364> /Users/USER/*/MauiLuaEngineApp.app/Contents/MacOS/MauiLuaEngineApp
Reason: tried: '/Users/yurasultanov/LuaUiEngine/LuaUiEngine/MauiLuaEngineApp/bin/Debug/net7.0-maccatalyst/maccatalyst-x64/MauiLuaEngineApp.app/Contents/Frameworks/liblua54.framework/Versions/A/liblua54' (no such file), '/Users/yurasultanov/LuaUiEngine/LuaUiEngine/MauiLuaEngineApp/bin/Debug/net7.0-maccatalyst/maccatalyst-x64/MauiLuaEngineApp.app/Contents/Frameworks/liblua54.framework/Versions/A/liblua54' (no such file)
(terminated at launch; ignore backtrace)

Thread 0 Crashed:
0 dyld 0x7ff810c39c52 __abort_with_payload + 10
1 dyld 0x7ff810c53fd7 abort_with_payload_wrapper_internal + 82
2 dyld 0x7ff810c54009 abort_with_payload + 9
3 dyld 0x7ff810bd88f0 dyld4::halt(char const*) + 375
4 dyld 0x7ff810bd5b71 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 4526
5 dyld 0x7ff810bd43bd start + 1805

Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000002000209 rbx: 0x0000000000000000 rcx: 0x00007ff7b34b8188 rdx: 0x00007ff7b34b85f0
rdi: 0x0000000000000006 rsi: 0x0000000000000001 rbp: 0x00007ff7b34b81d0 rsp: 0x00007ff7b34b8188
r8: 0x00007ff7b34b81f0 r9: 0x0000000000000000 r10: 0x00000000000000e1 r11: 0x0000000000000246
r12: 0x00000000000000e1 r13: 0x00007ff7b34b85f0 r14: 0x0000000000000001 r15: 0x0000000000000006
rip: 0x00007ff810c39c52 rfl: 0x0000000000000246 cr2: 0x0000000000000000

Logical CPU: 0
Error Code: 0x02000209
Trap Number: 133

Binary Images:
0x10ca46000 - 0x10d149fff com.companyname.mauiluaengineapp (1.0) <626c40fe-eb25-33c0-a097-5e78d780e364> /Users/USER//MauiLuaEngineApp.app/Contents/MacOS/MauiLuaEngineApp
0x7ff810bce000 - 0x7ff810c665ef dyld (
) <3400ad17-ab59-3b27-9a44-9b280fab5c3f> /usr/lib/dyld

External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 21
thread_create: 0
thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=182.5M resident=0K(0%) swapped_out_or_unallocated=182.5M(100%)
Writable regions: Total=9124K written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=9124K(100%)

                            VIRTUAL   REGION 

REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
STACK GUARD 56.0M 1
Stack 8192K 1
VM_ALLOCATE 8K 2
__DATA 1323K 3
__DATA_CONST 148K 2
__DATA_DIRTY 7K 1
__LINKEDIT 174.9M 3
__TEXT 7796K 2
dyld private memory 260K 2
shared memory 4K 1
=========== ======= =======
TOTAL 248.2M 18


Full Report

{"app_name":"MauiLuaEngineApp","timestamp":"2024-01-20 14:12:03.00 +0300","app_version":"1.0","slice_uuid":"626c40fe-eb25-33c0-a097-5e78d780e364","build_version":"1","platform":6,"bundleID":"com.companyname.mauiluaengineapp","share_with_app_devs":0,"is_first_party":0,"bug_type":"309","os_version":"macOS 13.6.3 (22G436)","roots_installed":0,"name":"MauiLuaEngineApp","incident_id":"E37EB252-54B3-40E1-B8E2-1AA24CC8050F"}
{
"uptime" : 63000,
"procRole" : "Background",
"version" : 2,
"userID" : 501,
"deployVersion" : 210,
"modelCode" : "MacBookPro14,2",
"coalitionID" : 1710,
"osVersion" : {
"train" : "macOS 13.6.3",
"build" : "22G436",
"releaseType" : "User"
},
"captureTime" : "2024-01-20 14:12:03.6429 +0300",
"incident" : "E37EB252-54B3-40E1-B8E2-1AA24CC8050F",
"pid" : 21362,
"cpuType" : "X86-64",
"roots_installed" : 0,
"bug_type" : "309",
"procLaunch" : "2024-01-20 14:12:02.8551 +0300",
"procStartAbsTime" : 63384907628004,
"procExitAbsTime" : 63385693874689,
"procName" : "MauiLuaEngineApp",
"procPath" : "/Users/USER//MauiLuaEngineApp.app/Contents/MacOS/MauiLuaEngineApp",
"bundleInfo" : {"CFBundleShortVersionString":"1.0","CFBundleVersion":"1","CFBundleIdentifier":"com.companyname.mauiluaengineapp"},
"storeInfo" : {"deviceIdentifierForVendor":"31733DF3-59E1-5175-B932-EEF19D840700","thirdParty":true},
"parentProc" : "launchd",
"parentPid" : 1,
"coalitionName" : "com.companyname.mauiluaengineapp",
"crashReporterKey" : "A3A6B850-4D11-D8B5-F769-235CF69CF693",
"codeSigningID" : "com.companyname.mauiluaengineapp",
"codeSigningTeamID" : "",
"codeSigningFlags" : 570425345,
"codeSigningValidationCategory" : 10,
"codeSigningTrustLevel" : 0,
"wakeTime" : 3073,
"bridgeVersion" : {"build":"14Y910","train":"3.0"},
"sleepWakeUUID" : "B7D41381-35B8-48B9-A471-96D8F2E5E9F1",
"sip" : "enabled",
"exception" : {"codes":"0x0000000000000000, 0x0000000000000000","rawCodes":[0,0],"type":"EXC_CRASH","signal":"SIGABRT"},
"termination" : {"code":1,"flags":518,"namespace":"DYLD","indicator":"Library missing","details":["(terminated at launch; ignore backtrace)"],"reasons":["Library not loaded: @rpath/liblua54.framework/Versions/A/liblua54","Referenced from: <626C40FE-EB25-33C0-A097-5E78D780E364> /Users/USER/
/MauiLuaEngineApp.app/Contents/MacOS/MauiLuaEngineApp","Reason: tried: '/Users/yurasultanov/LuaUiEngine/LuaUiEngine/MauiLuaEngineApp/bin/Debug/net7.0-maccatalyst/maccatalyst-x64/MauiLuaEngineApp.app/Contents/Frameworks/liblua54.framework/Versions/A/liblua54' (no such file), '/Users/yurasultanov/LuaUiEngine/LuaUiEngine/MauiLuaEngineApp/bin/Debug/net7.0-maccatalyst/maccatalyst-x64/MauiLuaEngineApp.app/Contents/Frameworks/liblua54.framework/Versions/A/liblua54' (no such file)"]},
"extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":21},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
"faultingThread" : 0,
"threads" : [{"triggered":true,"id":701206,"threadState":{"r13":{"value":140701841720816},"rax":{"value":33554953},"rflags":{"value":582},"cpu":{"value":0},"r14":{"value":1},"rsi":{"value":1},"r8":{"value":140701841719792},"cr2":{"value":0},"rdx":{"value":140701841720816},"r10":{"value":225},"r9":{"value":0},"r15":{"value":6},"rbx":{"value":0},"trap":{"value":133},"err":{"value":33554953},"r11":{"value":582},"rip":{"value":140703409871954,"matchesCrashFrame":1},"rbp":{"value":140701841719760},"rsp":{"value":140701841719688},"r12":{"value":225},"rcx":{"value":140701841719688},"flavor":"x86_THREAD_STATE","rdi":{"value":6}},"frames":[{"imageOffset":441426,"symbol":"__abort_with_payload","symbolLocation":10,"imageIndex":1},{"imageOffset":548823,"symbol":"abort_with_payload_wrapper_internal","symbolLocation":82,"imageIndex":1},{"imageOffset":548873,"symbol":"abort_with_payload","symbolLocation":9,"imageIndex":1},{"imageOffset":43248,"symbol":"dyld4::halt(char const*)","symbolLocation":375,"imageIndex":1},{"imageOffset":31601,"symbol":"dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*)","symbolLocation":4526,"imageIndex":1},{"imageOffset":25533,"symbol":"start","symbolLocation":1805,"imageIndex":1}]}],
"usedImages" : [
{
"source" : "P",
"arch" : "x86_64",
"base" : 4507066368,
"CFBundleShortVersionString" : "1.0",
"CFBundleIdentifier" : "com.companyname.mauiluaengineapp",
"size" : 7356416,
"uuid" : "626c40fe-eb25-33c0-a097-5e78d780e364",
"path" : "/Users/USER/*/MauiLuaEngineApp.app/Contents/MacOS/MauiLuaEngineApp",
"name" : "MauiLuaEngineApp",
"CFBundleVersion" : "1"
},
{
"source" : "P",
"arch" : "x86_64",
"base" : 140703409430528,
"size" : 624112,
"uuid" : "3400ad17-ab59-3b27-9a44-9b280fab5c3f",
"path" : "/usr/lib/dyld",
"name" : "dyld"
}
],
"sharedCache" : {
"base" : 140703408807936,
"size" : 21474836480,
"uuid" : "97d6888a-2705-3991-b7e9-e38694d68f1e"
},
"vmSummary" : "ReadOnly portion of Libraries: Total=182.5M resident=0K(0%) swapped_out_or_unallocated=182.5M(100%)\nWritable regions: Total=9124K written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=9124K(100%)\n\n VIRTUAL REGION \nREGION TYPE SIZE COUNT (non-coalesced) \n=========== ======= ======= \nSTACK GUARD 56.0M 1 \nStack 8192K 1 \nVM_ALLOCATE 8K 2 \n__DATA 1323K 3 \n__DATA_CONST 148K 2 \n__DATA_DIRTY 7K 1 \n__LINKEDIT 174.9M 3 \n__TEXT 7796K 2 \ndyld private memory 260K 2 \nshared memory 4K 1 \n=========== ======= ======= \nTOTAL 248.2M 18 \n",
"legacyInfo" : {
"threadTriggered" : {

}
},
"logWritingSignature" : "9678640b19198e6ab039262e634f7fec756f560f",
"trialInfo" : {
"rollouts" : [
{
"rolloutId" : "62c74108bcb0435c2153f963",
"factorPackIds" : {
"SIRI_TEXT_TO_SPEECH" : "657a4921d6ad146894c1b003"
},
"deploymentId" : 240000394
},
{
"rolloutId" : "60da5e84ab0ca017dace9abf",
"factorPackIds" : {

  },
  "deploymentId" : 240000008
}

],
"experiments" : [

]
}
}

Model: MacBookPro14,2, BootROM 522.0.0.0.0, 2 processors, Dual-Core Intel Core i5, 3,1 GHz, 8 GB, SMC 2.44f6
Graphics: Intel Iris Plus Graphics 650, Intel Iris Plus Graphics 650, Built-In
Display: Color LCD, 2560 x 1600 Retina, Main, MirrorOff, Online
Memory Module: BANK 0/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x802C, 0x4D5435324C3531324D3332443250462D3039
Memory Module: BANK 1/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x802C, 0x4D5435324C3531324D3332443250462D3039
AirPort: spairport_wireless_card_type_wifi (0x14E4, 0x171), Broadcom BCM43xx 1.0 (7.77.111.1 AirPortDriverBrcmNIC-1772.1)
AirPort:
Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
USB Device: USB30Bus
USB Device: Apple T1 Controller
Thunderbolt Bus: MacBook Pro, Apple Inc., 41.5
Thunderbolt Bus: MacBook Pro, Apple Inc., 41.5
`

@Jurashikku
Copy link
Author

Try create clean one app without dll.
Create Clear Maui .net7 App
And NLua 1.6.3
Start Build - "file not found"

Create clean app MAUI .net7
Add KeraLua
Start Build = "file not found"

Is all ways file located in /Users/**/Projects///bin/Debug/net7.0-maccatalyst/maccatalyst-x64/
But not in Macos app folder
/ClearMauiLuaApp.app/Contents/Frameworks/liblua54.framework/Versions/A/liblua54

@Jurashikku
Copy link
Author

So I go to folder and found
/ClearMauiLuaApp.app/Contents/Frameworks/liblua54.framework/liblua54

But this part not created.... -_-"
/Versions/A/

Now is request... it's error in lib or in maui, or need some actions in vs 2022 for Mac.

@Jurashikku
Copy link
Author

If copy /liblua54.framework/liblua54
to /liblua54.framework/Versions/A/liblua54
Application start correct, mb looking for KernLua for adding deploy path.

@Jurashikku
Copy link
Author

See KernLua
and found CMake
\KeraLua\external\lua\ios_build

maccatalyst: ./maccatalyst/liblua54.framework/liblua54 ./maccatalyst/liblua54.framework/liblua54: xcodebuild -configuration Release -destination "platform=macOS,variant=Mac Catalyst" -project lua.maccatalyst.xcodeproj -scheme liblua54 SYMROOT=build_maccatalyst/ ditto ./build_maccatalyst/Release-maccatalyst/liblua54.framework/Versions/A/ ./maccatalyst/liblua54.framework/
If it build correct - but not.

It look like MAUI build think that is ios
ios: ./ios/liblua54.framework/liblua54 ./ios/liblua54.framework/liblua54: xcodebuild -project lua.ios.xcodeproj -configuration Release -sdk iphonesimulator xcodebuild -project lua.ios.xcodeproj -configuration Release -sdk iphoneos ditto ./Build/Release-iphoneos/ ./ios/ rm ./ios/liblua54.framework/liblua54 lipo -create ./build/Release-iphonesimulator/liblua54.framework/liblua54 ./build/Release-iphoneos/liblua54.framework/liblua54 -output ./ios/liblua54.framework/liblua54

But, when i build on simulator IPad still that error.
I will check later, but mb now all ios and catalyst must set '/Version/A/

@Jurashikku
Copy link
Author

See KernLua and found CMake \KeraLua\external\lua\ios_build

maccatalyst: ./maccatalyst/liblua54.framework/liblua54 ./maccatalyst/liblua54.framework/liblua54: xcodebuild -configuration Release -destination "platform=macOS,variant=Mac Catalyst" -project lua.maccatalyst.xcodeproj -scheme liblua54 SYMROOT=build_maccatalyst/ ditto ./build_maccatalyst/Release-maccatalyst/liblua54.framework/Versions/A/ ./maccatalyst/liblua54.framework/ If it build correct - but not.

It look like MAUI build think that is ios ios: ./ios/liblua54.framework/liblua54 ./ios/liblua54.framework/liblua54: xcodebuild -project lua.ios.xcodeproj -configuration Release -sdk iphonesimulator xcodebuild -project lua.ios.xcodeproj -configuration Release -sdk iphoneos ditto ./Build/Release-iphoneos/ ./ios/ rm ./ios/liblua54.framework/liblua54 lipo -create ./build/Release-iphonesimulator/liblua54.framework/liblua54 ./build/Release-iphoneos/liblua54.framework/liblua54 -output ./ios/liblua54.framework/liblua54

But, when i build on simulator IPad still that error. I will check later, but mb now all ios and catalyst must set '/Version/A/

My faild, that is ditto copy from Version/A to simple, but MAUI still looking for Version/A

@Jurashikku
Copy link
Author

Only one way to fix this by adding trigger to project.

  1. Open .csproj
  2. Add triggers to element

<Target Name="PostBuildMaccatalyst" AfterTargets="PostBuildEvent" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'"> <Copy SourceFiles="$(TargetDir)$(TargetName).app\Contents\Frameworks\liblua54.framework\liblua54" DestinationFolder="$(TargetDir)$(TargetName).app\Contents\Frameworks\liblua54.framework\Versions\A\" /> </Target>

This action after build application cope framework to correct directory.

But need answer from creator of NLua and KernLua

@Jurashikku
Copy link
Author

All in all i think error in linking KernLua on (net7.0-ios and net7.0-maccatalyst targeting)
When link native library it try to find it in "Versions/A" but in xcodebuild it copied from this path to default liblua54.framework

@Jurashikku
Copy link
Author

So, i create forks for all products after modding Makefile with adding

path \external\lua\ios_build
file Makefile
after line 26
add
ditto ./build_maccatalyst/Release-maccatalyst/liblua54.framework/Versions/A/ ./maccatalyst/liblua54.framework/Versions/A/

it's work correctly.

Mb u can fix this?

Now, the real problem (as i understand) that old standart of macos(or xamarin-macos) used common '/name.framework/name' path, but on new maccatalyst(or maui) it try to call
'/name.framework/Versions/A/name' .

So where making linking? In Xcode or in MSBuild?

If XCode - so bab, couse all old library stop founding, couse this error. (Some libs dont need update with new os version if they selffull) But all other need wait update Makefile for buildup on prebuild action. (Like some cross platform libs from nuget (KeraLua, for example).

If MsBuild make links, mb simple add somethink like supporting old libs.
(Copy '/name.framework/name' to '/name.framework/Versions/A/name' ) - that may works by hand if i copy files to
'appName.app/Frameworks/name.framework/Versions/A/name' app work correct, but drop hash of project and it's be enable to install on local device (iphone 11, iphone 12 pro max - tests) but can debug in simulator and on mac (MacBook)

@viniciusjarina
Copy link
Member

I am not sure why that's the case, since LuaLibraryName is hardcoded on DllImport https://github.com/NLua/KeraLua/blob/main/src/NativeMethods.cs#L27

It seems like a bug on .NET iOS runtime

@viniciusjarina
Copy link
Member

I guess I manage to fix changing Xcode project option

@viniciusjarina
Copy link
Member

viniciusjarina commented Jan 29, 2024

@Jurashikku try 1.7.1

@Jurashikku
Copy link
Author

@Jurashikku try 1.7.1

Will try tommorrow! And replay.

@Jurashikku
Copy link
Author

Jurashikku commented Feb 2, 2024

@Jurashikku try 1.7.1

Still try versions/a/


Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: @rpath/liblua54.framework/Versions/A/liblua54
Referenced from: <C1F26BB7-5FB1-3C4B-86BE-50716F24F7B8> /Users/USER/*/MauiLuaApp.app/Contents/MacOS/MauiLuaApp
Reason: tried: '/Users/yurasultanov/LuaUiEngine/LuaUiEngine/MauiLuaApp/bin/Debug/net7.0-maccatalyst/maccatalyst-x64/MauiLuaApp.app/Contents/Frameworks/liblua54.framework/Versions/A/liblua54' (no such file), '/Users/yurasultanov/LuaUiEngine/LuaUiEngine/MauiLuaApp/bin/Debug/net7.0-maccatalyst/maccatalyst-x64/MauiLuaApp.app/Contents/Frameworks/liblua54.framework/Versions/A/

Why to test

Create .net 7 library
Add NLua
Create BaseClass with init NLua()
Create Maui .net 7
Add Lib as reference
Initialize BaseClass()

@Jurashikku
Copy link
Author

There are two fixes:

Change the location of the liblua54 library to be where it says it is inside the .framework (in Versions/A/liblua54).
Change the LC_ID_DYLIB value to state the correct location (@rpath/liblua54.framework/liblua54).
Looks like option 2. can be accomplished by setting LD_DYLIB_INSTALL_NAME in your Xcode project file: https://developer.apple.com/documentation/xcode/build-settings-reference#Dynamic-Library-Install-Name

I think that is way when apple port to one OsCore and for correct work Xcode hardcoded by default LD_DYLIB_INSTALL_NAME to /Versions/A/

@Jurashikku
Copy link
Author

Jurashikku commented Feb 2, 2024

So loo forward of framework build what I see

About Framework Version

About Framework Structure

So i think that link lib is builded as Framework and compile with default version a parameter

@viniciusjarina
Copy link
Member

I guess is a bug on Xcode. I fixed forcing the right install_name value.
It should be fixed on 1.7.2 (KeraLua 1.4.1) NLua/lua@4d5829b

@Jurashikku
Copy link
Author

I guess is a bug on Xcode. I fixed forcing the right install_name value. It should be fixed on 1.7.2 (KeraLua 1.4.1) NLua/lua@4d5829b

After update, now droped exception
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: lua54 at at KeraLua.Lua..ctor(Boolean openLibs) at at NLua.Lua..ctor(Boolean openLibs) at MauiNluaLib.TestMauiNlua.Init() in /Users/yurasultanov/Projects/NluaTestMaui/MauiNluaLib/TestMauiNlua.cs:8 at NluaTestMaui.MainPage..ctor() in /Users/yurasultanov/Projects/NluaTestMaui/NluaTestMaui/MainPage.xaml.cs:13 at at System.Reflection.ConstructorInvoker.InterpretedInvoke(Object obj, Span1 args, BindingFlags invokeAttr)
--- End of inner exception stack trace ---
at at System.RuntimeType.CreateInstanceMono(Boolean nonPublic, Boolean wrapExceptions)
at at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
at at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
at at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at at System.Activator.CreateInstance(Type type)
at at Microsoft.Maui.Controls.ShellContent.<>c__DisplayClass19_0.<Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent>b__0()
at at Microsoft.Maui.Controls.ElementTemplate.CreateContent()
at at Microsoft.Maui.Controls.Internals.DataTemplateExtensions.CreateContent(DataTemplate self, Object item, BindableObject container)
at at Microsoft.Maui.Controls.ShellContent.Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent()
at at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.LoadRenderers()
at at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.ViewDidLoad()
at at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName)
at at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)
at NluaTestMaui.Program.Main(String[] args) in /Users/yurasultanov/Projects/NluaTestMaui/NluaTestMaui/Platforms/MacCatalyst/Program.cs:13
`

Create Test Project

  1. MauiApp
  2. clear .net7 lib with NLua
  3. clear maui lib with NLua

@Jurashikku
Copy link
Author

Where Test Initi

@viniciusjarina
Copy link
Member

Try to bump to .NET 8, I've updated NLua/KeraLua to .NET 8. Just tested here with a Mac Catalyst application and is working fine.

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