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?
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.
Related
This question already has answers here:
Reading quoted/escaped arguments correctly from a string
(4 answers)
Closed 3 years ago.
For building applications I use CMake.
I parse my CMake command in a script with several variables:
CMAKE_COMMAND=" \
$CMAKE \
-G "$Build_TOOL_CMAKE" \
[...]"
After parsing that command I print it with printf for control:
printf "\n${CMAKE_COMMAND}\n"
And then I eventually execute the command with:
$CMAKE_COMMAND
This script worked as long as I had "Ninja" as Generator (the -G option --> BUILD_TOOL_CMAKE="Ninja") as it does have no space characters in it.
Now I want to use "Eclipse CDT4 - Unix Makefiles" as Generator. I tried several ways of escaping the space characters, e.g.:
CMAKE_COMMAND=" \
$CMAKE \
-G \"$Build_TOOL_CMAKE\" \
[...]"
or
CMAKE_COMMAND=" \
$CMAKE \
-G '$Build_TOOL_CMAKE' \
[...]"
The printed command became correct in some cases, but the execution of it resulted in errors like:
CMake Error: Could not create named generator Eclipse
or
CMake Error: Could not create named generator "Eclipse
This leads to the assumption that something is wrong with escaping the spaces, but the printf works:
cmake.exe -G"Eclipse CDT4 - Unix Makefiles" -S sourcefolder -B buildfolder # printf $CMAKE_COMMAND
Did I miss something? Maybe the executing merely by the variable ($CMAKE_COMMAND) is also the wrong approach.
You can use the CMake's configure_file command: documentation
Place all the variables in command.in and write it to command.
configure_file(command.in, command)
The file command.in can looks like this:
${CMAKE_COMMAND} -G ${Build_TOOL_CMAKE}
I am trying to statically link two COBOL files together using GnuCobol (Windows 10) following the example listed here: https://open-cobol.sourceforge.io/historical/open-cobol/Static-Linking.html but cannot seem to get it to work.
I am running the following:
cobc -free -c InterpFunc.cob
cobc -free -c -fmain Integrator.cob
cobc -x -o .\\dist\\integrator Integrator.o InterpFunc.o
The '.o' files compile correctly, but the binary never builds with the following errors:
H:\Programs\COBAL\cobc\bin\cobc.exe: unrecognized option '-fmain'
h:/programs/cobal/cobc/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain#16'
collect2.exe: error: ld returned 1 exit status
The terminal process terminated with exit code: 1
I have tried a few different things such as leaving out the '-fmain' or leaving out the '-x', but all seem to produce different errors.
Is this perhaps an issue with my compiler/system setup or am I misunderstanding how to statically link files?
I'm quite sure you do not use a compiler matching that old documentation (having "historical" in its URL). I'm quite sure it'll work the way the current manual says:
The easiest way of combining multiple files is to compile them into a single executable.
One way is to compile all the files in one command:
$ cobc -x -o prog main.cob subr1.cob subr2.cob
Another way is to compile each file with the option -c, and link them at the end. > The top-level program must be compiled with the option -x.
$ cobc -c subr1.cob
$ cobc -c subr2.cob
$ cobc -c -x main.cob
$ cobc -x -o prog main.o subr1.o subr2.o
So I have a file example.cpp which I have to compile with g++.
$ g++ nginx.cpp libuaparser_cpp.a -I ~/Desktop/boost_1_68_0/ -I /usr/local/mysql-connector-c++-8.0.12/include/jdbc/ -L /usr/local/mysql-connector-c++-8.0.12/lib64/ -L ~/Desktop/boost_1_68_0/stage/lib -L /usr/local/lib/ -L /Users/Shray/Desktop/boost_1_68_0/stage/lib/ ~/Desktop/boost_1_68_0/stage/lib/libboost_regex.a -lyaml-cpp -lboost_regex -std=c++11 -lmysqlcppconn
So instead of writing so much, I put the rest of the parameters in a variable in my terminal.
$ myvar="libuaparser_cpp.a -I ~/Desktop/boost_1_68_0/ -I /usr/local/mysql-connector-c++-8.0.12/include/jdbc/ -L /usr/local/mysql-connector-c++-8.0.12/lib64/ -L ~/Desktop/boost_1_68_0/stage/lib -L /usr/local/lib/ -L /Users/Shray/Desktop/boost_1_68_0/stage/lib/ ~/Desktop/boost_1_68_0/stage/lib/libboost_regex.a -lyaml-cpp -lboost_regex -std=c++11 -lmysqlcppconn"
$ g++ nginx.cpp $myvar
But this gives me an error.
clang: error: no such file or directory: '~/Desktop/boost_1_68_0/stage/lib/libboost_regex.a'
Why is this error coming? Since I am just adding the variables value. Any help would be much appreciated.
Don't use variables to store a content that is a list, use arrays! Also ~ doesn't expand under quotes (single or double)
myVarArgs=()
myVarArgs=( libuaparser_cpp.a
-I ~/Desktop/boost_1_68_0/
-I /usr/local/mysql-connector-c++-8.0.12/include/jdbc/
-L /usr/local/mysql-connector-c++-8.0.12/lib64/
-L ~/Desktop/boost_1_68_0/stage/lib
-L /usr/local/lib/
-L /Users/Shray/Desktop/boost_1_68_0/stage/lib/
~/Desktop/boost_1_68_0/stage/lib/libboost_regex.a
-lyaml-cpp
-lboost_regex
-std=c++11
-lmysqlcppconn
)
and run a full-quoted expansion to preserve the args from breaking up on presence of special characters.
g++ nginx.cpp "${myVarArgs[#]}"
Tilde expansion happens before variable expansion, so ~ in a variable isn't expanded to your home directory by the shell. Use the full path.
Im trying to compile bumblebee sat-solver from http://amit.metodi.me/research/bee/. I have installed SWI-Prolog and MinGW already but after i type "make-minisat" in cmd i get:
A subdirectory or file ..\satsolver already exists.
In file included from Solver.h:27:0,
from pl-minisat.cpp:6:
../utils/Options.h:285:29: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
fprintf(stderr, "%4"PRIi64, range.begin);
^
../utils/Options.h:291:29: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
fprintf(stderr, "%4"PRIi64, range.end);
^
../utils/Options.h:293:25: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
fprintf(stderr, "] (default: %"PRIi64")\n", value);
^
In file included from ../core/Solver.h:27:0,
from Solver.cc:24:
../utils/Options.h:285:29: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
fprintf(stderr, "%4"PRIi64, range.begin);
^
../utils/Options.h:291:29: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
fprintf(stderr, "%4"PRIi64, range.end);
^
../utils/Options.h:293:25: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
fprintf(stderr, "] (default: %"PRIi64")\n", value);
^
pl-minisat.obj:pl-minisat.cpp:(.text+0x13): undefined reference to `PL_get_integer'
pl-minisat.obj:pl-minisat.cpp:(.text+0x4d): undefined reference to `Sdprintf'
pl-minisat.obj:pl-minisat.cpp:(.text+0x76): undefined reference to `Sdprintf'
pl-minisat.obj:pl-minisat.cpp:(.text+0x18a): undefined reference to `PL_unify_integer'
pl-minisat.obj:pl-minisat.cpp:(.text+0x1b4): undefined reference to `PL_get_integer'
pl-minisat.obj:pl-minisat.cpp:(.text+0x1ed): undefined reference to `PL_unify_integer'
pl-minisat.obj:pl-minisat.cpp:(.text+0x220): undefined reference to `PL_copy_term_ref'
pl-minisat.obj:pl-minisat.cpp:(.text+0x227): undefined reference to `PL_new_term_ref'
pl-minisat.obj:pl-minisat.cpp:(.text+0x23c): undefined reference to `PL_unify_integer'
pl-minisat.obj:pl-minisat.cpp:(.text+0x24f): undefined reference to `PL_get_list'
pl-minisat.obj:pl-minisat.cpp:(.text+0x271): undefined reference to `PL_unify_integer'
pl-minisat.obj:pl-minisat.cpp:(.text+0x298): undefined reference to `PL_new_term_ref'
pl-minisat.obj:pl-minisat.cpp:(.text+0x29f): undefined reference to `PL_new_term_ref'
pl-minisat.obj:pl-minisat.cpp:(.text+0x2a9): undefined reference to `PL_put_nil'
pl-minisat.obj:pl-minisat.cpp:(.text+0x2ec): undefined reference to `PL_put_integer'
pl-minisat.obj:pl-minisat.cpp:(.text+0x2ff): undefined reference to `PL_cons_list'
pl-minisat.obj:pl-minisat.cpp:(.text+0x314): undefined reference to `PL_unify'
pl-minisat.obj:pl-minisat.cpp:(.text+0x33e): undefined reference to `Sdprintf'
pl-minisat.obj:pl-minisat.cpp:(.text+0x38d): undefined reference to `Sdprintf'
pl-minisat.obj:pl-minisat.cpp:(.text+0x3cb): undefined reference to `Sdprintf'
pl-minisat.obj:pl-minisat.cpp:(.text+0x3d7): undefined reference to `PL_register_extensions'
pl-minisat.obj:pl-minisat.cpp:(.text+0x3e3): undefined reference to `Sdprintf'
pl-minisat.obj:pl-minisat.cpp:(.text+0x44a): undefined reference to `PL_new_term_ref'
pl-minisat.obj:pl-minisat.cpp:(.text+0x457): undefined reference to `PL_copy_term_ref'
pl-minisat.obj:pl-minisat.cpp:(.text+0x47e): undefined reference to `PL_get_list'
pl-minisat.obj:pl-minisat.cpp:(.text+0x497): undefined reference to `PL_get_integer'
pl-minisat.obj:pl-minisat.cpp:(.text+0x51a): undefined reference to `PL_get_nil'
pl-minisat.obj:pl-minisat.cpp:(.text+0x5fa): undefined reference to `PL_new_term_ref'
pl-minisat.obj:pl-minisat.cpp:(.text+0x607): undefined reference to `PL_copy_term_ref'
pl-minisat.obj:pl-minisat.cpp:(.text+0x62e): undefined reference to `PL_get_list'
pl-minisat.obj:pl-minisat.cpp:(.text+0x647): undefined reference to `PL_get_integer'
pl-minisat.obj:pl-minisat.cpp:(.text+0x6ca): undefined reference to `PL_get_nil'
pl-minisat.obj:pl-minisat.cpp:(.text+0x808): undefined reference to `Sdprintf'
pl-minisat.obj:pl-minisat.cpp:(.text.startup+0x21): undefined reference to `PL_initialise'
pl-minisat.obj:pl-minisat.cpp:(.text.startup+0x31): undefined reference to `PL_halt'
pl-minisat.obj:pl-minisat.cpp:(.text.startup+0x36): undefined reference to `PL_toplevel'
pl-minisat.obj:pl-minisat.cpp:(.text.startup+0x46): undefined reference to `PL_halt'
collect2.exe: error: ld returned 1 exit status
g++ returned code 1
*** swipl-ld exit status 1
It looks like g++ can't reach prolog header files. Any ideas? I work on win 10, 64 bits.
There is a beta feature of Windows 10 know as WSL (Windows Subsystem for Linux), or Bash on Windows, or Bash on Ubuntu on Windows.
Bash on Windows provides developers with a familiar Bash shell and
Linux environment in which you can run most Linux command-line tools,
directly on Windows, UNMODIFIED, without needing an entire Linux
virtual machine!
I have used it to install SWI-Prolog and run some of my own Prolog programs. AFAIK I might be the only one on the planet to have done this.
I have installed it using the
PPA
or
sudo apt-get install swi-prolog-nox -y.
The PPA installs a newer version.
Plan on spending about an hour from the time you start to the time you get everything installed and updated as you are literally downloading and installing Ubuntu and all the apps from the ground up.
The WSL installation guide is here.
You are probably not on the Windows insider program, so DO NOT follow For Windows Insiders: Install Linux distribution of choice but instead follow For Anniversary Update and Creators Update: Install using lxrun.
If you run into problems I can help you, or you can post issues on the GitHub issues page, or use the SO tag wsl, or use the Ask Ubuntu tag wsl, or use the SuperUser tag windows-subsystem-linux.
I initially used it for this problem.
You need to read all of the pages noted on the left of the home page.
Breadcrumbs
Using Windows 10 install WSL per installation guide
Use the right instruction set:
For Anniversary Update and Creators Update: Install using lxrun
Note: The rest of the instructions are done within WSL or an app run from WSL
Install gcc
sudo apt-get -y install build-essential
Install SWI-Prolog - used PPA
Create directory for Bee
mkdir Bee
On my system it is eric#WINDOWS:~/projects/Bee$
Change to the Bee directory
cd ~/projects/Bee
Download Bee
wget http://amit.metodi.me/research/bee/bee20170615.zip
Uncompress zip
I installed and used 7-Zip
sudo apt-get install p7zip-full
7z x bee20170615.zip
Change to the source code directory
cd satsolver_src
Read README.txt
Build solvers using make
make satSolvers
eric#WINDOWS:~/projects/Bee/satsolver_src$ make satSolvers
rm -r -f ../satsolver
mkdir -p ../satsolver
tar xf ../satsolver_src/plSATsolver.tar.gz -C ../satsolver
tar -xf plMiniSAT_src.tar.gz -C ../satsolver
(cd ../satsolver/prologinterface && ./configure && make)
make[1]: Entering directory '/home/eric/projects/Bee/satsolver/prologinterface'
rm -f *.so
g++ -Wno-unused-result -D __STDC_LIMIT_MACROS -D __STDC_FORMAT_MACROS -O3 -fomit-frame-pointer -s -shared -fpic -o pl-minisat.so pl-minisat.cpp \
../minisat-2.0.2/core/Solver.cc \
-L/usr/lib/swi-prolog/lib/amd64 \
-I /usr/lib/swi-prolog/include \
-I ../minisat-2.0.2/ \
-I ../minisat-2.0.2/core
make[1]: Leaving directory '/home/eric/projects/Bee/satsolver/prologinterface'
mv ../satsolver/prologinterface/pl-minisat.so ../satsolver/pl-minisat.so
rm -r -f ../satsolver/minisat-2.0.2
rm -r -f ../satsolver/prologinterface
tar xf ../satsolver_src/plGlucose_src.tar.gz -C ../satsolver
(cd ../satsolver/prologinterface && ./configure && make)
make[1]: Entering directory '/home/eric/projects/Bee/satsolver/prologinterface'
rm -f *.so
g++ -Wno-unused-result -D __STDC_LIMIT_MACROS -D __STDC_FORMAT_MACROS -O3 -fomit-frame-pointer -s -shared -fpic -o pl-glucose.so pl-glucose.cpp \
../glucose-2.2/core/Solver.cc \
-L/usr/lib/swi-prolog/lib/amd64 \
-I /usr/lib/swi-prolog/include \
-I ../glucose-2.2/ \
-I ../glucose-2.2/core
make[1]: Leaving directory '/home/eric/projects/Bee/satsolver/prologinterface'
mv ../satsolver/prologinterface/pl-glucose.so ../satsolver/pl-glucose.so
rm -r -f ../satsolver/glucose-2.2
rm -r -f ../satsolver/prologinterface
tar xf ../satsolver_src/plGlucose4_src.tar.gz -C ../satsolver
(cd ../satsolver/prologinterface && ./configure && make)
make[1]: Entering directory '/home/eric/projects/Bee/satsolver/prologinterface'
rm -f *.so
g++ -Wno-unused-result -D __STDC_LIMIT_MACROS -D __STDC_FORMAT_MACROS -O3 -fomit-frame-pointer -s -shared -fpic -o pl-glucose4.so pl-glucose4.cpp \
../glucose-4/core/Solver.cc \
-L/usr/lib/swi-prolog/lib/amd64 \
-I /usr/lib/swi-prolog/include \
-I ../glucose-4/ \
-I ../glucose-4/core
make[1]: Leaving directory '/home/eric/projects/Bee/satsolver/prologinterface'
mv ../satsolver/prologinterface/pl-glucose4.so ../satsolver/pl-glucose4.so
rm -r -f ../satsolver/glucose-4
rm -r -f ../satsolver/prologinterface
eric#WINDOWS:~/projects/Bee/satsolver_src$
Verify executables created
cd ..
cd satsolver
ll
eric#WINDOWS:~/projects/Bee/satsolver$ ll
total 372
drwxrwxrwx 0 eric eric 4096 Jul 31 07:12 ./
drwxrwxrwx 0 eric eric 4096 Jul 31 07:11 ../
-rwxrwxrwx 1 eric eric 101200 Jul 31 07:12 pl-glucose4.so*
-rwxrwxrwx 1 eric eric 80656 Jul 31 07:12 pl-glucose.so*
-rwxrwxrwx 1 eric eric 68360 Jul 31 07:12 pl-minisat.so*
-rw-r--r-- 1 eric eric 10268 Apr 1 2016 satsolver.pl
eric#WINDOWS:~/projects/Bee/satsolver$
Run first example from README.txt
swipl
[satsolver].
sat([[A,-B],[-A,B]]).
eric#WINDOWS:~/projects/Bee/satsolver$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 7.4.2)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For online help and background, visit http://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).
?- [satsolver].
% SWI-Prolog interface to Glucose v2.2 ... OK
true.
?- sat([[A,-B],[-A,B]]).
A = B, B = -1.
i'm getting this error:
make:24: *** missing separator. Stop.
Although i changed all space character with tab in line 24.
Line24:arm_v5t_le-gcc $FILES $INCLUDES $LIBS -o $TARGET
Here is the code:
#DM_serial2_make
export PATH="$PATH:/opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/bin:/opt/mv_pro_5.0/montavista/pro/bin:/opt/mv_pro_5.0/montavista/common/bin"
TARGET="/home/cilem/Desktop/06.05.2012/DM_serial2"
INCLUDES=" -I /home/cilem/Desktop/06.05.2012/libxml2 \
-I /home/cilem/Desktop/06.05.2012/gstreamer-0.10 \
-I /home/cilem/Desktop/06.05.2012/gstreamer-0.10/gst/interfaces \
-I /home/cilem/Desktop/06.05.2012/glib-2.0 \
-I /home/cilem/Desktop/06.05.2012/glib-2.0/include"
LIBS=" -L /home/cilem/Desktop/06.05.2012/lib/ -l:libgstreamer-0.10.so.0 \
-L /home/cilem/Desktop/06.05.2012/lib/ -l:libgstinterfaces-0.10.so.0 \
-L /home/cilem/Desktop/06.05.2012/lib/ -l:libgobject-2.0.so.0 \
-L /home/cilem/Desktop/06.05.2012/lib/ -l:libgmodule-2.0.so.0 \
-L /home/cilem/Desktop/06.05.2012/lib/ -l:libxml2.so.2 \
-L /home/cilem/Desktop/06.05.2012/lib/ -l:libgthread-2.0.so.0 \
-L /home/cilem/Desktop/06.05.2012/lib/ -l:libglib-2.0.so.0"
FILES="DM_serial2.c"
arm_v5t_le-gcc $FILES $INCLUDES $LIBS -o $TARGET
That looks like a shell script. Shell scripts are not makefiles, and vice versa. You need to find a good tutorial on make, or read the GNU make manual.
For example, you should not have any quoting in your variable values.
Second, variable expansions in make require the variables to be surrounded by parens or curly braces: $(FILES) or ${FILES}.
Third, as piokuc says, that line is not a valid make rule. A make rule has the form:
<target> : <dependencies...>
<commands...>
where the indentation of the commands... must be TAB characters. This rule says "you can build target whenever it's older than any of dependencies... by running commands...". The target and dependencies must (usually) be files, so you definitely don't want to use $(INCLUDES) or $(LIBS) in that list as those are compiler flags.
You probably want something like this, although it could be improved:
$(TARGET): $(FILES)
arm_v5t_le-gcc $(FILES) $(INCLUDES) $(LIBS) -o $(TARGET)
You've got other weird things here. You don't need to provide the same directory over and over with the -L flag. Once is enough. Also I'm not familiar with the -l:libfoo.a construct; usually it's just -lfoo.
I think the last line should be replaced with something like:
$TARGET: $FILES $INCLUDES $LIBS
arm_v5t_le-gcc $FILES $INCLUDES $LIBS -o $TARGET
The above line (the one starting with arm_v5t_le-gcc) should start with a tab, not spaces.