Fatal error: crt/host_defines.h: No such file or directory

Greetings, I am having trouble with this error when I compile “make all” inside CAFFE<caffe.
PLEASE direction I should take. I am installing Caffe on the Jetson Tx1 with CUDA 9.0.

At Caffe/caffe
run: make all output this:
CXX src/caffe/layer_factory.cpp
In file included from /usr/local/cuda-9.0/include/driver_types.h:53:0,
from /usr/local/cuda-9.0/include/cublas_api.h:72,
from /usr/local/cuda-9.0/include/cublas_v2.h:65,
from ./include/caffe/util/device_alternate.hpp:34,
from ./include/caffe/common.hpp:19,
from ./include/caffe/blob.hpp:8,
from ./include/caffe/layer.hpp:8,
from src/caffe/layer_factory.cpp:8:
/usr/local/cuda-9.0/include/host_defines.h:50:30: fatal error: crt/host_defines.h: No such file or directory
compilation terminated.
Makefile:581: recipe for target ‘.build_release/src/caffe/layer_factory.o’ failed
make: *** [.build_release/src/caffe/layer_factory.o] Error 1

I see:


So this is an architecture-dependent location. On a TX1 or TX2 with CUDA 9.0:


Thanks for your response,

I don’t get what should I do. I understand that you say is a architecture-dependent location,
I should run in a terminal


Or add it where?

There are multiple ways someone might configure any given C/C++ project, but in the end there is a compile command (either gcc or nvcc). When the compile command has the correct “-I/some/where” in the command, then that location will be searched by default whenever a “#include <something.h>” occurs…the “<something.h>” syntax says to look in the default search path, and the “-I” option adds a path to the default search path.

It appears you are using C++, so perhaps if your original command is “make” something like this would do it without editing a config file:

CPLUS_INCLUDE_PATH=/usr/local/cuda-9.0/targets/aarch64-linux/include make

If you see a Makefile with an “include” variable, then appending the “-I” of above would do the trick.

If there was a “./configure” step, then usually “./configure --help” will give you an option to name a search path for specific components (the result would be that the “-I” will be generated for you).

Thanks linuxdev,

We have a makefile and the very beginning looks like this

PROJECT := caffe

CONFIG_FILE := Makefile.config
# Explicitly check for the config file, otherwise make -k will proceed anyway.
ifeq ($(wildcard $(CONFIG_FILE)),)
$(error $(CONFIG_FILE) not found. See $(CONFIG_FILE).example.)
include $(CONFIG_FILE)

We also have a makefile.config file which looks like this at the beginning:

## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!

# cuDNN acceleration switch (uncomment to build with cuDNN).

# CPU-only switch (uncomment to build without GPU support).
#CPU_ONLY := 1

Both are quite long. In the make.config file we have a section which looks like this:

# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/aarch64-linux-gnu/hdf5/serial /usr/lib/aarch64-linux-gnu/

Should we add the following into the makefile.config file? :


I suppose we’re a bit unclear on what to do here, so any help is definitely appreciated. Thanks again.

The “CPLUS_INCLUDE_PATH” is an environment variable method of doing this. In your case you have a specific mechanism in your Makefile:

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial

I would try to edit this to be:

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial <b>/usr/local/cuda-9.0/targets/aarch64-linux/include</b>

This might work.

No it did not work
Also I have this libraries set up for the installation in the Make.config
May this can be a issue ?

# Uncomment to use Python 3 (default is Python 2)
PYTHON_LIBRARIES := boost_python35 python3.5m
PYTHON_INCLUDE := /usr/include/python3.5m /usr/lib/python3.5/dist-packages/numpy/core/include /home/nvidia/.local/lib/python3.5/site-packages/numpy/core/include

# We need to be able to find libpythonX.X.so or .dylib.
PYTHON_LIB := /usr/lib /usr/lib/aarch64-linux-gnu/

I don’t know enough about the project to say. Quite often there is a separate include path config for C++ versus other languages. I don’t know if maybe the PYTHON_INCLUDE is completely ignored during the C++ steps.

The forum allows attaching files to an existing post, but not to a new post (you have to attach after posting instead of during posting). If you hover the mouse over the quote mark icon in the upper right of an existing post, then a paper clip icon will show up to allow attaching. In some cases you might need to rename a file suffix, e.g., if something like “Make.config” is rejected, then you could rename it to “Make.config.txt” and the forum would allow this. If possible, please attach both the Make.config and the Makefile. Maybe having the complete picture would help.