Issue #17777 has been updated by xtkoba (Tee KOBAYASHI).


I believe this issue was introduced by #15852#note-9 (backport of commit:2a83650b0fd25719fb6c03bfec7bd895734d3ceb into ruby_2_6).

A workaround is to define a prototype of the function `rb_native_mutex_destroy` before it is called, as in the following patch:
```patch
--- ruby-2.6.7/vm.c.orig
+++ ruby-2.6.7/vm.c
@@ -2292,6 +2292,7 @@ ruby_vm_destruct(rb_vm_t *vm)
 	if (objspace) {
 	    rb_objspace_free(objspace);
 	}
+        void rb_native_mutex_destroy(rb_nativethread_lock_t *);
         rb_native_mutex_destroy(&vm->waitpid_lock);
         rb_native_mutex_destroy(&vm->workqueue_lock);
 	/* after freeing objspace, you *can't* use ruby_xfree() */
```


----------------------------------------
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-91334

* 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>