Asterisk 20.5.0 on macOS 14.0

Hi guys,

I’m trying to build Asterisk 20.5.0 on macOS 14.0 with gcc and /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk toolchain.

Compiler flags:

  • DON’T OPTIMIZE - on
  • BUILD NATIVE - off
  • DISABLE_INLINE - on
./asterisk -V
Asterisk 20.5.0

otool -L asterisk 
asterisk:
	/opt/ast/lib/libasteriskssl.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1336.0.0)
	/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
	/usr/lib/libxslt.1.dylib (compatibility version 3.0.0, current version 3.26.0)
	/usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 349.1.0)
	/opt/homebrew/opt/openssl@3/lib/libssl.3.dylib (compatibility version 3.0.0, current version 3.0.0)
	/opt/homebrew/opt/openssl@3/lib/libcrypto.3.dylib (compatibility version 3.0.0, current version 3.0.0)
	/opt/homebrew/opt/jansson/lib/libjansson.4.dylib (compatibility version 19.0.0, current version 19.0.0)
	/usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libedit.3.dylib (compatibility version 2.0.0, current version 3.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1600.151.0)

However when I run asterisk I have crash with symbol not found error. I was trying to incease verbosity to find which dynamic libraries were called with DYLD_PRINT_LIBRARIES=1 DYLD_PRINT_APIS=1 DYLD_PRINT_WARNINGS=1 but no luck.

Crash report shows:

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

Termination Reason:    Namespace DYLD, Code 9 
missing symbol called

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   dyld                          	       0x1901b5b48 __abort_with_payload + 8
1   dyld                          	       0x1901c2108 abort_with_payload_wrapper_internal + 104
2   dyld                          	       0x1901c213c abort_with_payload + 16
3   dyld                          	       0x190149518 dyld4::halt(char const*, dyld4::StructuredError const*) + 304
4   dyld                          	       0x190181198 dyld4::APIs::_dyld_missing_symbol_abort() + 28
5   asterisk                      	       0x1045cfc34 __ao2_ref + 460 (astobj2.c:530)
6   asterisk                      	       0x1047c61ec ast_manager_register_struct + 312 (manager.c:7976)
7   asterisk                      	       0x1047c722c ast_manager_register2 + 3664 (manager.c:8065)
8   asterisk                      	       0x104652f4c astdb_init + 232 (db.c:1207)
9   asterisk                      	       0x1045cdccc asterisk_daemon + 1108 (asterisk.c:4162)
10  asterisk                      	       0x1045cd6c8 main + 6564 (asterisk.c:4028)
11  dyld                          	       0x190145058 start + 2224

Thread 1:
0   libsystem_kernel.dylib        	       0x190481ea8 __semwait_signal + 8
1   libsystem_c.dylib             	       0x1903654c4 nanosleep + 220
2   libsystem_c.dylib             	       0x19036e284 sleep + 52
3   asterisk                      	       0x104652cdc db_sync_thread + 280 (db.c:1157)
4   asterisk                      	       0x104759800 dummy_start + 140 (utils.c:1607)
5   libsystem_pthread.dylib       	       0x1904bf034 _pthread_start + 136
6   libsystem_pthread.dylib       	       0x1904b9e3c thread_start + 8


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000006   x1: 0x0000000000000009   x2: 0x000000016b85d200   x3: 0x0000000000000014
    x4: 0x000000016b85ce00   x5: 0x0000000000000000   x6: 0x0000000000000000   x7: 0xffffffff00000700
    x8: 0x0000000000000020   x9: 0x000000016b85cd7e  x10: 0x000000000000000a  x11: 0x0000000000000000
   x12: 0x0000000000000033  x13: 0x00000000000007fd  x14: 0x000000008d1debe6  x15: 0x00000000000003e6
   x16: 0x0000000000000209  x17: 0x000000019014237c  x18: 0x0000000000000000  x19: 0x0000000000000000
   x20: 0x000000016b85ce00  x21: 0x0000000000000014  x22: 0x000000016b85d200  x23: 0x0000000000000009
   x24: 0x0000000000000006  x25: 0x00000001901c3b1b  x26: 0x0000000000000000  x27: 0x0000000000000000
   x28: 0x0000000000000000   fp: 0x000000016b85cdd0   lr: 0x00000001901c2108
    sp: 0x000000016b85cd90   pc: 0x00000001901b5b48 cpsr: 0x40001000
   far: 0x00000001048183a8  esr: 0x56000080  Address size fault

Binary Images:
       0x104e4c000 -        0x104e4ffff libasteriskssl.dylib (*) <b782df04-11eb-3d2d-8e08-7cecdd26878d> /opt/ast/*/libasteriskssl.dylib
       0x104ee0000 -        0x104f37fff libssl.3.dylib (*) <d0d1173a-c659-3254-9f53-e2956d2b3e1b> /opt/homebrew/*/libssl.3.dylib
       0x1052b8000 -        0x1054f3fff libcrypto.3.dylib (*) <b632833e-1f0e-3daf-9e52-34a4ac085538> /opt/homebrew/*/libcrypto.3.dylib
       0x104e70000 -        0x104e7bfff libjansson.4.dylib (*) <1ea2b48d-105e-3d6f-a0b2-6b3344ac3ce2> /opt/homebrew/*/libjansson.4.dylib
       0x1045a0000 -        0x10489bfff asterisk (*) <f7cae3e6-3863-3e47-b1cd-5a7cc3315cd8> /opt/ast/*/asterisk
       0x19013f000 -        0x1901d2873 dyld (*) <ffd8ab66-c9ab-31df-ab80-3a3dff367ddd> /usr/lib/dyld
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
       0x19047d000 -        0x1904b7fef libsystem_kernel.dylib (*) <a7d3c07d-0a1e-3c4c-8fba-66905e16bf99> /usr/lib/system/libsystem_kernel.dylib
       0x190358000 -        0x1903d6ff3 libsystem_c.dylib (*) <1b84a7e4-8958-330c-98b8-27d491dff69e> /usr/lib/system/libsystem_c.dylib
       0x1904b8000 -        0x1904c4ff3 libsystem_pthread.dylib (*) <e4debb6e-421d-33d0-9e17-77ae0e0fe4dc> /usr/lib/system/libsystem_pthread.dylib

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: 0
    thread_create: 0
    thread_set_state: 0

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

Crash report points here:

  • asterisk.c:4162
  • db.c:1207
  • manager.c:8065
  • astobj2.c:530

Any help would be helpful in this moment. If someone could point me where to fix this I would be greatful.

Thanks,

I went back to clang with several patches in Makefiles now it works. However this was done with --without-pjproject-bundled --without-pjproject. If I include pjproject I have “symbol not found” again.

I’m making some progress with pjproject. As I can see pj_init symbol is missing from libasteriskpj.dylib.

nm -a main/libasteriskpj.dylib |grep pj_init
0000000000003f00 - 01 0000   FUN _ast_pj_init
0000000000003f00 T _ast_pj_init
                 U _pj_init

I think this could be linker issue somewhere, as I see that symbol in third-party/pjproject/source/pjlib/lib/libpj-arm-apple-darwin23.0.0.a etc…

If your mac is an arm based one not sure that asterisk will be fully compliant. In this case you could consider running it in a virtual machine or in docker.

No VM or docker as this is development environment anyway. Do you know which parts are not compliant?

Thanks,

It was a supposition ;). No clue on what could be the problem.

So far it running great, although I’m using only chan_sip, res_config_pgsql etc… I didn’t notice anything strange.

Next step is fixing pj linking and undefined symbols. I believe we can fix it.

I’ve managed to link agaist pjproject now and it seems it is more or less complete. I will fix patches in better way soon, but if anyone wants to use this kind of setup here it is:

Best regards,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.