Skip to content
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

fatal error: 'string' file not found #805

Closed
abdulgalimov opened this issue Mar 12, 2018 · 15 comments
Closed

fatal error: 'string' file not found #805

abdulgalimov opened this issue Mar 12, 2018 · 15 comments

Comments

@abdulgalimov
Copy link

$ make

.....
Scanning dependencies of target libwabt
[  1%] Building CXX object CMakeFiles/libwabt.dir/src/token.cc.o
In file included from /Users/sam/wasm/wabt/src/token.cc:17:
/Users/sam/itt/wasm/wabt/src/token.h:20:10: fatal error: 'string' file not found
#include <string>
         ^~~~~~~~
1 error generated.
make[3]: *** [CMakeFiles/libwabt.dir/src/token.cc.o] Error 1
make[2]: *** [CMakeFiles/libwabt.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [clang-debug] Error 2

How to fix it?

cmake version: 3.8.0
mac version: 10.13.3 High Sierra

@binji
Copy link
Member

binji commented Mar 12, 2018

This seems to be a common issue, see #716 (comment). Some were able to solve with xcode-select --install, try that.

@abdulgalimov
Copy link
Author

It did not fix:

$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

@pepyakin
Copy link

So I believe you need to go to the AppStore and update Xcode tools and in particular "Command Line Tools ".

@artdias90
Copy link

artdias90 commented May 24, 2018

I'm having the same problem.
$ xcode-select --version
xcode-select version 2349.

$ make
token.h:20:10: fatal error: 'string' file not found

UPDATE After removing out folder and make it works.

@shlomi-schwartz
Copy link

I'm having the same issue, @artdias90 I tried removing the out folder than make, and still having same issue. Am I missing something?

@owenthereal
Copy link

Any updates on this? Had the same issue on OSX:

$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make --no-print-directory -C out/clang/Debug/ all
-- Using prebuilt re2c lexer
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jou/gocode/src/github.com/jingweno/wabt/out/clang/Debug
Scanning dependencies of target libwabt
[  1%] Building CXX object CMakeFiles/libwabt.dir/src/token.cc.o
In file included from /Users/jou/gocode/src/github.com/jingweno/wabt/src/token.cc:17:
/Users/jou/gocode/src/github.com/jingweno/wabt/src/token.h:20:10: fatal error: 'string' file not found
#include <string>
         ^~~~~~~~
1 error generated.
make[3]: *** [CMakeFiles/libwabt.dir/src/token.cc.o] Error 1
make[2]: *** [CMakeFiles/libwabt.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [clang-debug] Error 2

$ xcode-select --version
xcode-select version 2349.

$ cmake --version
cmake version 3.12.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

@binji
Copy link
Member

binji commented Sep 11, 2018

@jingweno Have you installed the XCode "Command Line Tools" as described above? If so, did you remove the out directory before compiling again?

If your command line tools are installed correctly, you should be able to run the following command without error:

echo "#include <string>" | clang++ -E -x c++ - | grep "/string" | head -n 1

On my Mac this produces:

# 1 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string" 1 3

On my Linux laptop it produces:

# 1 "/usr/lib64/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../include/c++/8.2.0/string" 1 3

@clayheaton
Copy link

FWIW, on a new Mac, you need to actually launch Xcode before trying to install something that depends on the command line tools. Otherwise, all of the various components are not yet installed. I ran into this issue on a new headless Mac Mini.

@sarkispeha
Copy link

What is this 'out' directory that everyone has referenced? Where can I find it?

I get the same output as binji

@gdorion
Copy link

gdorion commented Nov 13, 2019

It's the build folder containing your built files.

@sbc100
Copy link
Member

sbc100 commented Nov 15, 2019

Its kind of annoying how the default cmake configuration doesn't print the command line that failed, only its output.

I think this is another good reason to switch to the ninja cmake generator by default (in the top level Makefile). It will make these kind of but reports a lot more useful.

@penzn
Copy link
Contributor

penzn commented Nov 15, 2019

try make VERBOSE=1

@sbc100
Copy link
Member

sbc100 commented Nov 16, 2019

Right.. I'm just not sure the top level make passes that argument on generated makefile (does it?). And its kind of annoying to say "thanks for the bug report, please go back and run you failing build again with this other argument", when using ninja just makes it work.

@sbc100
Copy link
Member

sbc100 commented Nov 16, 2019

Ah yes that does work.. thanks +$(MAKE)

@penzn
Copy link
Contributor

penzn commented Nov 19, 2019

Sorry, I lost the conversation in my inbox. Yes, that is relatively annoying for the reporter. I tend to use make if I need to debug the build, specifically because of the verbosity setting, but that might not be the best default.

@keithw keithw closed this as completed May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests