Issue #17777 has been updated by austin (Austin Ziegler).


Copying the `include/ruby/thread_native.h` from `master`  appears to work to a point. This is what I found: `git show 5e3259ea749 -- include/ruby/thread_native.h`.

```
5e3259ea74 2020-11-17 | fix public interface [Koichi Sasada]

diff --git a/include/ruby/thread_native.h b/include/ruby/thread_native.h
index 0285c8ff40..7e08c2e97f 100644
--- a/include/ruby/thread_native.h
+++ b/include/ruby/thread_native.h
@@ -31,10 +31,14 @@ typedef union rb_thread_lock_union {
     CRITICAL_SECTION crit;
 } rb_nativethread_lock_t;
 
+typedef struct rb_thread_cond_struct rb_nativethread_cond_t;
+
 #elif defined(HAVE_PTHREAD_H)
+
 #include <pthread.h>
 typedef pthread_t rb_nativethread_id_t;
 typedef pthread_mutex_t rb_nativethread_lock_t;
+typedef pthread_cond_t rb_nativethread_cond_t;
 
 #else
 #error "unsupported thread type"
@@ -50,6 +54,19 @@ void rb_nativethread_lock_destroy(rb_nativethread_lock_t *lock);
 void rb_nativethread_lock_lock(rb_nativethread_lock_t *lock);
 void rb_nativethread_lock_unlock(rb_nativethread_lock_t *lock);
 
+void rb_native_mutex_lock(rb_nativethread_lock_t *lock);
+int  rb_native_mutex_trylock(rb_nativethread_lock_t *lock);
+void rb_native_mutex_unlock(rb_nativethread_lock_t *lock);
+void rb_native_mutex_initialize(rb_nativethread_lock_t *lock);
+void rb_native_mutex_destroy(rb_nativethread_lock_t *lock);
+
+void rb_native_cond_signal(rb_nativethread_cond_t *cond);
+void rb_native_cond_broadcast(rb_nativethread_cond_t *cond);
+void rb_native_cond_wait(rb_nativethread_cond_t *cond, rb_nativethread_lock_t *mutex);
+void rb_native_cond_timedwait(rb_nativethread_cond_t *cond, rb_nativethread_lock_t *mutex, unsigned long msec);
+void rb_native_cond_initialize(rb_nativethread_cond_t *cond);
+void rb_native_cond_destroy(rb_nativethread_cond_t *cond);
+
 RUBY_SYMBOL_EXPORT_END
 
 #endif
```

However, when building `ext/fiddle`, I get the following error:

```
closure.c:264:14: error: implicit declaration of function 'ffi_prep_closure' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
    result = ffi_prep_closure(pcl, cif, callback, (void *)self);
```

Im not sure _why_ this is failing here, because it doesnt look like its implicit (the function `ffi_prep_closure` is in `ffi.h` which is included from `fiddle.h`, which is included in `closure.c`.

----------------------------------------
Bug #17777: 2.6.7 fails to build on macOS: implicit declaration of function 'rb_native_mutex_destroy' is invalid in C99
https://bugs.ruby-lang.org/issues/17777#change-91342

* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* ruby -v: 2.6.7
* Backport: 2.6: REQUIRED, 2.7: DONTNEED, 3.0: DONTNEED
----------------------------------------
https://github.com/ruby/ruby-builder/runs/2271346109?check_suite_focus=true#step:14:11253
```
vm.c:2295:9: error: implicit declaration of function 'rb_native_mutex_destroy' is invalid in C99 
```

There is also a warning below that might be worth solving:
```
vm.c:2489:34: warning: expression does not compute the number of elements in this array; element type is 'const int', not 'VALUE' (aka 'unsigned long') [-Wsizeof-array-div]
                             sizeof(ec->machine.regs) / sizeof(VALUE));
                                    ~~~~~~~~~~~~~~~~  ^
vm.c:2489:34: note: place parentheses around the 'sizeof(VALUE)' expression to silence this warning
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>