Installing eggs in Chicken Scheme - scheme

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.

Related

Multiple Definitions and errors Cygwin?

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....

MacOS 10.12.6 Installing Perl Module WWW:Curl::Easy error in Availability.h

Check the errors,
I didn't install/reinstall the curl, It is installed by default on my OS
cpan WWW::Curl::Easy
Locating required external dependency bin:curl-config... found at /usr/bin/curl-config.
The version is libcurl 7.54.0
Found curl.h in /usr/include/curl/curl.h
In file included from /usr/include/curl/curl.h:38:
In file included from /usr/include/curl/curlbuild.h:145:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/inttypes.h:30:
In file included from /usr/include/inttypes.h:224:
In file included from /usr/include/Availability.h:190:
/usr/include/AvailabilityInternal.h:22938:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_12
^
/usr/include/AvailabilityInternal.h:22867:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11_4
^
/usr/include/AvailabilityInternal.h:22800:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11_3
^
/usr/include/AvailabilityInternal.h:22737:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11_2
^
/usr/include/AvailabilityInternal.h:22678:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11
^
/usr/include/AvailabilityInternal.h:22623:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10_3
^
/usr/include/AvailabilityInternal.h:22572:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10_2
^
/usr/include/AvailabilityInternal.h:22525:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10
^
/usr/include/AvailabilityInternal.h:22482:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_9
^
/usr/include/AvailabilityInternal.h:22443:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8
^
/usr/include/AvailabilityInternal.h:22408:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_7
^
/usr/include/AvailabilityInternal.h:22377:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_6
^
/usr/include/AvailabilityInternal.h:22350:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_5
^
/usr/include/AvailabilityInternal.h:22327:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_4
^
/usr/include/AvailabilityInternal.h:22308:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_3
^
/usr/include/AvailabilityInternal.h:22293:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_2
^
/usr/include/AvailabilityInternal.h:22282:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_1
^
/usr/include/AvailabilityInternal.h:30:2: error: unterminated conditional directive
#ifndef __AVAILABILITY_INTERNAL__
^
In file included from /usr/include/curl/curl.h:38:
In file included from /usr/include/curl/curlbuild.h:145:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/inttypes.h:30:
In file included from /usr/include/inttypes.h:224:
/usr/include/Availability.h:239:2: error: #else without #if
#else
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Building curlopt-constants.c for your libcurl version
Building Easy.pm constants for your libcurl version
Building Share.pm constants for your libcurl version
Checking if your kit is complete...
Looks good
Writing Makefile for WWW::Curl
Writing MYMETA.yml and MYMETA.json
cp lib/WWW/Curl/Easy.pm blib/lib/WWW/Curl/Easy.pm
cp lib/WWW/Curl.pm blib/lib/WWW/Curl.pm
cp lib/WWW/Curl/Form.pm blib/lib/WWW/Curl/Form.pm
cp lib/WWW/Curl/Share.pm blib/lib/WWW/Curl/Share.pm
cp lib/WWW/Curl/Multi.pm blib/lib/WWW/Curl/Multi.pm
/usr/bin/perl "-Iinc" /System/Library/Perl/5.18/ExtUtils/xsubpp -typemap /System/Library/Perl/5.18/ExtUtils/typemap -typemap typemap Curl.xs > Curl.xsc && mv Curl.xsc Curl.c
cc -c -I/usr/include -arch x86_64 -arch i386 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os -DVERSION=\"4.17\" -DXS_VERSION=\"4.17\" "-I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" Curl.c
In file included from Curl.xs:574:
./curlopt-constants.c:19:58: error: non-void function 'constant' should return a value [-Wreturn-type]
if (strEQ(name, "DID_MEMORY_FUNC_TYPEDEFS")) return CURL_DID_MEMORY_FUNC_TYPEDEFS;
^
./curlopt-constants.c:128:49: error: use of undeclared identifier 'CURL_STRICTER'
if (strEQ(name, "STRICTER")) return CURL_STRICTER;
^
./curlopt-constants.c:2051:44: warning: implicit conversion from 'unsigned long' to 'int' changes value from 18446744073709551599 to -17 [-Wconstant-conversion]
if (strEQ(name, "ANY")) return CURLAUTH_ANY;
~~~~~~ ^~~~~~~~~~~~
/usr/include/curl/curl.h:679:32: note: expanded from macro 'CURLAUTH_ANY'
#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE)
^~~~~~~~~~~~~~~~~~~
In file included from Curl.xs:574:
./curlopt-constants.c:2052:48: warning: implicit conversion from 'unsigned long' to 'int' changes value from 18446744073709551598 to -18 [-Wconstant-conversion]
if (strEQ(name, "ANYSAFE")) return CURLAUTH_ANYSAFE;
~~~~~~ ^~~~~~~~~~~~~~~~
/usr/include/curl/curl.h:680:32: note: expanded from macro 'CURLAUTH_ANYSAFE'
#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings and 2 errors generated.
make: *** [Curl.o] Error 1
SZBALINT/WWW-Curl-4.17.tar.gz
/usr/bin/make -- NOT OK
'YAML' not installed, will not store persistent state
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Tried using cpan install but always receive that error
I need help on what should I do, I don't have background in perl, I just need to run the regression and that module is required.
This is my first time to install a perl module because it is required in my regression file.
So it is not a very easy. But you can build it with some modification. I would also recommend installing a brewed perl instead of using the system perl
$ brew install perl
# Update the CPAN to latest
$ perl -MCPAN -e 'install Bundle::CPAN'
# Install Installer paackage
$ perl -MCPAN -e 'install Module::Install'
Now download the source code from below url
https://cpan.metacpan.org/authors/id/S/SZ/SZBALINT/WWW-Curl-4.17.tar.gz
Extract and it make two changes
Curl.c
#include "curlopt-constants.c"
to
#undef CURL_DID_MEMORY_FUNC_TYPEDEFS
#define CURL_DID_MEMORY_FUNC_TYPEDEFS 0
#include "curlopt-constants.c"
And then in Makefile.PL change
if($e =~ /(OBSOLETE|^CURL_EXTERN|_LAST\z|_LASTENTRY\z)/) {
to
if($e =~ /(OBSOLETE|^CURL_EXTERN|^CURL_STRICTER\z|_LAST\z|_LASTENTRY\z)/) {
And then run the make command in the downloaded folder
References
Failed to install WWW::Curl::Easy: SZBALINT/WWW-Curl-4.17.tar.gz : make NO
https://www.perlmonks.org/?node_id=1208670
https://www.perlmonks.org/?node_id=1208666
The following worked for me (perl 5, version 28, subversion 0 (v5.28.0) built for darwin-thread-multi-2level, XCode 9.4.1):
wget https://www.cpan.org/modules/by-module/WWW/WWW-Curl-4.17.tar.gz
tar zxvf WWW-Curl-4.17.tar.gz
cd WWW-Curl-4.17
cpan Module::Install
git apply cpp.patch
git apply stretch.patch
perl Makefile.PL
make
make install
cpp.patch (see: this SO answer):
diff --git a/Makefile.PL b/Makefile.PL
index f9170bb..124e5fd 100644
--- a/Makefile.PL
+++ b/Makefile.PL
## -100,7 +100,7 ## if (!defined($curl_h)) {
print "Found curl.h in $curl_h\n";
my #syms;
my $has_cpp = 0;
- open(H_IN, "-|", "cpp", $curl_h) and $has_cpp++;
+ open(H_IN, "-|", "cc -E", $curl_h) and $has_cpp++;
unless ($has_cpp) {
warn "No working cpp ($!). Parsing curl.h in Perl";
open(H_IN, "<", $curl_h) or die("Can't open curl.h at path $curl_h, because: ".$!);
stretch.patch (see this ticket):
From 292c05a8aa9c18bd27d0aaff0b4ee601d9b87b92 Mon Sep 17 00:00:00 2001
From: Slaven Rezic <cpansand#cvrsnica-freebsd-101.herceg.de>
Date: Sun, 16 Apr 2017 22:17:00 +0200
Subject: [PATCH] compilation fixes for curl 7.50.2 and newer (RT #117793)
---
Makefile.PL | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.PL b/Makefile.PL
index f9170bb..bb852e4 100644
--- a/Makefile.PL
+++ b/Makefile.PL
## -127,7 +127,7 ## if (!defined($curl_h)) {
close H;
for my $e (sort #syms) {
- if($e =~ /(OBSOLETE|^CURL_EXTERN|_LAST\z|_LASTENTRY\z)/) {
+ if($e =~ /(OBSOLETE|^CURL_EXTERN|^CURL_STRICTER\z|^CURL_DID_MEMORY_FUNC_TYPEDEFS\z|_LAST\z|_LASTENTRY\z)/) {
next;
}
my ($group) = $e =~ m/^([^_]+_)/;
--
2.1.2

When installing Artery on Ubuntu, building INET throws an unusual Error

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.

Create a CUDA/cpp makefile

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})

Can't compile flex & bison (Symbols not found x86_64)

I am trying to compile a simple program on Flex & Bison on my Mac running Yosemite but get the following error:
Undefined symbols for architecture x86_64:
"_yyerror", referenced from:
_yyparse in pr1-19c182.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My two files look like this, they compile on my teacher's Ubuntu installation but I can't get them to work on my Mac:
pr1.y
%{
#include <stdio.h>
%}
%%
expr : expr '+' term {printf(" + ");}
| term
;
term : term '*' fact {printf(" * ");}
| fact
;
fact : "(" expr ")"
| '0' {printf("0");}
| '1' {printf("1");}
| '2' {printf("2");}
| '3' {printf("3");}
| '4' {printf("4");}
| '5' {printf("5");}
| '6' {printf("6");}
| '7' {printf("7");}
| '8' {printf("8");}
| '9' {printf("9");}
%%
pr1.l
%{
#include "pr1.tab.h"
%}
%%
[0-9] {return (yytext[0]);}
[+*()] {return (yytext[0]);}
\n {return (0);}
. {}
%%
I compile everything using the following commands:
bison -d pr1.y
flex pr1.l
gcc -o result lex.yy.c pr1.tab.c -lfl -std=gnu89
The reason I use the -std flag is because the default is c99 and the code generated by flex and bison gets warnings and errors. Any ideas???
You need to define yyerror in your bison input file (pr1.y). And you need to declare yylex or you will get another warning.
The following would be fine:
%{
#include <stdio.h>
void yyerror(const char* msg) {
fprintf(stderr, "%s\n", msg);
}
int yylex();
%}
I have no idea how it works without that on your teacher's machine.
Also, Mac OS X has very old versions of bison and flex. You might want to upgrade.
Check out the 2nd comment of the answer on this post Unable to compile output of lex
On Mac OS X, if you're trying to compile from the command line, you need to link against the libl.a library, by using -ll instead of -lfl. Apparently OS X has no libfl.a library. So try this...
gcc -o result lex.yy.c pr1.tab.c -ll
Don't know about your need for the -std=gnu89 option.

Resources