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

stdio.h file not found error on macOS Sierra #338

Closed
JohnCoates opened this Issue Sep 11, 2017 · 11 comments

Comments

Projects
None yet
10 participants
@JohnCoates

JohnCoates commented Sep 11, 2017

macOS Sierra 10.12.6 with Xcode 8.3.3
Followed building instructions, I get gum/meson-private/sanitycheckobjc.m:1:8: fatal error: 'stdio.h' file not found

Checking the isysroot path, stdio.h is present in /usr/include/.

Macbook:frida macbook$ make core-macos
FRIDA_HOST=macos-x86_64 \
		FRIDA_OPTIMIZATION_FLAGS="-Os" \
		FRIDA_DEBUG_FLAGS="-g3" \
		FRIDA_ASAN=no \
		./releng/setup-env.sh
Environment created. To enter:
# source /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-env-macos-x86_64.rc
. build/frida-env-macos-x86_64.rc && cd frida-gum/bindings/gumjs && npm install

> fsevents@1.1.2 install /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/frida-gum/bindings/gumjs/node_modules/fsevents
> node install

[fsevents] Success: "/Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/frida-gum/bindings/gumjs/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
npm notice created a lockfile as package-lock.json. You should commit this file.
added 450 packages in 10.03s
FRIDA_HOST=macos-x86 \
		FRIDA_OPTIMIZATION_FLAGS="-Os" \
		FRIDA_DEBUG_FLAGS="-g3" \
		FRIDA_ASAN=no \
		./releng/setup-env.sh
Environment created. To enter:
# source /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-env-macos-x86.rc
. build/frida-env-macos-x86.rc \
		&& export PACKAGE_TARNAME=capstone \
		&& . $CONFIG_SITE \
		&& case macos-x86 in \
			*-x86)    capstone_archs="x86"         ;; \
			*-x86_64) capstone_archs="x86"         ;; \
			*-arm)    capstone_archs="arm"         ;; \
			*-arm64)  capstone_archs="aarch64 arm" ;; \
		esac \
		&& make -C capstone \
			PREFIX=$frida_prefix \
			BUILDDIR=../build/tmp-macos-x86/capstone \
			CAPSTONE_BUILD_CORE_ONLY=yes \
			CAPSTONE_ARCHS="$capstone_archs" \
			CAPSTONE_SHARED=$enable_shared \
			CAPSTONE_STATIC=$enable_static \
			install
  GEN     capstone.pc
  CC      cs.o
  CC      utils.o
  CC      SStream.o
  CC      MCInstrDesc.o
  CC      MCRegisterInfo.o
  CC      arch/X86/X86DisassemblerDecoder.o
  CC      arch/X86/X86Disassembler.o
  CC      arch/X86/X86IntelInstPrinter.o
  CC      arch/X86/X86ATTInstPrinter.o
  CC      arch/X86/X86Mapping.o
  CC      arch/X86/X86Module.o
  CC      MCInst.o
  AR      libcapstone.a
ar: creating archive /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/tmp-macos-x86/capstone/libcapstone.a
mkdir -p /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-macos-x86/lib
install -m0644 /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/tmp-macos-x86/capstone/libcapstone.a /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-macos-x86/lib
mkdir -p /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-macos-x86/include/capstone
install -m0644 include/*.h /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-macos-x86/include/capstone
mkdir -p /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-macos-x86/lib/pkgconfig
install -m0644 /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/tmp-macos-x86/capstone/capstone.pc /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-macos-x86/lib/pkgconfig/
. build/frida-meson-env-macos-x86_64.rc; \
	builddir=build/tmp-macos-x86/frida-gum; \
	if [ ! -f $builddir/build.ninja ]; then \
		mkdir -p $builddir; \
		python3 /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/releng/meson/meson.py \
			--prefix /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-macos-x86 \
			--cross-file build/frida-macos-x86.txt \
			--default-library static --buildtype minsize --strip -Denable_diet=auto \
			frida-gum $builddir || exit 1; \
	fi; \
	/Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/releng/ninja-macos-x86_64 -C $builddir install || exit 1
The Meson build system
Version: 0.41.0.dev1
Source dir: /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/frida-gum
Build dir: /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/tmp-macos-x86/frida-gum
Build type: cross build
Project name: frida-gum
Native c compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang (clang 8.1.0)
Appending CFLAGS from environment: '-include /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-version.h -fPIC -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.9 -arch x86_64 -I/Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-macos-x86_64/include -I/Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/sdk-macos-x86_64/include'
Appending LDFLAGS from environment: '-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -Wl,-macosx_version_min,10.9 -arch x86_64 -Wl,-dead_strip -Wl,-no_compact_unwind -L/Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-macos-x86_64/lib -L/Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/sdk-macos-x86_64/lib'
Appending CPPFLAGS from environment: '-include /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-version.h -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.9 -arch x86_64 -I/Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-macos-x86_64/include -I/Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/sdk-macos-x86_64/include'
Cross c compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang (clang 8.1.0)
Native cpp compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ (clang 8.1.0)
Appending CXXFLAGS from environment: '-fPIC -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.9 -arch x86_64 -I/Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-macos-x86_64/include -I/Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/sdk-macos-x86_64/include -stdlib=libc++ -fno-rtti'
Appending LDFLAGS from environment: '-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -Wl,-macosx_version_min,10.9 -arch x86_64 -Wl,-dead_strip -Wl,-no_compact_unwind -L/Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-macos-x86_64/lib -L/Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/sdk-macos-x86_64/lib'
Appending CPPFLAGS from environment: '-include /Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-version.h -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.9 -arch x86_64 -I/Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/frida-macos-x86_64/include -I/Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/sdk-macos-x86_64/include'
Cross cpp compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ (clang 8.1.0)
Host machine cpu family: x86
Host machine cpu: x86
Target machine cpu family: x86
Target machine cpu: x86
Build machine cpu family: x86_64
Build machine cpu: x86_64
/Users/macbook/Dev/Clones/ReversingTools/frida/source/frida/build/tmp-macos-x86/frida-gum/meson-private/sanitycheckobjc.m:1:8: fatal error: 'stdio.h' file not found
#import<stdio.h>
       ^
1 error generated.

Meson encountered an error in file meson.build, line 15, column 2:
ObjC compiler /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang can not compile programs.
make[1]: *** [build/frida-macos-x86/lib/pkgconfig/frida-gum-1.0.pc] Error 1
make: *** [core-macos] Error 2
@oleavr

This comment has been minimized.

Show comment
Hide comment
@oleavr

oleavr Sep 11, 2017

Contributor

I’ve encountered this as well, and resolved it by making sure Xcode’s command-line tools were properly installed. Could you check if that also resolves it for you?

Contributor

oleavr commented Sep 11, 2017

I’ve encountered this as well, and resolved it by making sure Xcode’s command-line tools were properly installed. Could you check if that also resolves it for you?

@JohnCoates

This comment has been minimized.

Show comment
Hide comment
@JohnCoates

JohnCoates Sep 11, 2017

Thanks @oleavr, running xcode-select --install worked! The command-line tools were working for other things, xcode-select showed the correct path as well , but for some reason that command was required.

JohnCoates commented Sep 11, 2017

Thanks @oleavr, running xcode-select --install worked! The command-line tools were working for other things, xcode-select showed the correct path as well , but for some reason that command was required.

@JohnCoates JohnCoates closed this Sep 11, 2017

@oleavr

This comment has been minimized.

Show comment
Hide comment
@oleavr

oleavr Sep 11, 2017

Contributor

Glad to hear! I suspect this happens after an Xcode upgrade, where somehow things go slightly out of sync.

Contributor

oleavr commented Sep 11, 2017

Glad to hear! I suspect this happens after an Xcode upgrade, where somehow things go slightly out of sync.

@Artem85

This comment has been minimized.

Show comment
Hide comment
@Artem85

Artem85 Jul 16, 2018

In my case IOS simulator wasn't installed.

Go to Xcode -> Preferences -> Components
Download the latest IOS Simulator.

Artem85 commented Jul 16, 2018

In my case IOS simulator wasn't installed.

Go to Xcode -> Preferences -> Components
Download the latest IOS Simulator.

@yicongli

This comment has been minimized.

Show comment
Hide comment
@yicongli

yicongli Sep 26, 2018

The root reason is missing the /usr/include folder, install command-line tools sometimes will not automatically add it. The Link shows the correct way:
Install the package at
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14. pkg

yicongli commented Sep 26, 2018

The root reason is missing the /usr/include folder, install command-line tools sometimes will not automatically add it. The Link shows the correct way:
Install the package at
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14. pkg

@WWQ1993

This comment has been minimized.

Show comment
Hide comment
@WWQ1993

WWQ1993 Sep 26, 2018

The root reason is missing the /usr/include folder, install command-line tools sometimes will not automatically add it. The Link shows the correct way:
Install the package at
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14. pkg

well done. thanks

WWQ1993 commented Sep 26, 2018

The root reason is missing the /usr/include folder, install command-line tools sometimes will not automatically add it. The Link shows the correct way:
Install the package at
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14. pkg

well done. thanks

@olivierlacan

This comment has been minimized.

Show comment
Hide comment
@olivierlacan

olivierlacan Oct 3, 2018

For anyone discovering this later on who may not be familiar with the command line, here's how to install the macOS_SDK_headers_for_macOS_10.14.pkg package as explained in @yicongli's response above:

In Terminal.app or any shell app like iTerm:

cd /Library/Developer/CommandLineTools/Packages/
open macOS_SDK_headers_for_macOS_10.14.pkg

This should open the following prompt:
image

Make sure you go through the whole thing and try to install the gem that failed to install again or run bundle install again if this was something you encountered while trying to install from a Gemfile.

olivierlacan commented Oct 3, 2018

For anyone discovering this later on who may not be familiar with the command line, here's how to install the macOS_SDK_headers_for_macOS_10.14.pkg package as explained in @yicongli's response above:

In Terminal.app or any shell app like iTerm:

cd /Library/Developer/CommandLineTools/Packages/
open macOS_SDK_headers_for_macOS_10.14.pkg

This should open the following prompt:
image

Make sure you go through the whole thing and try to install the gem that failed to install again or run bundle install again if this was something you encountered while trying to install from a Gemfile.

@dksam

This comment has been minimized.

Show comment
Hide comment
@dksam

dksam Oct 5, 2018

Olivierlacan your solution worked fine, thanks

dksam commented Oct 5, 2018

Olivierlacan your solution worked fine, thanks

@bladexxv

This comment has been minimized.

Show comment
Hide comment
@bladexxv

bladexxv Oct 6, 2018

@olivierlacan brilliant answer -it solved my problem.

bladexxv commented Oct 6, 2018

@olivierlacan brilliant answer -it solved my problem.

@tgn3000

This comment has been minimized.

Show comment
Hide comment
@tgn3000

tgn3000 commented Oct 6, 2018

@olivierlacan thanks, man

@roland-hochmuth

This comment has been minimized.

Show comment
Hide comment
@roland-hochmuth

roland-hochmuth commented Oct 12, 2018

u da man @olivierlacan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment