I am currently setting up a new PC with Omnet++, Veins and Artery for simulating ITS-G5 protocol. After calling make inet in the root directory of Artery I get the following Error Message:
$ make inet
cd extern/inet; python inet_featuretool disable packetdrill SCTP SCTP_examples
Disabling feature(s): packetdrill, SCTP_examples, SCTP
opp_featuretool: .oppfeaturestate file updated.
opp_featuretool: .nedexclusions file updated.
make -C extern/inet makefiles
make[1]: Entering directory '/home/wiconlab/Car2x/artery-master/extern/inet'
Creating Makefile in /home/wiconlab/Car2x/artery-master/extern/inet/src...
make[1]: Leaving directory '/home/wiconlab/Car2x/artery-master/extern/inet'
make -C extern/inet/src
make[1]: Entering directory '/home/wiconlab/Car2x/artery-master/extern/inet/src'
*** COMPILING with:
g++ -c -std=c++11 -O3 -march=native -mtune=native -DNDEBUG=1 -MMD -MP -MF .d -fPIC -fno-stack-protector -DHAVE_SWAPCONTEXT -DWITH_MPI -DXMLPARSER=libxml -DPREFER_QTENV -DWITH_QTENV -DWITH_TKENV -DWITH_PARSIM -DWITH_NETBUILDER -DWITH_OSG -DWITH_OSGEARTH -Wno-overloaded-virtual -include inet/common/precompiled.h -I. -I/home/wiconlab/Car2x/omnetpp-5.2/include
*** LINKING with:
g++ -shared -fPIC -o ../out/gcc-release/src/libINET.so -Wl,--no-as-needed -Wl,--whole-archive -Wl,--no-whole-archive -loppenvir -loppsim -ldl -lstdc++ -lOpenThreads -losg -losgText -losgDB -losgEarth -losgEarthUtil -Wl,-rpath,/home/wiconlab/Car2x/omnetpp-5.2/lib -Wl,-rpath,/lib -Wl,-rpath,. -L/home/wiconlab/Car2x/omnetpp-5.2/lib
Building...
Creating precompiled header for gcc...
MSGC: inet/applications/base/ApplicationPacket.msg
... *ABBREVIATED FOR CLARITY*
inet/networklayer/ipv4/RoutingTableRecorder.cc
inet/networklayer/ipv4/RoutingTableRecorder.cc: In member function ‘virtual void inet::RoutingTableRecorder::recordInterfaceChange(omnetpp::cModule*, const inet::InterfaceEntry*, omnetpp::simsignal_t)’:
inet/networklayer/ipv4/RoutingTableRecorder.cc:207:15: error: expected ‘)’ before ‘INT64_PRINTF_FORMAT’
#define LL INT64_PRINTF_FORMAT // for eventnumber_t
^
inet/networklayer/ipv4/RoutingTableRecorder.cc:296:37: note: in expansion of macro ‘LL’
fprintf(routingLogFile, "%s %" LL "d %s %d %s %s\n",
^
inet/networklayer/ipv4/RoutingTableRecorder.cc:303:13: warning: spurious trailing ‘%’ in format [-Wformat=]
);
^
inet/networklayer/ipv4/RoutingTableRecorder.cc:303:13: warning: too many arguments for format [-Wformat-extra-args]
inet/networklayer/ipv4/RoutingTableRecorder.cc: In member function ‘virtual void inet::RoutingTableRecorder::recordRouteChange(omnetpp::cModule*, const inet::IRoute*, omnetpp::simsignal_t)’:
inet/networklayer/ipv4/RoutingTableRecorder.cc:207:15: error: expected ‘)’ before ‘INT64_PRINTF_FORMAT’
#define LL INT64_PRINTF_FORMAT // for eventnumber_t
^
inet/networklayer/ipv4/RoutingTableRecorder.cc:323:36: note: in expansion of macro ‘LL’
fprintf(routingLogFile, "%s %" LL "d %s %d %s %s %d %s\n",
^
inet/networklayer/ipv4/RoutingTableRecorder.cc:332:13: warning: spurious trailing ‘%’ in format [-Wformat=]
);
^
inet/networklayer/ipv4/RoutingTableRecorder.cc:332:13: warning: too many arguments for format [-Wformat-extra-args]
Makefile:1134: recipe for target '../out/gcc-release/src/inet/networklayer/ipv4/RoutingTableRecorder.o' failed
make[1]: *** [../out/gcc-release/src/inet/networklayer/ipv4/RoutingTableRecorder.o] Error 1
make[1]: Leaving directory '/home/wiconlab/Car2x/artery-master/extern/inet/src'
Makefile:21: recipe for target 'inet' failed
make: *** [inet] Error 2
I am using an up to date Ubuntu 16.04 LTS, compiling with cmake 3.9.6, building Veins and Vanetza worked without issue. Omnet++ Version is 5.2. The code lines, the Error is referring to are:
203 namespace inet {
204
205 Define_Module(RoutingTableRecorder);
206
207 #define LL INT64_PRINTF_FORMAT // for eventnumber_t
However expecting a ")" before line 207 makes no sense to me.
Also, this Error did not appear when building Artery on a different System (Same OS) a few weeks earlier. Using an earlier revision of the source had no effect either.
You are using OMNeT++ 5.2.
This seems to be the problem because the API has changed slightly.
INT64_PRINTF_FORMAT isn't available anymore in OMNeT++ 5.2.
Changing back to OMNeT++ Version 5.1 should resolve your error!
fprintf(routingLogFile, "%s %" LL "d %s %d %s %s %d %s\n",
^
inet/networklayer/ipv4/RoutingTableRecorder.cc:332:13: warning: spurious trailing ‘%’ in format [-Wformat=]
);
This is just a simple syntax error. Go through the path Inet/src/inet/networlayer/ipv4/ and open the RoutingTableRecord.cc file and edit at "fprintf(routingLogFile, "%s %" LL "d %s %d %s %s %d %s\n", " line and remove LL including the double quotes that is around the LL. There are two of them with in this C code. So make sure they are both corrected like the following line: fprintf(routingLogFile, "%s %d %s %d %s %s %d %s\n", .
You might also need to comment out #define LL INT64_PRINTF_FORMAT // for eventnumber_t at line number around 270.
Then save and Clean only the inet project. Then Build also only the inet project.
Related
so heres the make file:
CC=gcc
default: msb doc
lib: libmsb-*
cd libmsb-*/ && make -f Makefile.in
msb: lib msb.c
$(CC) msb.c -o msb -I libmsb-*/ -L libmsb-*/ -l msb
install: msb
install -s msb -t $(DESTDIR)/bin/
doc: msb.1
groff -Tlatin1 -man msb.1 | col -b > msb.1.txt
cleanup:
rm -f libmsb-*/*.o libmsb-*/*.a
clean: cleanup
rm -f msb
rm -f msb.1.txt
heres the error that i receive when running $make:
cd libmsb-*/ && make -f Makefile.in
make[1]: Entering directory 'C:/Users/****/Desktop/msb-0.1/libmsb-0.2'
make[1]: 'libmsb.a' is up to date.
make[1]: Leaving directory 'C:/Users/****/Desktop/msb-0.1/libmsb-0.2'
gcc msb.c -o msb -I libmsb-*/ -L libmsb-*/ -l msb
msb.c: In function ‘main’:
msb.c:94:19: warning: ‘optarg’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
94 | extern char * optarg;
| ^~~~~~
msb.c:95:16: warning: ‘optind’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
95 | extern int optind, optopt;
| ^~~~~~
msb.c:95:24: warning: ‘optopt’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
95 | extern int optind, optopt;
| ^~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: libmsb-0.2//libmsb.a(msb_std.o):msb_std.c:(.bss+0x0): multiple definition of `msb_parities'; /tmp/cch7E9uN.o:msb.c:(.bss+0x0): first defined here
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: libmsb-0.2//libmsb.a(msb_std.o):msb_std.c:(.bss+0x4): multiple definition of `msb_lrc_flags'; /tmp/cch7E9uN.o:msb.c:(.bss+0x4): first defined here
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: libmsb-0.2//libmsb.a(msb_std.o):msb_std.c:(.bss+0x8): multiple definition of `msb_std_track_map'; /tmp/cch7E9uN.o:msb.c:(.bss+0x8): first defined here
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: libmsb-0.2//libmsb.a(msb_encode.o):msb_encode.c:(.bss+0x0): multiple definition of `msb_parities'; /tmp/cch7E9uN.o:msb.c:(.bss+0x0): first defined here
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: libmsb-0.2//libmsb.a(msb_encode.o):msb_encode.c:(.bss+0x4): multiple definition of `msb_lrc_flags'; /tmp/cch7E9uN.o:msb.c:(.bss+0x4): first defined here
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: libmsb-0.2//libmsb.a(msb_encode.o):msb_encode.c:(.bss+0x8): multiple definition of `msb_std_track_map'; /tmp/cch7E9uN.o:msb.c:(.bss+0x8): first defined here
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: libmsb-0.2//libmsb.a(msb_decode.o):msb_decode.c:(.bss+0x0): multiple definition of `msb_parities'; /tmp/cch7E9uN.o:msb.c:(.bss+0x0): first defined here
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: libmsb-0.2//libmsb.a(msb_decode.o):msb_decode.c:(.bss+0x4): multiple definition of `msb_lrc_flags'; /tmp/cch7E9uN.o:msb.c:(.bss+0x4): first defined here
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: libmsb-0.2//libmsb.a(msb_decode.o):msb_decode.c:(.bss+0x8): multiple definition of `msb_std_track_map'; /tmp/cch7E9uN.o:msb.c:(.bss+0x8): first defined here
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: libmsb-0.2//libmsb.a(msb_7811.o):msb_7811.c:(.bss+0x0): multiple definition of `msb_parities'; /tmp/cch7E9uN.o:msb.c:(.bss+0x0): first defined here
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: libmsb-0.2//libmsb.a(msb_7811.o):msb_7811.c:(.bss+0x4): multiple definition of `msb_lrc_flags'; /tmp/cch7E9uN.o:msb.c:(.bss+0x4): first defined here
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: libmsb-0.2//libmsb.a(msb_7811.o):msb_7811.c:(.bss+0x8): multiple definition of `msb_std_track_map'; /tmp/cch7E9uN.o:msb.c:(.bss+0x8): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:6: msb] Error 1
Heres the Makefile.IN:
libmsb.a: msb_common.h msb_std.h msb_encode.h msb_decode.h msb_7811.h\
msb_std.c msb_encode.c msb_decode.c msb_7811.c
$(CC) -c msb_std.c -o msb_std.o
$(CC) -c msb_encode.c -o msb_encode.o
$(CC) -c msb_decode.c -o msb_decode.o
$(CC) -c msb_7811.c -o msb_7811.o
ar crs libmsb.a msb_std.o msb_encode.o msb_decode.o msb_7811.o
the source code can be found here of the other files: https://sourceforge.net/projects/msb.berlios/files/latest/download
im still new to make files so any help is greatly appreciated....
I was able to compiled the gateway but I got the error below running the make command.
gcc -D_REENTRANT=1 -I. -Igw -g -O2 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_LARGE_FILES= -I/usr/include/libxml2 -I/usr/include/mysql -o gwlib/dbpool.o -c gwlib/dbpool.c
In file included from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
from /usr/include/stdlib.h:25,
from gwlib/gwlib.h:70,
from gwlib/dbpool.c:70:
/usr/include/features.h:187:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
187 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
In file included from gwlib/gwlib.h:83,
from gwlib/dbpool.c:70:
gwlib/dbpool_mysql.c: In function ‘mysql_select’:
gwlib/dbpool_mysql.c:224:48: error: ‘my_bool’ undeclared (first use in this function); did you mean ‘xr_bool’?
224 | bind[i].is_null = gw_malloc(sizeof(my_bool));
gwlib/gwmem.h:122:43: note: in definition of macro ‘gw_malloc’
122 | #define gw_malloc(size) (gw_native_malloc(size))|
gwlib/dbpool_mysql.c:224:48: note: each undeclared identifier is reported only once for each function it appears in
224 | bind[i].is_null = gw_malloc(sizeof(my_bool));
gwlib/gwmem.h:122:43: note: in definition of macro ‘gw_malloc’
122 | #define gw_malloc(size) (gw_native_malloc(size))
make: *** [Makefile:230: gwlib/dbpool.o] Error 1`
This error comes when you're compiling with mysql 8
To fix this, add these lines to gwlib/dbpool_mysql.c
/* define my_bool for newer versions because they use the bool or int C type instead */
#if MYSQL_VERSION_ID >= 80000 && !defined(MARIADB_BASE_VERSION)
typedef bool my_bool;
#endif
I am trying to run a make file in MacOS sierra, but it seems to have trouble with the header of the Zlib (see below).
I have tried to install a separate version with brew and pass the directory of the brew zlib installation in the configure file.
./configure --prefix=/usr/local/etherlab --with-xml-prefix=/usr/local/opt/libxml2 --with-zlib-dir=/usr/local/opt/zlib CXXFLAGS=-std=c++11
However, when I run make I got the error
$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in proto
make[2]: Nothing to be done for `all'.
Making all in lib
Making all in LibDLS
make[3]: Nothing to be done for `all'.
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/etherlab/include -Wall -I/usr/local/include -I/usr/local/opt/zlib/include -I/usr/local/opt/libxml2/include/libxml2 -std=c++11 -MT libdls_la-ZLib.lo -MD -MP -MF .deps/libdls_la-ZLib.Tpo -c -o libdls_la-ZLib.lo `test -f 'ZLib.cpp' || echo './'`ZLib.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/etherlab/include -Wall -I/usr/local/include -I/usr/local/opt/zlib/include -I/usr/local/opt/libxml2/include/libxml2 -std=c++11 -MT libdls_la-ZLib.lo -MD -MP -MF .deps/libdls_la-ZLib.Tpo -c ZLib.cpp -fno-common -DPIC -o .libs/libdls_la-ZLib.o
ZLib.cpp:22:10: warning: non-portable path to file '<ZLib.h>'; specified path differs in case from file name on disk
[-Wnonportable-include-path]
#include <zlib.h>
^~~~~~~~
<ZLib.h>
In file included from ZLib.cpp:22:
./zlib.h:42:17: error: unknown type name 'string'; did you mean 'std::string'?
EZLib(const string &pmsg) : Exception(pmsg) {};
^~~~~~
std::string
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:194:65: note:
'std::string' declared here
typedef basic_string<char, char_traits<char>, allocator<char> > string;
^
ZLib.cpp:90:5: error: unknown type name 'uLongf'
uLongf out_size;
^
ZLib.cpp:104:17: error: use of undeclared identifier 'uLongf'
out_size = (uLongf) (src_size * 1.01 + 12 + 0.5);
^
ZLib.cpp:117:28: error: use of undeclared identifier 'Bytef'
comp_ret = ::compress((Bytef *) _out_buf, &out_size,
^
ZLib.cpp:117:35: error: expected expression
comp_ret = ::compress((Bytef *) _out_buf, &out_size,
^
ZLib.cpp:118:34: error: unknown type name 'Bytef'
(const Bytef *) src, src_size);
^
ZLib.cpp:117:16: error: no member named 'compress' in the global namespace; did you mean simply 'compress'?
comp_ret = ::compress((Bytef *) _out_buf, &out_size,
^~~~~~~~~~
compress
ZLib.cpp:88:12: note: 'compress' declared here
void ZLib::compress(const char *src, unsigned int src_size)
^
ZLib.cpp:120:21: error: use of undeclared identifier 'Z_OK'
if (comp_ret != Z_OK) // Fehler beim Komprimieren
^
ZLib.cpp:123:25: error: use of undeclared identifier 'Z_BUF_ERROR'
if (comp_ret == Z_BUF_ERROR) err << " (BUFFER ERROR)";
^
ZLib.cpp:155:5: error: unknown type name 'uLongf'
uLongf zlib_out_size = out_size;
^
ZLib.cpp:173:32: error: use of undeclared identifier 'Bytef'
uncomp_ret = ::uncompress((Bytef *) _out_buf, &zlib_out_size,
^
ZLib.cpp:173:39: error: expected expression
uncomp_ret = ::uncompress((Bytef *) _out_buf, &zlib_out_size,
^
ZLib.cpp:174:38: error: unknown type name 'Bytef'
(const Bytef *) src, src_size);
^
ZLib.cpp:173:18: error: no member named 'uncompress' in the global namespace; did you mean simply 'uncompress'?
uncomp_ret = ::uncompress((Bytef *) _out_buf, &zlib_out_size,
^~~~~~~~~~~~
uncompress
ZLib.cpp:150:12: note: 'uncompress' declared here
void ZLib::uncompress(const char *src, unsigned int src_size,
^
ZLib.cpp:176:23: error: use of undeclared identifier 'Z_OK'
if (uncomp_ret != Z_OK) // Fehler beim Dekomprimieren
^
ZLib.cpp:179:27: error: use of undeclared identifier 'Z_BUF_ERROR'
if (uncomp_ret == Z_BUF_ERROR) {
^
1 warning and 16 errors generated.
make[3]: *** [libdls_la-ZLib.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Digging a bit more I found that I could try to add
#include <string>
#include <cstring>
to the header zlib.h but this does not work either.
What else can I do to solve this issue?.
In MSYS2, I tried to intall a Chicken egg with::
chicken-install http-client
I get several errors like the following:
"c:\msys64\usr\local\bin\csc" -feature compiling-extension -setup-mode mathh.scm -shared -optimize-leaf-routines -inline -output-file mathh.so -emit-import-library mathh -emit-type-file mathh.types -local -no-procedure-checks
mathh.c:24:1: error: static declaration of 'log2' follows non-static declaration
log2( double x )
^~~~
In file included from c:/msys64/usr/local/include/chicken/chicken.h:131:0,
from mathh.c:11:
C:/msys64/mingw64/x86_64-w64-mingw32/include/math.h:773:25: note: previous declaration of 'log2' was here
extern double __cdecl log2 (double);
^~~~
mathh.c:41:1: error: static declaration of 'log1p' follows non-static declaration
log1p( double x )
^~~~~
Edit
The dependency:
chicken-install mathh
gives:
...
mathh.c: In function 'stub181':
mathh.c:357:19: warning: implicit declaration of function 'mm_hypot'; did you mean '_hypot'? [-Wimplicit-function-declaration]
C_r=C_flonum(&C_a,mm_hypot(t0,t1));
^~~~~~~~
_hypot
mathh.o:mathh.c:(.text+0x177f): undefined reference to `mm_hypot'
collect2.exe: error: ld returned 1 exit status
Error: shell command terminated with non-zero exit status 1: ""gcc" "mathh.o" -o "mathh.so" -Wl,--enable-auto-import -shared -Lc:\msys64\usr\local\lib\ -lchicken -lm -lws2_32"
Error: shell command failed with nonzero exit status 1:
""c:\msys64\usr\local\bin\csc" -feature compiling-extension -setup-mode mathh.scm -shared -optimize-leaf-routines -inline -output-file mathh.so -emit-import-library mathh -emit-type-file mathh.types -local -no-procedure-checks"
Error: shell command terminated with nonzero exit code
70
"\"\"c:\\msys64\\usr\\local\\bin\\csi\" -bnq -setup-mode -e \"(require-lib...
Edit
Fix proposed by #krl:
msys2_shell.cmd -mingw64 # see http://wiki.call-cc.org/msys2
export CHICKEN_PREFIX="c:\msys64\usr\local\\"
export CHICKEN_REPOSITORY="c:\msys64\usr\local\lib\chicken\8\\"
chicken-install -retrieve mathh
sed -i.bak -r 's/define +mathh-compile-options.+\(/&\n -C -mwin32/' ./mathh/mathh.setup
chicken-install test
chicken-install -test -transport local -location . mathh
That still gives the following errors:
...
installing mathh: ...
changing current directory to C:\msys64\home\user\.\mathh
""c:\msys64\usr\local\bin\csi" -bnq -setup-mode -e "(require-library setup-api)" -e "(import setup-api)" -e "(setup-error-handling)" -e "(extension-name-and-version '(\"mathh\" \"\"))" "mathh.setup""
"c:\msys64\usr\local\bin\csc" -feature compiling-extension -setup-mode mathh.scm -shared -optimize-leaf-routines -inline -output-file mathh.so -emit-import-library mathh -emit-type-file mathh.types -local -no-procedure-checks
mathh.c:29:1: error: static declaration of 'log2' follows non-static declaration
log2( double x )
^~~~
In file included from c:/msys64/usr/local/include/chicken/chicken.h:131:0,
from mathh.c:11:
C:/msys64/mingw64/x86_64-w64-mingw32/include/math.h:773:25: note: previous declaration of 'log2' was here
extern double __cdecl log2 (double);
^~~~
... further errors like above
It looks like this is a bug in the mathh egg. I've asked its author to take a look and he's published a new version. Can you try again?
from http://www.davidegrayson.com/windev/msys2/ it appears the MSYS2 -mwin32 gcc option is needed to define _WIN32. mathh uses defined(_WIN32) to trigger expansion of the q&d implementations of log2, etc. for windows.
the mathh egg mathh.setup file can be modified to supply compile-options. see the definition of mathh-compile-options in mathh.setup.
ex: (define mathh-compile-options '(-local -no-procedure-checks -mwin32))
I've just released http-client version 0.16 where I ripped out the overly complex md5 dependency, and replaced it with the new simple-md5 egg.
This should be much easier to install. It should appear on the egg mirrors shortly.
I am a newbie in CUDA and want to compile my first programms on a Jetson TK1.
I have searched the Internet and also this Site but dont found something, that was helpful for me.
I have found this example
http://bikulov.org/blog/2013/12/24/example-of-cmake-file-for-cuda-plus-cpp-code/
and tried to compile the CUDA example oceanFFT which runs with the sample Makefile.
http://developer.download.nvidia.com/compute/cuda/1.1-Beta/x86_website/samples.html#oceanFFT
I have changed this CMakeLists.txt a little bit, but I dont know if I did this correct.
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(lbmslv)
FIND_PACKAGE(CUDA REQUIRED)
FIND_PACKAGE(MPI REQUIRED)
FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE(FindCUDA)
INCLUDE_DIRECTORIES(/usr/local/cuda/include ${MPI_INCLUDE_PATH})
INCLUDE_DIRECTORIES(/usr/local/cuda-6.5/samples/common/inc ${CUS_INCLUDE_PATH})
INCLUDE_DIRECTORIES(/usr/local/cuda-6.5/samples/common/lib/linux/armv7l ${GLEW_INCLUDE_PATH})
FILE(GLOB SOURCES "*.cu" "*.cpp" "*.c" "*.h")
CUDA_ADD_EXECUTABLE(lbmslv ${SOURCES})
LIST(APPEND CMAKE_CXX_FLAGS "-std=c++0x -O3 -ffast-math -Wall")
LIST(APPEND CUDA_NVCC_FLAGS --compiler-options -fno-strict-aliasing -lineinfo -use_fast_math -Xptxas -dlcm=cg)
LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_20,code=sm_20)
LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_30,code=sm_30)
LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_35,code=sm_35)
TARGET_LINK_LIBRARIES(lbmslv /usr/local/cuda/lib/libcudart.so ${MPI_LIBRARIES})
When I run this I get a lot errors with :
undefined reference to .. gl.., glew.., glut..
so, not linked to this Libraries.
What did I wrong?
My problem with the sample Makefiles is, that they are to complicate for my.
I have also tried to make the sample Makefile easier.
# Location of the CUDA Toolkit
CUDA_PATH ?= /usr/local/cuda-6.5
OSUPPER = $(shell uname -s 2>/dev/null | tr "[:lower:]" "[:upper:]")
OSLOWER = $(shell uname -s 2>/dev/null | tr "[:upper:]" "[:lower:]")
OS_SIZE = $(shell uname -m | sed -e "s/x86_64/64/" -e "s/armv7l/32/" -e "s/aarch64/64/")
OS_ARCH = $(shell uname -m)
ARCH_FLAGS =
DARWIN = $(strip $(findstring DARWIN, $(OSUPPER)))
ifneq ($(DARWIN),)
XCODE_GE_5 = $(shell expr `xcodebuild -version | grep -i xcode | awk '{print $$2}' | cut -d'.' -f1` \>= 5)
endif
# Take command line flags that override any of these settings
# ARCH == ARMv7
OS_SIZE = 32
OS_ARCH = armv7l
ARCH_FLAGS = -target-cpu-arch ARM
# Common binaries
GCC := arm-linux-gnueabihf-g++
NVCC := $(CUDA_PATH)/bin/nvcc -ccbin $(GCC)
# internal flags
NVCCFLAGS := -m${OS_SIZE} ${ARCH_FLAGS}
CCFLAGS :=
LDFLAGS :=
# Extra user flags
EXTRA_NVCCFLAGS ?=
EXTRA_LDFLAGS ?=
EXTRA_CCFLAGS ?=
# OS-specific build flags
ifeq ($(abi),gnueabi)
CCFLAGS += -mfloat-abi=softfp
else
# default to gnueabihf
override abi := gnueabihf
LDFLAGS += --dynamic-linker=/lib/ld-linux-armhf.so.3
CCFLAGS += -mfloat-abi=hard
endif
ifneq ($(TARGET_FS),)
GCCVERSIONLTEQ46 := $(shell expr `$(GCC) -dumpversion` \<= 4.6)
ifeq ($(GCCVERSIONLTEQ46),1)
CCFLAGS += --sysroot=$(TARGET_FS)
endif
LDFLAGS += --sysroot=$(TARGET_FS)
LDFLAGS += -rpath-link=$(TARGET_FS)/lib
LDFLAGS += -rpath-link=$(TARGET_FS)/usr/lib
LDFLAGS += -rpath-link=$(TARGET_FS)/usr/lib/arm-linux-$(abi)
endif
# Debug build flags
ifeq ($(dbg),1)
NVCCFLAGS += -g -G
TARGET := debug
else
TARGET := release
endif
ALL_CCFLAGS :=
ALL_CCFLAGS += $(NVCCFLAGS)
ALL_CCFLAGS += $(EXTRA_NVCCFLAGS)
ALL_CCFLAGS += $(addprefix -Xcompiler ,$(CCFLAGS))
ALL_CCFLAGS += $(addprefix -Xcompiler ,$(EXTRA_CCFLAGS))
ALL_LDFLAGS :=
ALL_LDFLAGS += $(ALL_CCFLAGS)
ALL_LDFLAGS += $(addprefix -Xlinker ,$(LDFLAGS))
ALL_LDFLAGS += $(addprefix -Xlinker ,$(EXTRA_LDFLAGS))
# Common includes and paths for CUDA
INCLUDES := -I ~/NVIDIA_CUDA-6.5_Samples/common/inc
LIBRARIES :=
################################################################################
SAMPLE_ENABLED := 1
# Makefile include to help find GL Libraries
include ./findgllib.mk
# OpenGL specific libraries
ifneq ($(DARWIN),)
# Mac OSX specific libraries and paths to include
LIBRARIES += -L/System/Library/Frameworks/OpenGL.framework/Libraries
LIBRARIES += -lGL -lGLU ../../common/lib/darwin/libGLEW.a
ALL_LDFLAGS += -Xlinker -framework -Xlinker GLUT
else
LIBRARIES += -L ~/NVIDIA_CUDA-6.5_Samples/common/lib/$(OSLOWER)/$(OS_ARCH) $(GLLINK)
LIBRARIES += -lGL -lGLU -lX11 -lXi -lXmu -lglut -lGLEW
endif
# Gencode arguments
ifeq ($(OS_ARCH),armv7l)
SMS ?= 20 30 32 35 37 50 52
else
SMS ?= 11 20 30 35 37 50 52
endif
ifeq ($(SMS),)
$(info >>> WARNING - no SM architectures have been specified - waiving sample <<<)
SAMPLE_ENABLED := 0
endif
ifeq ($(GENCODE_FLAGS),)
# Generate SASS code for each SM architecture listed in $(SMS)
$(foreach sm,$(SMS),$(eval GENCODE_FLAGS += -gencode arch=compute_$(sm),code=sm_$(sm)))
# Generate PTX code from the highest SM architecture in $(SMS) to guarantee forward-compatibility
HIGHEST_SM := $(lastword $(sort $(SMS)))
ifneq ($(HIGHEST_SM),)
GENCODE_FLAGS += -gencode arch=compute_$(HIGHEST_SM),code=compute_$(HIGHEST_SM)
endif
endif
LIBRARIES += -lcufft
ifeq ($(SAMPLE_ENABLED),0)
EXEC ?= #echo "[#]"
endif
################################################################################
# Target rules
all: build
build: dat
check.deps:
ifeq ($(SAMPLE_ENABLED),0)
#echo "Sample will be waived due to the above missing dependencies"
else
#echo "Sample is ready - all dependencies have been met"
endif
dat.o:oceanFFT.cpp
$(EXEC) $(NVCC) $(INCLUDES) $(ALL_CCFLAGS) $(GENCODE_FLAGS) -o $# -c $<
dat_kernel.o:oceanFFT_kernel.cu
$(EXEC) $(NVCC) $(INCLUDES) $(ALL_CCFLAGS) $(GENCODE_FLAGS) -o $# -c $<
dat: dat.o dat_kernel.o
$(EXEC) $(NVCC) $(ALL_LDFLAGS) $(GENCODE_FLAGS) -o $# $+ $(LIBRARIES)
$(EXEC) mkdir -p ../bin
$(EXEC) cp $# ../bin
run: build
$(EXEC) ./dat
clean:
rm -f dat dat.o dat_kernel.o
rm -rf ../bin/dat
clobber: clean
Is their anything else, I can make easier or shorter?
I have less experience in creating makefiles and looking for a general way to create some for CUDA. I hope you can help me.
EDIT:
The new cmake file is:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(lbmslv)
FIND_PACKAGE(CUDA REQUIRED)
FIND_PACKAGE(MPI REQUIRED)
FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE(FindCUDA)
# include every include directory
INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS} ${MPI_INCLUDE_PATH} ${GLEW_INCLUDE_PATH})
INCLUDE_DIRECTORIES(/usr/local/cuda-6.5/samples/common/inc ${SAMPLE_INCLUDE_PATH})
FILE(GLOB SOURCES "*.cu" "*.cpp" "*.c" "*.h")
LIST(APPEND CMAKE_CXX_FLAGS "-std=c++0x -O3 -ffast-math -Wall")
LIST(APPEND CUDA_NVCC_FLAGS --compiler-options -fno-strict-aliasing -lineinfo -use_fast_math -Xptxas -dlcm=cg)
LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_20,code=sm_20)
LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_30,code=sm_30)
LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_35,code=sm_35)
CUDA_ADD_EXECUTABLE(lbmslv ${SOURCES})
# add every dependency to lbmslv
TARGET_LINK_LIBRARIES(lbmslv ${CUDA_LIBRARIES} ${MPI_LIBRARIES} ${OPENGL_LIBRARIES} ${SAMPLE_LIBRARIES})
I get the following terminal outputs:
ubuntu#tegra-ubuntu:~/Documents/CUDA/bin$ cmake ../myOzean/
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found CUDA: /usr/local/cuda-6.5 (found version "6.5")
-- Found MPI_C: /usr/lib/libmpi.so;/usr/lib/arm-linux-gnueabihf/libdl.so;/usr/lib/arm-linux-gnueabihf/libhwloc.so
-- Found MPI_CXX: /usr/lib/libmpi_cxx.so;/usr/lib/libmpi.so;/usr/lib/arm-linux-gnueabihf/libdl.so;/usr/lib/arm-linux-gnueabihf/libhwloc.so
-- Looking for XOpenDisplay in /usr/lib/arm-linux-gnueabihf/libX11.so;/usr/lib/arm-linux-gnueabihf/libXext.so
-- Looking for XOpenDisplay in /usr/lib/arm-linux-gnueabihf/libX11.so;/usr/lib/arm-linux-gnueabihf/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/arm-linux-gnueabihf/libX11.so
-- Found OpenGL: /usr/lib/arm-linux-gnueabihf/libGL.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/Documents/CUDA/bin
ubuntu#tegra-ubuntu:~/Documents/CUDA/bin$ make
[ 50%] Building NVCC (Device) object CMakeFiles/lbmslv.dir//./lbmslv_generated_oceanFFT_kernel.cu.o
/usr/lib/gcc/arm-linux-gnueabihf/4.8/include/stddef.h(432): error: identifier "nullptr" is undefined
/usr/lib/gcc/arm-linux-gnueabihf/4.8/include/stddef.h(432): error: expected a ";"
/usr/include/arm-linux-gnueabihf/c++/4.8/bits/c++config.h(190): error: expected a ";"
/usr/include/c++/4.8/exception(63): error: expected a ";"
/usr/include/c++/4.8/exception(68): error: expected a ";"
/usr/include/c++/4.8/exception(76): error: expected a ";"
/usr/include/c++/4.8/exception(83): error: expected a ";"
/usr/include/c++/4.8/exception(93): error: expected a "{"
/usr/include/c++/4.8/bits/exception_ptr.h(64): error: function "std::current_exception" returns incomplete type "std::__exception_ptr::exception_ptr"
/usr/include/c++/4.8/bits/exception_ptr.h(64): error: expected a "{"
/usr/include/c++/4.8/bits/exception_ptr.h(79): error: expected a ";"
/usr/include/c++/4.8/bits/exception_ptr.h(81): error: expected a ";"
/usr/include/c++/4.8/bits/exception_ptr.h(82): error: expected a ";"
/usr/include/c++/4.8/bits/exception_ptr.h(84): error: expected a ";"
/usr/include/c++/4.8/bits/exception_ptr.h(86): error: declaration is incompatible with previous "std::current_exception"
(64): here
/usr/include/c++/4.8/bits/exception_ptr.h(86): error: use of a local type to declare a function
/usr/include/c++/4.8/bits/exception_ptr.h(86): error: expected a ";"
/usr/include/c++/4.8/bits/exception_ptr.h(87): error: use of a local type to declare a function
/usr/include/c++/4.8/bits/exception_ptr.h(90): error: expected a ";"
/usr/include/c++/4.8/bits/exception_ptr.h(92): error: expected a ";"
/usr/include/c++/4.8/bits/exception_ptr.h(95): error: incomplete type is not allowed
/usr/include/c++/4.8/bits/exception_ptr.h(95): error: expected a ";"
/usr/include/c++/4.8/bits/exception_ptr.h(116): error: expected a ";"
/usr/include/c++/4.8/bits/exception_ptr.h(126): error: expected a ";"
/usr/include/c++/4.8/bits/exception_ptr.h(143): error: use of a local type to declare a function
/usr/include/c++/4.8/bits/exception_ptr.h(144): error: expected a ";"
/usr/include/c++/4.8/bits/exception_ptr.h(147): error: expected a ";"
/usr/include/c++/4.8/bits/exception_ptr.h(152): error: use of a local type to declare a function
/usr/include/c++/4.8/bits/exception_ptr.h(153): error: expected a ";"
/usr/include/c++/4.8/bits/exception_ptr.h(156): error: use of a local type to declare a function
/usr/include/c++/4.8/bits/exception_ptr.h(157): error: expected a ";"
/usr/include/c++/4.8/bits/exception_ptr.h(160): error: use of a local type to declare a function
/usr/include/c++/4.8/bits/exception_ptr.h(161): error: expected a ";"
/usr/include/c++/4.8/bits/exception_ptr.h(169): error: expected a ";"
/usr/include/c++/4.8/bits/nested_exception.h(57): error: incomplete type is not allowed
/usr/include/c++/4.8/bits/nested_exception.h(60): error: expected a ";"
/usr/include/c++/4.8/bits/nested_exception.h(66): error: expected a ";"
/usr/include/c++/4.8/bits/nested_exception.h(70): error: identifier "rethrow_exception" is undefined
/usr/include/c++/4.8/bits/nested_exception.h(73): error: function "std::nested_exception::nested_ptr" returns incomplete type "std::__exception_ptr::exception_ptr"
/usr/include/c++/4.8/new(95): error: expected a "{"
/usr/include/c++/4.8/new(110): error: identifier "__p" is undefined
/usr/include/c++/4.8/new(111): error: expected a "{"
/usr/include/c++/4.8/new(115): error: expected a "{"
/usr/include/c++/4.8/new(116): error: expected a "{"
/usr/local/cuda-6.5/include/common_functions.h(92): warning: exception specification is incompatible with that of previous function "operator new[](std::size_t, void *)"
/usr/include/c++/4.8/new(111): here
/usr/local/cuda-6.5/include/common_functions.h(93): warning: exception specification is incompatible with that of previous function "operator delete(void *, void *)"
/usr/include/c++/4.8/new(115): here
/usr/local/cuda-6.5/include/common_functions.h(94): warning: exception specification is incompatible with that of previous function "operator delete[](void *, void *)"
/usr/include/c++/4.8/new(116): here
/usr/include/c++/4.8/bits/cpp_type_traits.h(184): error: identifier "char16_t" is undefined
/usr/include/c++/4.8/bits/cpp_type_traits.h(191): error: identifier "char32_t" is undefined
/usr/include/c++/4.8/bits/cpp_type_traits.h(191): error: class "std::__is_integer<<error-type>>" has already been defined
/usr/include/c++/4.8/bits/cpp_type_traits.h(314): error: namespace "std::__gnu_cxx" has no member "__normal_iterator"
/usr/include/c++/4.8/bits/cpp_type_traits.h(314): error: expected a ">"
/usr/include/c++/4.8/cmath(80): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(80): error: expected a ";"
/usr/include/c++/4.8/cmath(105): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(105): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(105): error: expected a ";"
/usr/include/c++/4.8/cmath(124): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(124): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(124): error: expected a ";"
/usr/include/c++/4.8/cmath(143): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(143): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(143): error: expected a ";"
/usr/include/c++/4.8/cmath(162): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(162): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(162): error: expected a ";"
/usr/include/c++/4.8/cmath(183): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(183): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(183): error: expected a ";"
/usr/include/c++/4.8/cmath(202): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(202): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(202): error: expected a ";"
/usr/include/c++/4.8/cmath(221): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(221): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(221): error: expected a ";"
/usr/include/c++/4.8/cmath(240): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(240): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(240): error: expected a ";"
/usr/include/c++/4.8/cmath(259): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(259): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(259): error: expected a ";"
/usr/include/c++/4.8/cmath(278): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(278): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(278): error: expected a ";"
/usr/include/c++/4.8/cmath(297): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(297): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(297): error: expected a ";"
/usr/include/c++/4.8/cmath(328): error: "constexpr" is not a function or static data member
/usr/include/c++/4.8/cmath(337): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(337): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(337): error: expected a ";"
/usr/include/c++/4.8/cmath(356): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(356): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(356): error: expected a ";"
/usr/include/c++/4.8/cmath(375): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(375): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(375): error: expected a ";"
/usr/include/c++/4.8/cmath(406): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(406): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(406): error: expected a ";"
/usr/include/c++/4.8/cmath(443): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(443): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(443): error: expected a ";"
Error limit reached.
100 errors detected in the compilation of "/tmp/tmpxft_00004dfc_00000000-12_oceanFFT_kernel.compute_35.cpp1.ii".
Compilation terminated.
CMake Error at lbmslv_generated_oceanFFT_kernel.cu.o.cmake:264 (message):
Error generating file
/home/ubuntu/Documents/CUDA/bin/CMakeFiles/lbmslv.dir//./lbmslv_generated_oceanFFT_kernel.cu.o
make[2]: *** [CMakeFiles/lbmslv.dir/./lbmslv_generated_oceanFFT_kernel.cu.o] Error 1
make[1]: *** [CMakeFiles/lbmslv.dir/all] Error 2
make: *** [all] Error 2
ubuntu#tegra-ubuntu:~/Documents/CUDA/bin$
I've changed your CMakeLists.txt a little bit:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(lbmslv)
FIND_PACKAGE(CUDA REQUIRED)
FIND_PACKAGE(MPI REQUIRED)
FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE(FindCUDA)
# include every include directory
INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS} ${MPI_INCLUDE_PATH} ${MPI_INCLUDE_PATH} ${GLEW_INCLUDE_PATH})
FILE(GLOB SOURCES "*.cu" "*.cpp" "*.c" "*.h")
LIST(APPEND CMAKE_CXX_FLAGS "-std=c++0x -O3 -ffast-math -Wall")
LIST(APPEND CUDA_NVCC_FLAGS --compiler-options -fno-strict-aliasing -lineinfo -use_fast_math -Xptxas -dlcm=cg)
LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_20,code=sm_20)
LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_30,code=sm_30)
LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_35,code=sm_35)
CUDA_ADD_EXECUTABLE(lbmslv ${SOURCES})
# add every dependency to lbmslv
TARGET_LINK_LIBRARIES(lbmslv ${CUDA_LIBRARIES} ${MPI_LIBRARIES} ${OPENGL_LIBRARIES})