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

Build on MacOS with clang 15 got error #217

Open
daeho-ro opened this issue Aug 4, 2024 · 0 comments
Open

Build on MacOS with clang 15 got error #217

daeho-ro opened this issue Aug 4, 2024 · 0 comments

Comments

@daeho-ro
Copy link

daeho-ro commented Aug 4, 2024

Build libks on macOS 14.5 arm64 with clang 15 got error.

  /opt/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_ATTR_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=\"bugs@freeswitch.org\" -DPACKAGE_NAME=\"libks2\" -DPACKAGE_STRING="\"libks2 2.0.2\"" -DPACKAGE_TARNAME=\"libks2\" -DPACKAGE_URL=\"\" -DPACKAGE_VERSION=\"2.0.2\" -DRETSIGTYPE=void -DSTDC_HEADERS=1 -DTIME_WITH_SYS_TIME=1 -DVERSION=\"2.0.2\" -D_GNU_SOURCE=1 -D_REENTRANT=1 -D__BYTE_ORDER=__LITTLE_ENDIAN -I/tmp/freeswitch--libks-20240802-31105-i2nxqq/src/include -I/tmp/freeswitch--libks-20240802-31105-i2nxqq -isystem /opt/homebrew/Cellar/openssl@3/3.3.1/include -isystem /opt/homebrew/Cellar/util-linux/2.40.2/include/uuid -std=c11 -O3 -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -fPIC -fvisibility=hidden -O2 -g -Wno-parentheses -Wno-pointer-sign -Wno-switch -MD -MT CMakeFiles/ks2.dir/src/ks_time.c.o -MF CMakeFiles/ks2.dir/src/ks_time.c.o.d -o CMakeFiles/ks2.dir/src/ks_time.c.o -c /tmp/freeswitch--libks-20240802-31105-i2nxqq/src/ks_time.c
  /tmp/freeswitch--libks-20240802-31105-i2nxqq/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]
          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

So I have changed the cmake file a bit and successfully built the package. It seems that the clang 15 changes integer conversion warning into an error, see the changes on clang 15. Is this reasonable changes? Thanks.

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
None yet
Projects
None yet
Development

No branches or pull requests

1 participant