Build-wrapper failing on macOS with libinterceptor.dylib: stat() failed with errno=1

I have the same issue.

  • build-wrapper-macosx-x86 - is the latest version (12.02.2021)
  • macOS 11.2.2 (20D80)
  • sonarqube v8.7.0.41497

14:49:56 [14:49:56]: ▸ [35mdyld: warning: could not load inserted library ‘/opt/build-wrapper-macosx-x86/libinterceptor.dylib’ into hardened process because no suitable image found. Did find:[0m
14:49:56 [14:49:56]: ▸ [35m /opt/build-wrapper-macosx-x86/libinterceptor.dylib: code signature in (/opt/build-wrapper-macosx-x86/libinterceptor.dylib) not valid for use in process using Library Validation: mapping process is a platform binary, but mapped file is not[0m
14:49:56 [14:49:56]: ▸ [35m /opt/build-wrapper-macosx-x86/libinterceptor.dylib: stat() failed with errno=1[0m

@mpaladin do you have any updates?

Hi @Dmitry ,

what problem are you facing? What build system and compiler are you using?

Updates about what?

@mpaladin Thank you for such a quick response.

I use already compiled the latest version of build-wrapper-macosx-x86 and faced with the issue with using dynamic library by build-wrapper-macosx-x86 on macOS Big Sur (v11.2.2 (20D80)).

Instead of disable macOS SIP (according to the workaround) It would be perfect to have opportunity to compile wrapper on my own. Could you please provide link to the source of build-wrapper-macosx-x86 if it publicly available?

Hi @Dmitry ,

This is not possible unfortunately.

Could you post the entire build log and the build-wrapper output folder? It would also be helpful to know which build system and compiler you are using.

Hello @mpaladin,
For simplifying investigation, I used build-wrapper-macosx-x86 with “Hello World” example on the same build machine (macOS 11.2.2 (20D80)).
Here is my results:

jenkins@jenkins-mac-slave ~ % cd /opt/build-wrapper-macosx-x86 
jenkins@jenkins-mac-slave build-wrapper-macosx-x86 % cat hello.c                                               
#include <stdio.h>
int main(int argc, char **argv) { printf("hello world\n"); }

jenkins@jenkins-mac-slave build-wrapper-macosx-x86 % pwd                                                       
/opt/build-wrapper-macosx-x86

jenkins@jenkins-mac-slave build-wrapper-macosx-x86 % ls -al
total 728
drwxr-xr-x@ 6 jenkins  wheel     192 Mar 11 21:56 .
drwxr-xr-x  6 root     wheel     192 Mar 11 21:43 ..
-rw-r--r--@ 1 jenkins  wheel    6148 Mar 11 21:56 .DS_Store
-rwxr-xr-x@ 1 jenkins  wheel  289748 Feb 12 14:34 build-wrapper-macosx-x86
-rw-r--r--  1 jenkins  wheel      80 Mar 11 21:41 hello.c
-rwxr-xr-x@ 1 jenkins  wheel   66280 Feb 12 14:34 libinterceptor.dylib

jenkins@jenkins-mac-slave build-wrapper-macosx-x86 % ./build-wrapper-macosx-x86 --out-dir test clang -c hello.c
dyld: warning: could not load inserted library '/opt/build-wrapper-macosx-x86/libinterceptor.dylib' into hardened process because no suitable image found.  Did find:
	/opt/build-wrapper-macosx-x86/libinterceptor.dylib: code signature in (/opt/build-wrapper-macosx-x86/libinterceptor.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
dyld: warning: could not load inserted library '/opt/build-wrapper-macosx-x86/libinterceptor.dylib' into hardened process because no suitable image found.  Did find:
	/opt/build-wrapper-macosx-x86/libinterceptor.dylib: code signature in (/opt/build-wrapper-macosx-x86/libinterceptor.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.

jenkins@jenkins-mac-slave build-wrapper-macosx-x86 % ls -al                                                    
total 736
drwxr-xr-x@ 8 jenkins  wheel     256 Mar 11 21:59 .
drwxr-xr-x  6 root     wheel     192 Mar 11 21:43 ..
-rw-r--r--@ 1 jenkins  wheel    6148 Mar 11 21:56 .DS_Store
-rwxr-xr-x@ 1 jenkins  wheel  289748 Feb 12 14:34 build-wrapper-macosx-x86
-rw-r--r--  1 jenkins  wheel      80 Mar 11 21:41 hello.c
-rw-r--r--  1 jenkins  wheel     776 Mar 11 21:59 hello.o
-rwxr-xr-x@ 1 jenkins  wheel   66280 Feb 12 14:34 libinterceptor.dylib
drwxr-xr-x  4 jenkins  wheel     128 Mar 11 21:58 test

jenkins@jenkins-mac-slave build-wrapper-macosx-x86 % cd test 
jenkins@jenkins-mac-slave test % ls -al
total 176
drwxr-xr-x  4 jenkins  wheel    128 Mar 11 21:58 .
drwxr-xr-x@ 8 jenkins  wheel    256 Mar 11 21:59 ..
-rw-r--r--  1 jenkins  wheel  39135 Mar 11 21:59 build-wrapper-dump.json
-rw-r--r--  1 jenkins  wheel  48676 Mar 11 21:59 build-wrapper.log

I have attached:
build-wrapper-dump.json (38.2 KB) build-wrapper.log (47.5 KB)

Hi @Dmitry ,

these are not causing any trouble, the build-wrapper-dump.json and build-wrapper.log have good and expected content and exit code 0.