mahmood
mahmood

Reputation: 24715

Header file not found while path is included in configure command

Trying to build FFMPeG from source with this configure command

./configure --x86asmexe=/home/mahmood/yasm-1.3.0/bin/yasm --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp \
--extra-cflags=-I"~/cuda-10.1.168/include,~/nv_codec_headers/include/ffnvcodec/" \
--extra-ldflags=-L"~/cuda-10.1.168/lib64/,~/nv_codec_headers/lib/pkgconfig/"

I get this error in config.log which it can not find npp.h. Please note that additional include folders are given to the gcc command and npp.h actually exists in the path I gave.

gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
-D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -I~/cuda-10.1.168/include,~/nv_codec_headers/include/ffnvcodec/ \
-std=c11 -fomit-frame-pointer -fPIC -pthread -c \
-o /tmp/ffconf.dk4hdPMF/test.o /tmp/ffconf.dk4hdPMF/test.c
/tmp/ffconf.dk4hdPMF/test.c:1:10: fatal error: npp.h: No such file or directory
 #include <npp.h>
          ^~~~~~~

And npp.h is here

$ ls -l ~/cuda-10.1.168/include/npp.h
-rw-r--r-- 1 mahmood mahmood 2864 Dec 16 18:24 /home/mahmood/cuda-10.1.168/include/npp.h

How can I fix that?

Upvotes: 0

Views: 497

Answers (1)

MadScientist
MadScientist

Reputation: 100856

This is not really a makefile question.

You have two problems. First, you cannot pass multiple paths to the -I option by separating them with commas, like -I<dir1>,<dir2>. You have to use multiple -I options, like -I<dir1> -I<dir2>.

Second, the ~ is a special character expanded by the shell before it invokes the compiler, and the shell will not expand the ~ everywhere in the command line. For example if you run echo foo~bar or even echo foo~/bar the shell will not treat ~ as a reference to your home directory and will not expand it. It's only treated specially if it's the first character in a word. You need to either use the $HOME environment variable or else you need to add a space between the -I and the directory so that the ~ is the first character in the word: -I$HOME/<dir1> -I$HOME/<dir2> or -I ~/<dir1> -I ~/<dir2>.

If you use $HOME remember you need to escape the $ in your make recipe.

Upvotes: 1

Related Questions