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

make libks fails on Intel Mac "incompatible pointer to integer conversion" - clang 16 for Sequoia and Sonoma #2600

Open
MarioG-X opened this issue Sep 17, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@MarioG-X
Copy link
Contributor

MarioG-X commented Sep 17, 2024

Describe the bug
C, C++ and Clang deprecated various coding over the years. Recent compilers are disallowing deprecated code, this started in 2020 and extended to later compilers. FreeSwitch contains deprecated code that previously compiled, but now fails.

This is on macOS Sequoia which requires Command Line Tools 16 Clang and Sonoma on an Intel Mac, it would also apply to Apple Silicon.

An example causing the error below:
"In Clang 15, the -Wint-conversion warning has been upgraded to an error. This warning catches when an integer is being implicitly converted to a pointer. One common mistake that this warning will catch is implicit function definitions, where code tries to call a function that has not been declared."

I don't know how to fix this in the code, the error messages are:

[ 38%] Building C object CMakeFiles/ks.dir/src/simclist.c.o
/usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -DCJSON_HIDE_SYMBOLS=1 -DHAVE_DIRENT_H=1 -DHAVE_DLFCN_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIBCRYPTO=1 -DHAVE_LIBSSL=1 -DHAVE_MALLOC=1 -DHAVE_MEMMEM=1 -DHAVE_MEMORY_H=1 -DHAVE_PTHREAD_SETSCHEDPARAM=1 -DHAVE_SCHED_H=1 -DHAVE_STDINT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRINGS_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_USLEEP=1 -DKS_API_VISIBILITY=1 -DKS_EXPORTS -DKS_PLAT_MAC=1 -DPACKAGE_BUGREPORT="[email protected]" -DPACKAGE_NAME="libks" -DPACKAGE_STRING=""libks 1.8.3"" -DPACKAGE_TARNAME="libks" -DPACKAGE_URL="" -DPACKAGE_VERSION="1.8.3" -DRETSIGTYPE=void -DSTDC_HEADERS=1 -DTIME_WITH_SYS_TIME=1 -DVERSION="1.8.3" -D_GNU_SOURCE=1 -D_REENTRANT=1 -D__BYTE_ORDER=__LITTLE_ENDIAN -I/tmp/libks-20240917-18374-nboftl/libks-1.8.3/src/include -I/tmp/libks-20240917-18374-nboftl/libks-1.8.3 -isystem /usr/local/opt/openssl/include -isystem /usr/local/Cellar/ossp-uuid/1.6.2_2/include/ossp -std=c11 -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk -fPIC -fvisibility=hidden -O2 -g -Wno-parentheses -Wno-pointer-sign -Wno-switch -MD -MT CMakeFiles/ks.dir/src/simclist.c.o -MF CMakeFiles/ks.dir/src/simclist.c.o.d -o CMakeFiles/ks.dir/src/simclist.c.o -c /tmp/libks-20240917-18374-nboftl/libks-1.8.3/src/simclist.c
/tmp/libks-20240917-18374-nboftl/libks-1.8.3/src/ks_thread.c:144:9: error: incompatible pointer to integer conversion returning 'pthread_t _Nonnull' (aka 'struct _opaque_pthread_t *') from a function with result type 'ks_pid_t' (aka 'int') [-Wint-conversion]
144 | return pthread_self();
| ^~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/ks.dir/src/ks_thread.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/ks.dir/all] Error 2

These open issues may also help:
brew install signalwire/signalwire/libks Error signalwire/homebrew-signalwire#21
*** End of messages ***

Also tried libks2 as requested below, same error.

Package version or git hash
commit 792eee4 (HEAD -> master, origin/master, origin/HEAD)

To Reproduce
Steps to reproduce the behavior:
Download master, bootstrap, config, make

Expected behavior
Make success..

Package version or git hash
1.10.12 and master

@MarioG-X MarioG-X added the bug Something isn't working label Sep 17, 2024
@andywolk
Copy link
Contributor

Try removing libks and installing libks2

@MarioG-X
Copy link
Contributor Author

MarioG-X commented Sep 23, 2024

Verified libks was not installed and tried to install libks2 but got same error:

mario@Mini-2018 ~ % brew install signalwire/homebrew-signalwire/libks2
...
CMakeFiles/ks2.dir/src/simclist.c.o -c /tmp/libks2-20240923-6742-bf3hwa/libks-2.0.2/src/simclist.c
/tmp/libks2-20240923-6742-bf3hwa/libks-2.0.2/src/ks_thread.c:80:9: error: incompatible pointer to integer conversion returning 'pthread_t _Nonnull' (aka 'struct _opaque_pthread_t *') from a function with result type 'ks_pid_t' (aka 'int') [-Wint-conversion]
80 | return pthread_self();
| ^~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/ks2.dir/src/ks_thread.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/ks2.dir/all] Error 2
make: *** [all] Error 2

@MarioG-X
Copy link
Contributor Author

MarioG-X commented Sep 23, 2024

I found that this error was previously reported but for Apple Silicon whereas mine is on Intel:
signalwire/homebrew-signalwire#21

Also, wondered how home-brew people got it to work and found this at end of formula, they ignore the errors, probably best to actually fix them so as not to be an issue in the future:
https://github.com/Homebrew/homebrew-core/blob/64cf8d3a08e2731a6a0cc2b83d4621583409c3e3/Formula/f/freeswitch.rb

diff --git a/cmake/ksutil.cmake b/cmake/ksutil.cmake
index a82c639..df04a70 100644
--- a/cmake/ksutil.cmake
+++ b/cmake/ksutil.cmake
@@ -103,6 +103,7 @@ macro(ksutil_setup_platform)
add_compile_options("$<$CONFIG:Release:-Wno-parentheses>")
add_compile_options("$<$CONFIG:Release:-Wno-pointer-sign>")
add_compile_options("$<$CONFIG:Release:-Wno-switch>")

  •   add_compile_options("$<$<CONFIG:Release>:-Wno-int-conversion>")
    
      add_compile_options("$<$<CONFIG:Debug>:-O0>")
      add_compile_options("$<$<CONFIG:Debug>:-g>")
    

@@ -110,6 +111,7 @@ macro(ksutil_setup_platform)
add_compile_options("$<$CONFIG:Debug:-Wno-parentheses>")
add_compile_options("$<$CONFIG:Debug:-Wno-pointer-sign>")
add_compile_options("$<$CONFIG:Debug:-Wno-switch>")

  •   add_compile_options("$<$<CONFIG:Debug>:-Wno-int-conversion>")
    
      set(CMAKE_POSITION_INDEPENDENT_CODE YES)
      add_definitions("-DKS_PLAT_MAC=1")
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants