### 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/4049(a)github.com>
Module: kamailio
Branch: master
Commit: 6235369e1deab4b87c999d5f00fb59b6609b3df6
URL: https://github.com/kamailio/kamailio/commit/6235369e1deab4b87c999d5f00fb59b…
Author: Xenofon Karamanos <xk(a)gilawa.com>
Committer: Xenofon Karamanos <xk(a)gilawa.com>
Date: 2024-12-03T14:19:43Z
cmake: Update platform-specific flags
- Update the platform-specific flags in the "os-specific.cmake" file for Linux and DragonFly BSD.
- Add new files "dragonfly.cmake" and "linux.cmake" in the "os-specific" directory to define the flags for DragonFly BSD and Linux, respectively.
- Add a new file "macos.cmake" in the "os-specific" directory to define the flags for Mac OS X.
- Update the "defs.cmake" file to print the availability of fast lock.
---
Added: cmake/os-specific/dragonfly.cmake
Added: cmake/os-specific/linux.cmake
Added: cmake/os-specific/macos.cmake
Modified: cmake/defs.cmake
Modified: cmake/os-specific.cmake
---
Diff: https://github.com/kamailio/kamailio/commit/6235369e1deab4b87c999d5f00fb59b…
Patch: https://github.com/kamailio/kamailio/commit/6235369e1deab4b87c999d5f00fb59b…
### Description
When calling inline functions using `app_python3s_exec()`, setting the level to critical using either `KSR.xlog.xcrit("foo\n")` or using `KSR.xlog.xlog("L_CRIT", "foo\n")` Do not set the level on the log line in a manner consistent with other log levels.
#### Reproduction
Kamailio code:
```
request_route {
app_python3s_exec("log_test");
. . .
}
```
Python code to contrast how info level logging and critical level logging differ:
```
def log_test():
KSR.xlog.xinfo("This line log level: xinfo = INFO\n");
KSR.xlog.xcrit("This line log level: xcrit = CRITICAL\n");
KSR.xlog.xlog("L_INFO", "This line log level: xlog = L_INFO\n");
KSR.xlog.xlog("L_CRIT", "This line log level: xlog = L_CRIT\n");
```
#### Log Messages
Log output. Note how the info level lines begin with INFO, but the critical level lines begin with an empty string:
```
2(8) INFO: <script>: This line log level: xinfo = INFO
2(8) : <script>: This line log level: xcrit = CRITICAL
2(8) INFO: <script>: This line log level: xlog = L_INFO
2(8) : <script>: This line log level: xlog = L_CRIT
```
### Possible Solutions
The critical level lines should begin with `CRITICAL` - this is what happens if the xlog function is called in Kamailio script. The output should look like this:
```
2(8) INFO: <script>: This line log level: xinfo = INFO
2(8) CRITICAL: <script>: This line log level: xcrit = CRITICAL
2(8) INFO: <script>: This line log level: xlog = L_INFO
2(8) CRITICAL: <script>: This line log level: xlog = L_CRIT
```
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.8.4 (x86_64/linux)
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, MEM_JOIN_FREE, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_SEND_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled on 15:03:24 Nov 18 2024 with gcc 13.2.1
```
* **Operating System**:
Tested in docker on Windows 11 (WSL2) using alpine linux as a base. `/etc/os-releas`:
```
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.20.2
PRETTY_NAME="Alpine Linux v3.20"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4048
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4048(a)github.com>