error: incompatible function pointer types in ov_http_client.c:1009 gem install ovirt-engine-sdk on mac arm64
% gem install ovirt-engine-sdk -v4.6.0
Building native extensions. This could take a while...
ERROR: Error installing ovirt-engine-sdk:
ERROR: Failed to build gem native extension.
current directory: /Users/joerafaniello/.gem/ruby/3.1.4/gems/ovirt-engine-sdk-4.6.0/ext/ovirtsdk4c
/Users/joerafaniello/.rubies/ruby-3.1.4/bin/ruby -I /Users/joerafaniello/.rubies/ruby-3.1.4/lib/ruby/3.1.0 extconf.rb
checking for xml2-config... yes
checking for curl-config... yes
creating Makefile
current directory: /Users/joerafaniello/.gem/ruby/3.1.4/gems/ovirt-engine-sdk-4.6.0/ext/ovirtsdk4c
make DESTDIR\= sitearchdir\=./.gem.20240507-31785-3ohqdr sitelibdir\=./.gem.20240507-31785-3ohqdr clean
current directory: /Users/joerafaniello/.gem/ruby/3.1.4/gems/ovirt-engine-sdk-4.6.0/ext/ovirtsdk4c
make DESTDIR\= sitearchdir\=./.gem.20240507-31785-3ohqdr sitelibdir\=./.gem.20240507-31785-3ohqdr
compiling ov_error.c
compiling ov_http_client.c
ov_http_client.c:216:29: warning: excess elements in array initializer [-Wexcess-initializers]
.reserved = { NULL, NULL }
^~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/stddef.h:89:16: note: expanded from macro 'NULL'
# define NULL ((void*)0)
^~~~~~~~~~
ov_http_client.c:272:39: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
count = INT2NUM(context_ptr->size * context_ptr->nmemb);
~~~~~~~ ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
ov_http_client.c:392:33: warning: comparison of integers of different signs: 'long' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
while (pointer - buffer < length && isspace(*pointer)) {
~~~~~~~~~~~~~~~~ ^ ~~~~~~
ov_http_client.c:501:9: error: call to undeclared function 'ruby_thread_has_gvl_p'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
if (ruby_thread_has_gvl_p()) {
^
ov_http_client.c:659:18: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
ptr->limit = connections;
~ ^~~~~~~~~~~
ov_http_client.c:853:25: warning: implicit conversion from enumeration type 'CURLMcode' to different enumeration type 'CURLcode' [-Wenum-conversion]
context_ptr->code = curl_multi_wait(context_ptr->handle, NULL, 0, timeout, NULL);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ov_http_client.c:874:25: warning: implicit conversion from enumeration type 'CURLMcode' to different enumeration type 'CURLcode' [-Wenum-conversion]
context_ptr->code = curl_multi_perform(context_ptr->handle, &pending);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ov_http_client.c:853:71: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
context_ptr->code = curl_multi_wait(context_ptr->handle, NULL, 0, timeout, NULL);
~~~~~~~~~~~~~~~ ^~~~~~~
ov_http_client.c:1009:47: error: incompatible function pointer types passing 'int (VALUE, VALUE, struct curl_slist **)' (aka 'int (unsigned long, unsigned long, struct curl_slist **)') to parameter of type 'int (*)(VALUE, VALUE, VALUE)' (aka 'int (*)(unsigned long, unsigned long, unsigned long)') [-Wincompatible-function-pointer-types]
rb_hash_foreach(request_ptr->headers, ov_http_client_add_header, (VALUE) headers);
^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/joerafaniello/.rubies/ruby-3.1.4/include/ruby-3.1.0/ruby/internal/intern/hash.h:83:40: note: passing argument to parameter 'func' here
void rb_hash_foreach(VALUE hash, int (*func)(VALUE key, VALUE val, VALUE arg), VALUE arg);
^
ov_http_client.c:1100:34: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
if (RHASH_SIZE(ptr->pending) < ptr->limit) {
~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
ov_http_client.c:1126:71: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
while (RARRAY_LEN(ptr->queue) > 0 && RHASH_SIZE(ptr->pending) < ptr->limit) {
~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
9 warnings and 2 errors generated.
make: *** [ov_http_client.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/joerafaniello/.gem/ruby/3.1.4/gems/ovirt-engine-sdk-4.6.0 for inspection.
Results logged to /Users/joerafaniello/.gem/ruby/3.1.4/extensions/arm64-darwin-23/3.1.0-static/ovirt-engine-sdk-4.6.0/gem_make.out
If I disable the error on incompatible function pointer types, I can get further:
% gem install ovirt-engine-sdk -v4.6.0 -- --with-cflags="-Wno-error=incompatible-function-pointer-types"
Building native extensions with: '--with-cflags=-Wno-error=incompatible-function-pointer-types'
This could take a while...
ERROR: Error installing ovirt-engine-sdk:
ERROR: Failed to build gem native extension.
current directory: /Users/joerafaniello/.gem/ruby/3.1.4/gems/ovirt-engine-sdk-4.6.0/ext/ovirtsdk4c
/Users/joerafaniello/.rubies/ruby-3.1.4/bin/ruby -I /Users/joerafaniello/.rubies/ruby-3.1.4/lib/ruby/3.1.0 extconf.rb --with-cflags\=-Wno-error\=incompatible-function-pointer-types
checking for xml2-config... yes
checking for curl-config... yes
creating Makefile
current directory: /Users/joerafaniello/.gem/ruby/3.1.4/gems/ovirt-engine-sdk-4.6.0/ext/ovirtsdk4c
make DESTDIR\= sitearchdir\=./.gem.20240507-32780-ykp917 sitelibdir\=./.gem.20240507-32780-ykp917 clean
current directory: /Users/joerafaniello/.gem/ruby/3.1.4/gems/ovirt-engine-sdk-4.6.0/ext/ovirtsdk4c
make DESTDIR\= sitearchdir\=./.gem.20240507-32780-ykp917 sitelibdir\=./.gem.20240507-32780-ykp917
compiling ov_error.c
compiling ov_http_client.c
ov_http_client.c:216:29: warning: excess elements in array initializer [-Wexcess-initializers]
.reserved = { NULL, NULL }
^~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/stddef.h:89:16: note: expanded from macro 'NULL'
# define NULL ((void*)0)
^~~~~~~~~~
ov_http_client.c:501:9: error: call to undeclared function 'ruby_thread_has_gvl_p'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
if (ruby_thread_has_gvl_p()) {
^
ov_http_client.c:853:25: warning: implicit conversion from enumeration type 'CURLMcode' to different enumeration type 'CURLcode' [-Wenum-conversion]
context_ptr->code = curl_multi_wait(context_ptr->handle, NULL, 0, timeout, NULL);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ov_http_client.c:874:25: warning: implicit conversion from enumeration type 'CURLMcode' to different enumeration type 'CURLcode' [-Wenum-conversion]
context_ptr->code = curl_multi_perform(context_ptr->handle, &pending);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ov_http_client.c:1009:47: warning: incompatible function pointer types passing 'int (VALUE, VALUE, struct curl_slist **)' (aka 'int (unsigned long, unsigned long, struct curl_slist **)') to parameter of type 'int (*)(VALUE, VALUE, VALUE)' (aka 'int (*)(unsigned long, unsigned long, unsigned long)') [-Wincompatible-function-pointer-types]
rb_hash_foreach(request_ptr->headers, ov_http_client_add_header, (VALUE) headers);
^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/joerafaniello/.rubies/ruby-3.1.4/include/ruby-3.1.0/ruby/internal/intern/hash.h:83:40: note: passing argument to parameter 'func' here
void rb_hash_foreach(VALUE hash, int (*func)(VALUE key, VALUE val, VALUE arg), VALUE arg);
^
4 warnings and 1 error generated.
make: *** [ov_http_client.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/joerafaniello/.gem/ruby/3.1.4/gems/ovirt-engine-sdk-4.6.0 for inspection.
Results logged to /Users/joerafaniello/.gem/ruby/3.1.4/extensions/arm64-darwin-23/3.1.0-static/ovirt-engine-sdk-4.6.0/gem_make.out
This is then gets me to issue https://github.com/oVirt/ovirt-engine-sdk-ruby/issues/11
Note, freebsd has a patch to resolve this issue against newer clang 16: https://cgit.freebsd.org/ports/commit/?id=463e93ce059522a1f1a93474bb41f90561b77d4f
See: https://github.com/oVirt/ovirt-engine-sdk-ruby/issues/11#issuecomment-2098807108
I had to use
gem install ovirt-engine-sdk -v4.6.0 -- --with-cflags="-Wno-error=incompatible-function-pointer-types -Wno-error=implicit-function-declaration"
I ran into #11 so I had to ignore both types of errors.
@mwperina Can you help out here or know who could help us?
These warnings are no longer ignorable in ruby 3.3. So I am not able to build on my dev machine (mac)
These warnings are no longer ignorable in ruby 3.3. So I am not able to build on my dev machine (mac)
This is not true. You are 99% likely running into other issue.
I can't find anything that changed in ruby 3.3 release notes that indicates this.
These warnings are no longer ignorable in ruby 3.3. So I am not able to build on my dev machine (mac)
@kbrock what clang is it attempting to build against? Some warnings can become errors in different versions.
See: https://github.com/oVirt/ovirt-engine-sdk-ruby/issues/11#issuecomment-2098801258
Check the release notes for the different branch/tag for the version you have.
@micwoj92 thank you for all your help
I run into the same issue, Ruby 2.6.6 Mac M4: Sequoia 15.1
Any idea guys?
Building native extensions with: '--with-cflags=-Wno-error=incompatible-function-pointer-types -Wno-error=implicit-function-declaration'
This could take a while...
ERROR: Error installing ovirt-engine-sdk:
ERROR: Failed to build gem native extension.
current directory: /Users/rpham/.asdf/installs/ruby/2.6.6/lib/ruby/gems/2.6.0/gems/ovirt-engine-sdk-4.6.0/ext/ovirtsdk4c
/Users/rpham/.asdf/installs/ruby/2.6.6/bin/ruby -I /Users/rpham/.asdf/installs/ruby/2.6.6/lib/ruby/2.6.0 -r ./siteconf20250214-67843-bhpluu.rb extconf.rb --with-cflags\=-Wno-error\=incompatible-function-pointer-types\ -Wno-error\=implicit-function-declaration
checking for xml2-config... yes
checking for curl-config... yes
creating Makefile
current directory: /Users/rpham/.asdf/installs/ruby/2.6.6/lib/ruby/gems/2.6.0/gems/ovirt-engine-sdk-4.6.0/ext/ovirtsdk4c
make "DESTDIR=" clean
current directory: /Users/rpham/.asdf/installs/ruby/2.6.6/lib/ruby/gems/2.6.0/gems/ovirt-engine-sdk-4.6.0/ext/ovirtsdk4c
make "DESTDIR="
compiling ov_error.c
In file included from ov_error.c:17:
In file included from /Users/rpham/.asdf/installs/ruby/2.6.6/include/ruby-2.6.0/ruby.h:33:
In file included from /Users/rpham/.asdf/installs/ruby/2.6.6/include/ruby-2.6.0/ruby/ruby.h:29:
In file included from /Users/rpham/.asdf/installs/ruby/2.6.6/include/ruby-2.6.0/ruby/defines.h:123:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:61:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:95:16: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
unsigned char *_base;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:95:16: note: insert '_Nullable' if the pointer may be null
unsigned char *_base;
^
_Nullable
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:95:16: note: insert '_Nonnull' if the pointer should never be null
unsigned char *_base;
^
_Nonnull
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable _read) (void *, char *, int);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:32: note: insert '_Nullable' if the pointer may be null
int (* _Nullable _read) (void *, char *, int);
^
_Nullable
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:32: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable _read) (void *, char *, int);
^
_Nonnull
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:40: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable _read) (void *, char *, int);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:40: note: insert '_Nullable' if the pointer may be null
int (* _Nullable _read) (void *, char *, int);
^
_Nullable
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:40: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable _read) (void *, char *, int);
^
_Nonnull
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:141:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
fpos_t (* _Nullable _seek) (void *, fpos_t, int);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:141:35: note: insert '_Nullable' if the pointer may be null
fpos_t (* _Nullable _seek) (void *, fpos_t, int);
^
_Nullable
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:141:35: note: insert '_Nonnull' if the pointer should never be null
fpos_t (* _Nullable _seek) (void *, fpos_t, int);
^
_Nonnull
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:142:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable _write)(void *, const char *, int);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:142:32: note: insert '_Nullable' if the pointer may be null
int (* _Nullable _write)(void *, const char *, int);
^
_Nullable
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:142:32: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable _write)(void *, const char *, int);
^
_Nonnull
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:142:46: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable _write)(void *, const char *, int);
@pdkproitf are those nullability warnings causing it to fail?
You can try -Wno-nullability-completeness but I think that just silences the warnings. If they're treated as errors, I guess it would still fail.
With ruby 2.6 being end of life, it's possible there's something incompatible with newer c build environments. Best of luck. I'm not sure, I only see "note" and "warning" messages don't see a fatal error.
Oh, Sorry @jrafanie Here is the error:
extern _Float16 __hypotf16(_Float16, _Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:616:27: error: _Float16 is not supported on this target
extern _Float16 __sqrtf16(_Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:616:8: error: _Float16 is not supported on this target
extern _Float16 __sqrtf16(_Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:617:27: error: _Float16 is not supported on this target
extern _Float16 __ceilf16(_Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:617:8: error: _Float16 is not supported on this target
extern _Float16 __ceilf16(_Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
Not sure what combination that causes this but it sounds like clang 16 related. Note, I have clang 16 but only use ruby 3.1 and newer. I'm on macos 15.3 with a M1 Max.
% clang --version
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin24.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I was able to uninstall and reinstall 4.6.0 on this platform against ruby 2.7.8, 3.0.6, and 3.1.6 using:
gem install ovirt-engine-sdk -v4.6.0 -- --with-cflags="-Wno-error=incompatible-function-pointer-types -Wno-error=implicit-function-declaration"
Those are the oldest ones on my system.
Can you try installing it on newer rubies to see if it's 2.6 specifically or something else?
Oh I see, Let me try upgrade the clang or ruby version to see if it works.
Thank for your suggestion @jrafanie
% clang --version
Homebrew clang version 14.0.6
Target: x86_64-apple-darwin24.1.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm@14/bin
it works @jrafanie Thank you very much for your support.
Solution, upgrade clang version Old version: 14.0.6 New version: 19
% clang --version
Homebrew clang version 19.1.7
Target: x86_64-apple-darwin24.1.0
Thread model: posix
InstalledDir: /usr/local/Cellar/llvm/19.1.7/bin
Configuration file: /usr/local/etc/clang/x86_64-apple-darwin24.cfg
Steps:
brew install llvm -v latest
export to ~/.zshrc or ~/.bashrc
Can somebody test https://github.com/oVirt/ovirt-engine-sdk-ruby/pull/25
Should be fixed in current master, please test!
@dupondje Any updates on a release with this fix? I just had to rebuild our gem set again, and ran into this, and saw it wasn't released yet.
@dupondje Any updates on a release with this fix? I just had to rebuild our gem set again, and ran into this, and saw it wasn't released yet.
Can you confirm current master works fine?
I ran a regression test with master of this gem and our code base and everything passed, and I didn't need any special steps for installing the gem as far as I could tell. (It's more complicated to build this gem that other gems due to the Java layering, but I think I proved it all working)
FWIW I am on the same project as @jrafanie @kbrock from this thread.