### Description

Using `cmake` to compile on MacOS (Darwin) 15.1.1 (Sequoia) fails.

### Troubleshooting

#### Reproduction

<!--
If the issue can be reproduced, describe how it can be done.
-->

#### Debugging Data

```
mkdir buildmac
cd buildmac/
cmake ..
make VERBOSE=1
/opt/local/bin/cmake -S/tmp/kamailio -B/tmp/kamailio/buildmac 
--check-build-system CMakeFiles/Makefile.cmake 0
/opt/local/bin/cmake -E cmake_progress_start /tmp/kamailio/buildmac/CMakeFiles 
/tmp/kamailio/buildmac//CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make  -f 
CMakeFiles/Makefile2 all
/Applications/Xcode.app/Contents/Developer/usr/bin/make  -f 
src/core/CMakeFiles/GenerateParser.dir/build.make 
src/core/CMakeFiles/GenerateParser.dir/depend
cd /tmp/kamailio/buildmac && /opt/local/bin/cmake -E cmake_depends "Unix 
Makefiles" /tmp/kamailio /tmp/kamailio/src/core /tmp/kamailio/buildmac 
/tmp/kamailio/buildmac/src/core 
/tmp/kamailio/buildmac/src/core/CMakeFiles/GenerateParser.dir/DependInfo.cmake 
"--color="
Dependencies file "src/core/CMakeFiles/GenerateParser.dir/lex.yy.c.o.d" is 
newer than depends file 
"/tmp/kamailio/buildmac/src/core/CMakeFiles/GenerateParser.dir/compiler_depend.internal".
Consolidate compiler generated dependencies of target GenerateParser
/Applications/Xcode.app/Contents/Developer/usr/bin/make  -f 
src/core/CMakeFiles/GenerateParser.dir/build.make 
src/core/CMakeFiles/GenerateParser.dir/build
[  0%] Building C object src/core/CMakeFiles/GenerateParser.dir/lex.yy.c.o
cd /tmp/kamailio/buildmac/src/core && 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
 -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 -DARCH=\"arm64\" 
-DCFG_DIR=\"/usr/local/etc/kamailio/\" -DCOMPILER=\"16.0.0.16000026\" 
-DDBG_SR_MEMORY -DDISABLE_NAGLE -DDNS_IP_HACK -DFAST_LOCK -DFMSTATS -DF_MALLOC 
-DHAVE_RESOLV_RES -DKMSTATS -DKSR_PTHREAD_MUTEX_SHARED -DMALLOC_STATS 
-DNAME=\"kamailio\" -DOS=Darwin -DOS_QUOTED=\"Darwin\" -DPIC -DPKG_MALLOC 
-DQ_MALLOC -DRAW_SOCKS -DRUN_DIR=\"/var/run/kamailio\" 
-DSHARE_DIR=\"/usr/local/share/kamailio/\" -DSHM_MMAP -DSTATISTICS 
-DTLSF_MALLOC -DTLS_HOOKS -DUSE_DNS_CACHE -DUSE_DNS_FAILOVER 
-DUSE_DST_BLOCKLIST -DUSE_FUTEX -DUSE_MCAST -DUSE_NAPTR -DUSE_SCTP -DUSE_TCP 
-DUSE_TLS -DVERSION=\"6.0.0-dev2\" -DVERSIONVAL=6000000 -D__CPU_arm64 
-D__OS_darwin  -std=gnu11 -arch arm64 -isysroot 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk
 -MD -MT src/core/CMakeFiles/GenerateParser.dir/lex.yy.c.o -MF 
CMakeFiles/GenerateParser.dir/lex.yy.c.o.d -o 
CMakeFiles/GenerateParser.dir/lex.yy.c.o -c /tmp/kamailio/src/core/lex.yy.c
In file included from /tmp/kamailio/src/core/cfg.lex:33:
In file included from /tmp/kamailio/src/core/globals.h:34:
In file included from /tmp/kamailio/src/core/ip_addr.h:39:
In file included from /tmp/kamailio/src/core/ut.h:46:
In file included from /tmp/kamailio/src/core/mem/shm_mem.h:32:
In file included from /tmp/kamailio/src/core/mem/shm.h:44:
In file included from /tmp/kamailio/src/core/mem/../lock_ops.h:92:
/tmp/kamailio/src/core/mem/../fastlock.h:130:2: error: "unknown architecture"
  130 | #error "unknown architecture"
      |  ^
/tmp/kamailio/src/core/mem/../fastlock.h:294:2: error: "unknown architecture"
  294 | #error "unknown architecture"
      |  ^
/tmp/kamailio/src/core/mem/../fastlock.h:317:2: error: call to undeclared 
function 'membar_getlock'; ISO C99 and later do not support implicit function 
declarations [-Wimplicit-function-declaration]
  317 |         membar_getlock();
      |         ^
/tmp/kamailio/src/core/mem/../fastlock.h:328:2: error: call to undeclared 
function 'membar_getlock'; ISO C99 and later do not support implicit function 
declarations [-Wimplicit-function-declaration]
  328 |         membar_getlock();
      |         ^
/tmp/kamailio/src/core/mem/../fastlock.h:436:2: error: "unknown architecture"
  436 | #error "unknown architecture"
      |  ^
5 errors generated.
make[2]: *** [src/core/CMakeFiles/GenerateParser.dir/lex.yy.c.o] Error 1
make[1]: *** [src/core/CMakeFiles/GenerateParser.dir/all] Error 2
make: *** [all] Error 2
```

Compiling with the old Makefiles (just git clone and then `make Q=0`), the 
compile command looks like:

```
gcc -g -pthread -DKSR_PTHREAD_MUTEX_SHARED -Wunused-variable -Wuninitialized    
-DNAME='"kamailio"' -DVERSION='"6.0.0-dev3"' -DARCH='"arm64"' -DOS='darwin_' 
-DOS_QUOTED='"darwin"' -DCOMPILER='"gcc Apple clang version 16.0.0 
(clang-1600.0.26.4)"' -D__CPU_arm64 -D__OS_darwin -DVERSIONVAL=6000000 
-DCFG_DIR='"/opt/local/etc/kamailio/"' 
-DSHARE_DIR='"/opt/local/share/kamailio/"' -DRUN_DIR='"/var/run/kamailio/"' 
-DPKG_MALLOC -DSHM_MMAP -DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP -DDISABLE_NAGLE 
-DHAVE_RESOLV_RES -DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLOCKLIST 
-DUSE_NAPTR -DMEM_JOIN_FREE -DF_MALLOC -DQ_MALLOC -DTLSF_MALLOC -DDBG_SR_MEMORY 
-DUSE_TLS -DTLS_HOOKS -DUSE_CORE_STATS -DSTATISTICS -DMALLOC_STATS -DUSE_SCTP 
-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN 
-DHAVE_SCHED_YIELD -DHAVE_MSGHDR_MSG_CONTROL -DUSE_ANON_MMAP -DNDEBUG 
-DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM -DUSE_SIGWAIT -DHAVE_IP_MREQN 
-DUSE_PTHREAD_MUTEX -DUSE_SYSV_SEM -DHAVE_KQUEUE -DHAVE_SELECT   -c 
core/lex.yy.c -o core/lex.yy.o
```

### Possible Solutions

<!--
If you found a solution or workaround for the issue, describe it. Ideally, 
provide a pull request with a fix.
-->

### Additional Information

  * **Kamailio Version** - output of `kamailio -v`

```
Kamailio master branch
```

* **Operating System**:


```
❯ uname -a
Darwin Mac 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:11 PDT 2024; 
root:xnu-11215.41.3~2/RELEASE_ARM64_T6020 arm64

❯ uname -m
arm64

❯ uname -p
arm

❯ cmake --version
cmake version 3.29.5

CMake suite maintained and supported by Kitware (kitware.com/cmake).
```


-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4049
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/issues/4...@github.com>
_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to