Compiling a program with a legacy version of gcc - c

This is probably a very difficult problem to troubleshoot with the information I can practically provide, but I'm hoping someone might be able to at least point me in a possible direction.
I'm trying to install HTK (http://htk.eng.cam.ac.uk/), which, according to this page needs to be installed using gcc 3.4. Their method of implementing backwards compatibility:
#yum install compat-gcc-34-c++ compat-gcc-34
won't work for me as I'm running Ubuntu (On that note, I take it I can't simply install YUM and the subsequent package, since it's an entirely different distro, but if I'm wrong I'd love to hear it).
I instead installed two versions of gcc 3.4 - 3.4.0 and 3.4.6 using instructions from this site. I then added the lines suggested by that page to the top of the makefile (on this note, what's the difference between makefile and makefile.in? I tried adding the lines to the top of both files regardless), both for version 3.4.0 and 3.4.6, but both failed. I also tried, on the off-chance, compiling it with my current version (4.4.1), but that also failed. I got the errors:
(cd HTKLib && make HTKLib.a) \
|| case "" in *k*) fail=yes;; *) exit 1;; esac;
make[1]: Entering directory `/home/charles/bin/htk-3.4/HTKLib'
gcc -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="i686"' -Wall -Wno-switch -g -O2 -I. -c -o HGraf.o HGraf.c
HGraf.c:73:77: error: X11/Xlib.h: No such file or directory
HGraf.c:74:23: error: X11/Xutil.h: No such file or directory
HGraf.c:75:21: error: X11/Xos.h: No such file or directory
HGraf.c:77:27: error: X11/keysymdef.h: No such file or directory
HGraf.c:87: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
HGraf.c:88: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rootW’
HGraf.c:91: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘theCmap’
HGraf.c:92: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘theGC’
HGraf.c:93: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘gcs’
HGraf.c:95: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
HGraf.c:96: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘report’
HGraf.c:97: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘hints’
HGraf.c:111: error: ‘GXcopy’ undeclared here (not in a function)
HGraf.c:111: error: ‘GXor’ undeclared here (not in a function)
HGraf.c:111: error: ‘GXxor’ undeclared here (not in a function)
HGraf.c:111: error: ‘GXinvert’ undeclared here (not in a function)
HGraf.c:151: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
HGraf.c: In function ‘InstallFonts’:
HGraf.c:164: error: ‘FontInfo’ undeclared (first use in this function)
HGraf.c:164: error: (Each undeclared identifier is reported only once
HGraf.c:164: error: for each function it appears in.)
HGraf.c:164: warning: implicit declaration of function ‘XLoadQueryFont’
HGraf.c:164: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:167: error: ‘DefaultFont’ undeclared (first use in this function)
HGraf.c: At top level:
HGraf.c:176: error: expected ‘)’ before ‘*’ token
HGraf.c: In function ‘HGetEvent’:
HGraf.c:219: error: ‘XEvent’ undeclared (first use in this function)
HGraf.c:219: error: expected ‘;’ before ‘xev’
HGraf.c:223: warning: implicit declaration of function ‘XFlush’
HGraf.c:223: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:225: warning: implicit declaration of function ‘XEventsQueued’
HGraf.c:225: error: ‘QueuedAfterFlush’ undeclared (first use in this function)
HGraf.c:226: warning: implicit declaration of function ‘XNextEvent’
HGraf.c:226: error: ‘xev’ undeclared (first use in this function)
HGraf.c:228: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:230: error: ‘ButtonPress’ undeclared (first use in this function)
HGraf.c:235: error: ‘ButtonRelease’ undeclared (first use in this function)
HGraf.c:240: error: ‘MotionNotify’ undeclared (first use in this function)
HGraf.c:245: error: ‘KeyPress’ undeclared (first use in this function)
HGraf.c:249: warning: implicit declaration of function ‘DecodeKeyPress’
HGraf.c:251: error: ‘KeyRelease’ undeclared (first use in this function)
HGraf.c:257: error: ‘Expose’ undeclared (first use in this function)
HGraf.c: In function ‘HEventsPending’:
HGraf.c:281: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:281: error: ‘QueuedAfterFlush’ undeclared (first use in this function)
HGraf.c: In function ‘HMousePos’:
HGraf.c:288: error: ‘Window’ undeclared (first use in this function)
HGraf.c:288: error: expected ‘;’ before ‘root’
HGraf.c:293: warning: implicit declaration of function ‘XQueryPointer’
HGraf.c:293: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:293: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:293: error: ‘root’ undeclared (first use in this function)
HGraf.c:293: error: ‘child’ undeclared (first use in this function)
HGraf.c: In function ‘InstallColours’:
HGraf.c:311: error: ‘XColor’ undeclared (first use in this function)
HGraf.c:311: error: expected ‘;’ before ‘greyDef’
HGraf.c:317: warning: implicit declaration of function ‘XParseColor’
HGraf.c:317: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:317: error: ‘theCmap’ undeclared (first use in this function)
HGraf.c:317: error: ‘colourDef’ undeclared (first use in this function)
HGraf.c:320: warning: implicit declaration of function ‘XAllocColor’
HGraf.c:334: error: ‘whiteDef’ undeclared (first use in this function)
HGraf.c:334: warning: implicit declaration of function ‘XQueryColor’
HGraf.c:335: error: ‘blackDef’ undeclared (first use in this function)
HGraf.c:341: error: ‘greyDef’ undeclared (first use in this function)
HGraf.c: In function ‘HSetColour’:
HGraf.c:361: warning: implicit declaration of function ‘XSetForeground’
HGraf.c:361: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:361: error: ‘gcs’ undeclared (first use in this function)
HGraf.c: In function ‘HSetGrey’:
HGraf.c:370: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:370: error: ‘gcs’ undeclared (first use in this function)
HGraf.c: In function ‘HDrawLines’:
HGraf.c:388: warning: implicit declaration of function ‘XDrawLines’
HGraf.c:388: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:388: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:388: error: ‘theGC’ undeclared (first use in this function)
HGraf.c:388: error: ‘XPoint’ undeclared (first use in this function)
HGraf.c:388: error: expected expression before ‘)’ token
HGraf.c: In function ‘HDrawRectangle’:
HGraf.c:395: warning: implicit declaration of function ‘XDrawRectangle’
HGraf.c:395: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:395: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:395: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HFillRectangle’:
HGraf.c:402: warning: implicit declaration of function ‘XFillRectangle’
HGraf.c:402: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:402: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:402: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HDrawLine’:
HGraf.c:408: warning: implicit declaration of function ‘XDrawLine’
HGraf.c:408: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:408: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:408: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HFillPolygon’:
HGraf.c:414: warning: implicit declaration of function ‘XFillPolygon’
HGraf.c:414: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:414: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:414: error: ‘theGC’ undeclared (first use in this function)
HGraf.c:414: error: ‘XPoint’ undeclared (first use in this function)
HGraf.c:414: error: expected expression before ‘)’ token
HGraf.c: In function ‘HDrawArc’:
HGraf.c:427: warning: implicit declaration of function ‘XDrawArc’
HGraf.c:427: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:427: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:427: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HFillArc’:
HGraf.c:440: warning: implicit declaration of function ‘XFillArc’
HGraf.c:440: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:440: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:440: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HPrintf’:
HGraf.c:451: warning: implicit declaration of function ‘XDrawString’
HGraf.c:451: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:451: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:451: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HCopyArea’:
HGraf.c:457: warning: implicit declaration of function ‘XCopyArea’
HGraf.c:457: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:457: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:457: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HPlotVector’:
HGraf.c:476: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:476: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:476: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HSetFontSize’:
HGraf.c:490: error: ‘CurrentFont’ undeclared (first use in this function)
HGraf.c:490: error: ‘DefaultFont’ undeclared (first use in this function)
HGraf.c:499: error: ‘FontInfo’ undeclared (first use in this function)
HGraf.c:502: warning: implicit declaration of function ‘XSetFont’
HGraf.c:502: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:502: error: ‘gcs’ undeclared (first use in this function)
HGraf.c: In function ‘HSetLineWidth’:
HGraf.c:511: warning: implicit declaration of function ‘XSetLineAttributes’
HGraf.c:511: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:511: error: ‘gcs’ undeclared (first use in this function)
HGraf.c:511: error: ‘LineSolid’ undeclared (first use in this function)
HGraf.c:511: error: ‘JoinRound’ undeclared (first use in this function)
HGraf.c:511: error: ‘FillSolid’ undeclared (first use in this function)
HGraf.c: In function ‘HSetXMode’:
HGraf.c:517: error: ‘theGC’ undeclared (first use in this function)
HGraf.c:517: error: ‘gcs’ undeclared (first use in this function)
HGraf.c: In function ‘CentreX’:
HGraf.c:523: warning: implicit declaration of function ‘XTextWidth’
HGraf.c:523: error: ‘CurrentFont’ undeclared (first use in this function)
HGraf.c: In function ‘CentreY’:
HGraf.c:529: error: ‘CurrentFont’ undeclared (first use in this function)
HGraf.c: In function ‘HTextWidth’:
HGraf.c:535: error: ‘CurrentFont’ undeclared (first use in this function)
HGraf.c: In function ‘HTextHeight’:
HGraf.c:541: error: ‘CurrentFont’ undeclared (first use in this function)
HGraf.c: In function ‘HDrawImage’:
HGraf.c:550: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
HGraf.c:550: error: ‘xi’ undeclared (first use in this function)
HGraf.c:557: warning: implicit declaration of function ‘XDestroyImage’
HGraf.c:558: warning: implicit declaration of function ‘XGetImage’
HGraf.c:558: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:558: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:558: error: ‘AllPlanes’ undeclared (first use in this function)
HGraf.c:558: error: ‘XYPixmap’ undeclared (first use in this function)
HGraf.c:562: warning: implicit declaration of function ‘XPutPixel’
HGraf.c:564: warning: implicit declaration of function ‘XPutImage’
HGraf.c:564: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HFlush’:
HGraf.c:570: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c: In function ‘InitGCs’:
HGraf.c:780: error: ‘XGCValues’ undeclared (first use in this function)
HGraf.c:780: error: expected ‘;’ before ‘values’
HGraf.c:783: error: ‘GCLineWidth’ undeclared (first use in this function)
HGraf.c:783: error: ‘GCFunction’ undeclared (first use in this function)
HGraf.c:783: error: ‘GCForeground’ undeclared (first use in this function)
HGraf.c:785: error: ‘values’ undeclared (first use in this function)
HGraf.c:788: error: ‘gcs’ undeclared (first use in this function)
HGraf.c:788: warning: implicit declaration of function ‘XCreateGC’
HGraf.c:788: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:788: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:790: error: ‘GCPlaneMask’ undeclared (first use in this function)
HGraf.c: In function ‘InitGlobals’:
HGraf.c:800: warning: implicit declaration of function ‘DefaultScreen’
HGraf.c:800: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:801: error: ‘theCmap’ undeclared (first use in this function)
HGraf.c:801: warning: implicit declaration of function ‘DefaultColormap’
HGraf.c:802: error: ‘rootW’ undeclared (first use in this function)
HGraf.c:802: warning: implicit declaration of function ‘RootWindow’
HGraf.c:803: error: ‘theGC’ undeclared (first use in this function)
HGraf.c:803: warning: implicit declaration of function ‘DefaultGC’
HGraf.c:804: error: ‘theVisual’ undeclared (first use in this function)
HGraf.c:804: warning: implicit declaration of function ‘DefaultVisual’
HGraf.c:805: warning: implicit declaration of function ‘DisplayCells’
HGraf.c:806: warning: implicit declaration of function ‘DisplayWidth’
HGraf.c:807: warning: implicit declaration of function ‘DisplayHeight’
HGraf.c:808: warning: implicit declaration of function ‘DisplayPlanes’
HGraf.c:809: warning: implicit declaration of function ‘WhitePixel’
HGraf.c:810: warning: implicit declaration of function ‘BlackPixel’
HGraf.c: In function ‘MakeXGraf’:
HGraf.c:817: error: ‘Window’ undeclared (first use in this function)
HGraf.c:817: error: expected ‘;’ before ‘window’
HGraf.c:818: error: ‘XSetWindowAttributes’ undeclared (first use in this function)
HGraf.c:818: error: expected ‘;’ before ‘setwinattr’
HGraf.c:823: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:823: warning: implicit declaration of function ‘XOpenDisplay’
HGraf.c:824: warning: implicit declaration of function ‘XDisplayName’
HGraf.c:828: error: ‘parent’ undeclared (first use in this function)
HGraf.c:829: error: ‘window’ undeclared (first use in this function)
HGraf.c:829: warning: implicit declaration of function ‘XCreateSimpleWindow’
HGraf.c:831: error: ‘CWBackingStore’ undeclared (first use in this function)
HGraf.c:831: error: ‘setwinattr’ undeclared (first use in this function)
HGraf.c:831: error: ‘WhenMapped’ undeclared (first use in this function)
HGraf.c:832: warning: implicit declaration of function ‘XChangeWindowAttributes’
HGraf.c:834: error: ‘hints’ undeclared (first use in this function)
HGraf.c:834: error: ‘PPosition’ undeclared (first use in this function)
HGraf.c:834: error: ‘PSize’ undeclared (first use in this function)
HGraf.c:834: error: ‘PMaxSize’ undeclared (first use in this function)
HGraf.c:834: error: ‘PMinSize’ undeclared (first use in this function)
HGraf.c:841: warning: implicit declaration of function ‘XSetStandardProperties’
HGraf.c:841: error: ‘None’ undeclared (first use in this function)
HGraf.c:843: warning: implicit declaration of function ‘XSelectInput’
HGraf.c:843: error: ‘ExposureMask’ undeclared (first use in this function)
HGraf.c:843: error: ‘KeyPressMask’ undeclared (first use in this function)
HGraf.c:843: error: ‘ButtonPressMask’ undeclared (first use in this function)
HGraf.c:844: error: ‘ButtonReleaseMask’ undeclared (first use in this function)
HGraf.c:844: error: ‘PointerMotionHintMask’ undeclared (first use in this function)
HGraf.c:844: error: ‘PointerMotionMask’ undeclared (first use in this function)
HGraf.c:845: warning: implicit declaration of function ‘XMapWindow’
HGraf.c:845: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:850: error: ‘report’ undeclared (first use in this function)
HGraf.c:851: error: ‘Expose’ undeclared (first use in this function)
HGraf.c:852: warning: implicit declaration of function ‘XSendEvent’
HGraf.c:852: error: ‘False’ undeclared (first use in this function)
HGraf.c: In function ‘TermHGraf’:
HGraf.c:861: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:862: warning: implicit declaration of function ‘XCloseDisplay’
make[1]: *** [HGraf.o] Error 1
make[1]: Leaving directory `/home/charles/bin/htk-3.4/HTKLib'
make: *** [HTKLib/HTKLib.a] Error 1
Thank you for any help you can provide.

The very first error may indicate the cause:
error: X11/Xlib.h: No such file or directory
At one time one needed to set $INCLUDE_PATH for gcc.

It looks to me that you are missing the X11 development packages.

So, the presence of a makefile.in indicates that the program is using autoconf. That being the case, I suggest you put both the makefile and makefile.in back the way they were, and instead redo the configure step:
GCC_VERSION=3.4.0 PREFIX=/usr/local/gcc/${GCC_VERSION}/bin/ CC=${PREFIX}gcc CPP=${PREFIX}g++ ./configure
Obviously, you should edit that to match the actual version of the compiler and path where you installed it, along with adding any extra configure arguments you need.

Are you sure you have the X11-devel package installed? Looks like an abject lack of X11 header files.

The first set of errors is
HGraf.c:73:77: error: X11/Xlib.h: No such file or directory
HGraf.c:74:23: error: X11/Xutil.h: No such file or directory
HGraf.c:75:21: error: X11/Xos.h: No such file or directory
HGraf.c:77:27: error: X11/keysymdef.h: No such file or directory
i.e. your compiler can't find the X11 headers. These will probably be somewhere like /usr/X11R6/include. Try adding that include path to your make command, like
make CFLAGS="$CFLAGS -I/usr/X11R6/include"
If the makefile is nonstandard you might have to edit it to insert this path. If you've run a configure script reconfigure with
./configure CFLAGS="$CFLAGS -I/usr/X11R6/include" # Include any other options

Install the gcc-3.4 from Ubuntu repos (sudo apt-get install gcc-4.3).
Then configure the project using ./configure CC="gcc-4.3" and make as usual.
This might not work, but point you in the right direction.
EDIT: The X11 development libraries on Ubuntu are named libx11-dev but they might not be the only development libraries you are missing: read the errors and try to guess what other libraries you are missing (if you note that a header is missing try searching http://packages.ubuntu.com for the file name and add the relative package using sudo apt-get install).

Related

Undeclared variable error when compiling HPC Challenge Benchmark

I want to compile and run HPC Challenge benchmark on my server.
When I want to make hpcc-1.5.0 with mpicc compiler I get this error:
../../../../STREAM/stream.c:178:26: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘a’
static double * restrict a, * restrict b, * restrict c;
^
../../../../STREAM/stream.c: In function ‘checkSTREAMresults’:
../../../../STREAM/stream.c:263:16: error: ‘a’ undeclared (first use in this function)
if (fabs(a[j]/aj-1.0) > epsilon) {
^
../../../../STREAM/stream.c:263:16: note: each undeclared identifier is reported only once for each function it appears in
../../../../STREAM/stream.c:280:16: error: ‘b’ undeclared (first use in this function)
if (fabs(b[j]/bj-1.0) > epsilon) {
^
../../../../STREAM/stream.c:297:16: error: ‘c’ undeclared (first use in this function)
if (fabs(c[j]/cj-1.0) > epsilon) {
^
../../../../STREAM/stream.c: In function ‘computeSTREAMerrors’:
../../../../STREAM/stream.c: In function ‘HPCC_Stream’:
../../../../STREAM/stream.c: In function ‘tuned_STREAM_Copy’:
../../../../STREAM/stream.c: In function ‘tuned_STREAM_Scale’:
../../../../STREAM/stream.c: In function ‘tuned_STREAM_Add’:
../../../../STREAM/stream.c: In function ‘tuned_STREAM_Triad’:
make[1]: *** [../../../../STREAM/stream.o] Error 1
make[1]: Leaving directory `/root/hpcc-1.5.0/hpl/lib/arch/build'
make: *** [all] Error 2
It seems STREAM uses some variables that is not declared.
This is because of using restrict keywords for the array. To compile stream, you have to use -std=c99 option.
Add -std=c99 flag in your Make.$(arch) file in CCFLAGS section. Like this:
CCFLAGS = $(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops -std=c99
Source: https://anilmaurya.wordpress.com/2016/04/26/hpc-1-5-0-compile-time-error/

Error creating a class in C

I've some error on this class construction,
cwrapper.h
#include "SimpleCLM.h"
using namespace std;
using namespace cv;
class A{
public:
A();
~A();
met1();
};
void *A_init();
A_m1(void *p);
cwrapper.c
#include "cwrapper.h"
using namespace std;
using namespace cv;
void *A_init()
{
A *p = new A;
return (void *)p;
}
A_m1(void *p)
{
return p->met1();
}
A::met1()
{
return begin();
}
begin is a function in SimpleCLM.h.
Here is the errors on make,
In file included from /home/samuel/Desktop/matlab_cpp/cwrapper.h:1,
from /home/samuel/Desktop/matlab_cpp/cwrapper.c:1:
/home/samuel/Desktop/matlab_cpp/SimpleCLM.h:2: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘begin’
In file included from /home/samuel/Desktop/matlab_cpp/cwrapper.c:1:
/home/samuel/Desktop/matlab_cpp/cwrapper.h:3: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘namespace’
/home/samuel/Desktop/matlab_cpp/cwrapper.h:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘namespace’
/home/samuel/Desktop/matlab_cpp/cwrapper.h:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘A’
/home/samuel/Desktop/matlab_cpp/cwrapper.h:14: warning: data definition has no type or storage class
/home/samuel/Desktop/matlab_cpp/cwrapper.c:3: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘namespace’
/home/samuel/Desktop/matlab_cpp/cwrapper.c:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘namespace’
/home/samuel/Desktop/matlab_cpp/cwrapper.c: In function ‘A_init’:
/home/samuel/Desktop/matlab_cpp/cwrapper.c:8: error: ‘A’ undeclared (first use in this function)
/home/samuel/Desktop/matlab_cpp/cwrapper.c:8: error: (Each undeclared identifier is reported only once
/home/samuel/Desktop/matlab_cpp/cwrapper.c:8: error: for each function it appears in.)
/home/samuel/Desktop/matlab_cpp/cwrapper.c:8: error: ‘p’ undeclared (first use in this function)
/home/samuel/Desktop/matlab_cpp/cwrapper.c:8: error: ‘new’ undeclared (first use in this function)
/home/samuel/Desktop/matlab_cpp/cwrapper.c:8: error: expected ‘;’ before ‘A’
/home/samuel/Desktop/matlab_cpp/cwrapper.c: In function ‘A_m1’:
/home/samuel/Desktop/matlab_cpp/cwrapper.c:14: warning: dereferencing ‘void *’ pointer
/home/samuel/Desktop/matlab_cpp/cwrapper.c:14: error: request for member ‘met1’ in something not a structure or union
/home/samuel/Desktop/matlab_cpp/cwrapper.c: At top level:
/home/samuel/Desktop/matlab_cpp/cwrapper.c:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
make[2]: *** [CMakeFiles/cwrapper.dir/cwrapper.c.o] Error 1
make[1]: *** [CMakeFiles/cwrapper.dir/all] Error 2
make: *** [all] Error 2
It is impossible to create a class in C; you would have to tell the compiler somehow that you want to compile C++.

luasocket.c:20:17: error: lua.h: No such file or directory

I'm installing luasocket module for Lua, but I got the following error message:
[root#localhost local]# wget http://files.luaforge.net/releases/luasocket/luasocket/luasocket-2.0.2/luasocket-2.0.2.tar.gz
[root#localhost local]# tar zxvf luasocket-2.0.2.tar.gz
[root#localhost local]# cd luasocket-2.0.2
[root#localhost luasocket-2.0.2]# make && make install
cd src; make all
make[1]: Entering directory `/usr/local/luasocket-2.0.2/src'
gcc -DLUASOCKET_DEBUG -pedantic -Wall -O2 -fpic -c -o luasocket.o luasocket.c
luasocket.c:20:17: error: lua.h: No such file or directory
luasocket.c:21:21: error: lauxlib.h: No such file or directory
luasocket.c:24:24: error: compat-5.1.h: No such file or directory
In file included from luasocket.c:30:
luasocket.h:30: error: expected ‘)’ before ‘*’ token
In file included from luasocket.c:31:
auxiliar.h:37: error: expected ‘)’ before ‘*’ token
auxiliar.h:38: error: expected ‘)’ before ‘*’ token
auxiliar.h:39: error: expected ‘)’ before ‘*’ token
auxiliar.h:40: error: expected ‘)’ before ‘*’ token
auxiliar.h:41: error: expected ‘)’ before ‘*’ token
auxiliar.h:42: error: expected ‘)’ before ‘*’ token
auxiliar.h:43: error: expected ‘)’ before ‘*’ token
auxiliar.h:44: error: expected ‘)’ before ‘*’ token
auxiliar.h:45: error: expected ‘)’ before ‘*’ token
auxiliar.h:46: error: expected ‘)’ before ‘*’ token
In file included from luasocket.c:32:
except.h:33: error: expected ‘)’ before ‘*’ token
In file included from luasocket.c:33:
timeout.h:19: error: expected ‘)’ before ‘*’ token
timeout.h:26: error: expected ‘)’ before ‘*’ token
In file included from luasocket.c:34:
buffer.h:39: error: expected ‘)’ before ‘*’ token
buffer.h:41: error: expected ‘)’ before ‘*’ token
buffer.h:42: error: expected ‘)’ before ‘*’ token
buffer.h:43: error: expected ‘)’ before ‘*’ token
buffer.h:44: error: expected ‘)’ before ‘*’ token
In file included from luasocket.c:35:
inet.h:27: error: expected ‘)’ before ‘*’ token
inet.h:35: error: expected ‘)’ before ‘*’ token
inet.h:36: error: expected ‘)’ before ‘*’ token
In file included from luasocket.c:36:
tcp.h:34: error: expected ‘)’ before ‘*’ token
In file included from luasocket.c:37:
udp.h:31: error: expected ‘)’ before ‘*’ token
In file included from luasocket.c:38:
select.h:15: error: expected ‘)’ before ‘*’ token
luasocket.c:43: error: expected ‘)’ before ‘*’ token
luasocket.c:44: error: expected ‘)’ before ‘*’ token
luasocket.c:45: error: expected ‘)’ before ‘*’ token
luasocket.c:50: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mod’
luasocket.c:60: warning: ISO C does not allow extra ‘;’ outside of a function
luasocket.c:62: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘func’
luasocket.c:66: warning: ISO C does not allow extra ‘;’ outside of a function
luasocket.c:71: error: expected ‘)’ before ‘*’ token
luasocket.c:80: error: expected ‘)’ before ‘*’ token
luasocket.c:89: error: expected ‘)’ before ‘*’ token
luasocket.c:113: error: expected ‘)’ before ‘*’ token
make[1]: *** [luasocket.o] Error 1
make[1]: Leaving directory `/usr/local/luasocket-2.0.2/src'
make: *** [all] Error 2
Can anybody help me? thanks in advance :)
You will need to set LUAINC.
Since you didn't specify which OS you are using, I can't give you a
definitive answer what to set it to. On Debian, if you want to build
for Lua5.1, set it to -I/usr/include/lua5.1/
You can set the variable by editing config (which is included from
makefile) or by specifying it on the command line:
$ make LUAINC=-I/usr/include/lua5.1/
The recommended solution did not work for me using Alpine 3.4. In order to make it work in this environment I had to download the package and hack the following.
luasec-luasec-0.6/src/luasocket/usocket.h
/* TODO: ifdef the ALPINE #include <sys/poll.h> */
#include <poll.h>
Then changes to Makefile
# Inform the location to install the modules
LUAPATH ?= /usr/local/share/lua/5.1
LUACPATH ?= /usr/local/lib/lua/5.1
# Edit the lines below to inform new path, if necessary.
# Path below points to internal LuaSocket's help files.
LUAINCDIR = -I/usr/local/api-gateway/luajit/include/luajit-2.1
INC_PATH ?= -I/usr/include
LIB_PATH ?= -L/usr/lib
INCDIR = -I. $(LUAINCDIR) $(INC_PATH) <------ include new path
LIBDIR = -L./luasocket $(LIB_PATH)
Hope this helps if anyone else is stuck with this particular problem.

Installing FTDI device drivers on linux [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I was trying to install the Virtual COM drivers from FTDI (http://www.ftdichip.com/Drivers/VCP/Linux/ftdi_sio.tar.gz) on ubuntu 10.04.
I downloaded the file and tried to compile it. But it shows errors like these:
Can anybody tell me the reason?
I installed the linux kernel development packages
Below is the output of make.
I removed some parts because of the size limitation
sudo make
gcc -Wall -D__KERNEL__ -DMODULE -I/lib/modules/2.6.32-41-generic/build/include -D__SMP__ -DSMP -DMODVERSIONS -include /lib/modules/2.6.32-41-generic/build/include/linux/modversions.h -I/usr/src/linux-2.6.32-41-generic/drivers/usb/serial/ -O -c -o ftdi_sio.o ftdi_sio.c
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/kernel.h:11,
from ftdi_sio.c:251:
/lib/modules/2.6.32-41-generic/build/include/linux/linkage.h:5:25: error: asm/linkage.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/kernel.h:15,
from ftdi_sio.c:251:
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h:17:24: error: asm/bitops.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/kernel.h:15,
from ftdi_sio.c:251:
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h: In function ‘get_bitmask_order’:
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h:29: warning: implicit declaration of function ‘fls’
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h: In function ‘hweight_long’:
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h:45: warning: implicit declaration of function ‘hweight32’
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h:45: warning: implicit declaration of function ‘hweight64’
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h: In function ‘fls_long’:
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h:132: warning: implicit declaration of function ‘fls64’
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h: In function ‘__ffs64’:
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h:147: warning: implicit declaration of function ‘__ffs’
In file included from ftdi_sio.c:251:
/lib/modules/2.6.32-41-generic/build/include/linux/kernel.h:21:21: error: asm/bug.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/preempt.h:9,
from /lib/modules/2.6.32-41-generic/build/include/linux/spinlock.h:50,
from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:7,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:56:29: error: asm/thread_info.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/preempt.h:9,
from /lib/modules/2.6.32-41-generic/build/include/linux/spinlock.h:50,
from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:7,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:65: warning: ‘struct thread_info’ declared inside parameter list
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:65: warning: its scope is only this definition or declaration, which is probably not what you want
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: In function ‘set_ti_thread_flag’:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:67: warning: implicit declaration of function ‘set_bit’
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:67: error: dereferencing pointer to incomplete type
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:70: warning: ‘struct thread_info’ declared inside parameter list
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: In function ‘clear_ti_thread_flag’:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:72: warning: implicit declaration of function ‘clear_bit’
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:72: error: dereferencing pointer to incomplete type
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:75: warning: ‘struct thread_info’ declared inside parameter list
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: In function ‘test_and_set_ti_thread_flag’:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:77: warning: implicit declaration of function ‘test_and_set_bit’
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:77: error: dereferencing pointer to incomplete type
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:80: warning: ‘struct thread_info’ declared inside parameter list
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: In function ‘test_and_clear_ti_thread_flag’:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:82: warning: implicit declaration of function ‘test_and_clear_bit’
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:82: error: dereferencing pointer to incomplete type
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:85: warning: ‘struct thread_info’ declared inside parameter list
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: In function ‘test_ti_thread_flag’:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:87: warning: implicit declaration of function ‘test_bit’
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:87: error: dereferencing pointer to incomplete type
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/list.h:6,
from /lib/modules/2.6.32-41-generic/build/include/linux/preempt.h:11,
from /lib/modules/2.6.32-41-generic/build/include/linux/spinlock.h:50,
from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:7,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/prefetch.h:14:27: error: asm/processor.h: No such file or directory
/lib/modules/2.6.32-41-generic/build/include/linux/prefetch.h:15:23: error: asm/cache.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/preempt.h:11,
from /lib/modules/2.6.32-41-generic/build/include/linux/spinlock.h:50,
from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:7,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/list.h:7:24: error: asm/system.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:7,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/spinlock.h: In function ‘smp_mb__after_lock’:
/lib/modules/2.6.32-41-generic/build/include/linux/spinlock.h:137: warning: implicit declaration of function ‘smp_mb’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:7,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/spinlock.h:321:24: error: asm/atomic.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:9,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/wait.h:26:25: error: asm/current.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:15,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/seqlock.h: In function ‘write_seqlock’:
/lib/modules/2.6.32-41-generic/build/include/linux/seqlock.h:64: warning: implicit declaration of function ‘smp_wmb’
/lib/modules/2.6.32-41-generic/build/include/linux/seqlock.h: In function ‘read_seqbegin’:
/lib/modules/2.6.32-41-generic/build/include/linux/seqlock.h:93: warning: implicit declaration of function ‘cpu_relax’
/lib/modules/2.6.32-41-generic/build/include/linux/seqlock.h:96: warning: implicit declaration of function ‘smp_rmb’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/bitmap.h:8,
from /lib/modules/2.6.32-41-generic/build/include/linux/nodemask.h:95,
from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:16,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/string.h:21:24: error: asm/string.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:16,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/nodemask.h: In function ‘__first_node’:
/lib/modules/2.6.32-41-generic/build/include/linux/nodemask.h:239: warning: implicit declaration of function ‘find_first_bit’
/lib/modules/2.6.32-41-generic/build/include/linux/nodemask.h: In function ‘__next_node’:
/lib/modules/2.6.32-41-generic/build/include/linux/nodemask.h:245: warning: implicit declaration of function ‘find_next_bit’
/lib/modules/2.6.32-41-generic/build/include/linux/nodemask.h: In function ‘__first_unset_node’:
/lib/modules/2.6.32-41-generic/build/include/linux/nodemask.h:263: warning: implicit declaration of function ‘find_first_zero_bit’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:20:22: error: asm/page.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:353: error: expected specifier-qualifier-list before ‘atomic_long_t’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/notifier.h:13,
from /lib/modules/2.6.32-41-generic/build/include/linux/memory_hotplug.h:6,
from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:666,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/mutex.h: In function ‘mutex_is_locked’:
/lib/modules/2.6.32-41-generic/build/include/linux/mutex.h:118: warning: implicit declaration of function ‘atomic_read’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/notifier.h:14,
from /lib/modules/2.6.32-41-generic/build/include/linux/memory_hotplug.h:6,
from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:666,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/rwsem.h:22:65: error: asm/rwsem.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/memory_hotplug.h:6,
from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:666,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/notifier.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/notifier.h:62: error: field ‘rwsem’ has incomplete type
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h: In function ‘populated_zone’:
/lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:699: error: ‘struct zone’ has no member named ‘present_pages’
/lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h: In function ‘is_normal’:
/lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:748: error: ‘struct zone’ has no member named ‘zone_pgdat’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:7,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/topology.h:34:26: error: asm/topology.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/mmdebug.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:8,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/autoconf.h:991:1: warning: "CONFIG_NR_CPUS" redefined
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:12,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/threads.h:16:1: warning: this is the location of the previous definition
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h: In function ‘allocflags_to_migratetype’:
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:121: warning: implicit declaration of function ‘WARN_ON’
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h: In function ‘gfp_zone’:
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:219: error: ‘ZONE_DMA’ undeclared (first use in this function)
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:219: error: (Each undeclared identifier is reported only once
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:219: error: for each function it appears in.)
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:219: error: ‘ZONE_HIGHMEM’ undeclared (first use in this function)
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h: In function ‘alloc_pages_node’:
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:284: warning: implicit declaration of function ‘cpu_to_node’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/time.h:9,
from /lib/modules/2.6.32-41-generic/build/include/linux/ktime.h:24,
from /lib/modules/2.6.32-41-generic/build/include/linux/timer.h:5,
from /lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h:8,
from /lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:11,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:162,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/math64.h:5:23: error: asm/div64.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/time.h:9,
from /lib/modules/2.6.32-41-generic/build/include/linux/ktime.h:24,
from /lib/modules/2.6.32-41-generic/build/include/linux/timer.h:5,
from /lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h:8,
from /lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:11,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:162,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/math64.h: In function ‘div_u64_rem’:
/lib/modules/2.6.32-41-generic/build/include/linux/math64.h:43: warning: implicit declaration of function ‘do_div’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:8,
from /lib/modules/2.6.32-41-generic/build/include/linux/ktime.h:25,
from /lib/modules/2.6.32-41-generic/build/include/linux/timer.h:5,
from /lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h:8,
from /lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:11,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:162,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/timex.h:170:23: error: asm/timex.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/ktime.h:25,
from /lib/modules/2.6.32-41-generic/build/include/linux/timer.h:5,
from /lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h:8,
from /lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:11,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:162,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:11,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:162,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h:26: error: expected specifier-qualifier-list before ‘atomic_long_t’
/lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h: In function ‘cancel_delayed_work’:
/lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h:240: error: ‘struct work_struct’ has no member named ‘data’
/lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h: In function ‘__cancel_delayed_work’:
/lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h:255: error: ‘struct work_struct’ has no member named ‘data’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/kmemtrace.h:12,
from /lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:13,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:162,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/trace/events/kmem.h: In function ‘trace_kmalloc’:
/lib/modules/2.6.32-41-generic/build/include/trace/events/kmem.h:47: warning: implicit declaration of function ‘smp_read_barrier_depends’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:162,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:53: error: expected specifier-qualifier-list before ‘atomic_long_t’
/lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:142: error: ‘PAGE_SHIFT’ undeclared here (not in a function)
/lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h: In function ‘kmalloc_large’:
/lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:232: warning: implicit declaration of function ‘get_order’
/lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:236: error: ‘PAGE_SIZE’ undeclared (first use in this function)
/lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h: In function ‘kmalloc’:
/lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:246: error: ‘PAGE_SIZE’ undeclared (first use in this function)
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/fs.h:369,
from /lib/modules/2.6.32-41-generic/build/include/linux/tty.h:9,
from ftdi_sio.c:255:
/lib/modules/2.6.32-41-generic/build/include/linux/dcache.h: In function ‘dget’:
/lib/modules/2.6.32-41-generic/build/include/linux/dcache.h:336: warning: implicit declaration of function ‘BUG_ON’
/lib/modules/2.6.32-41-generic/build/include/linux/dcache.h:337: warning: implicit declaration of function ‘atomic_inc’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/fs.h:470,
from /lib/modules/2.6.32-41-generic/build/include/linux/tty.h:9,
from ftdi_sio.c:255:
/lib/modules/2.6.32-41-generic/build/include/linux/quota.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/quota.h:384: error: field ‘dqptr_sem’ has incomplete type
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/tty.h:9,
from ftdi_sio.c:255:
/lib/modules/2.6.32-41-generic/build/include/linux/fs.h:748: error: field ‘i_alloc_sem’ has incomplete type
/lib/modules/2.6.32-41-generic/build/include/linux/fs.h:926: error: expected specifier-qualifier-list before ‘atomic_long_t’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/tty.h:9,
from ftdi_sio.c:255:
/lib/modules/2.6.32-41-generic/build/include/linux/fs.h:1337: error: field ‘s_umount’ has incomplete type
/lib/modules/2.6.32-41-generic/build/include/linux/fs.h: In function ‘file_accessed’:
/lib/modules/2.6.32-41-generic/build/include/linux/fs.h:1738: error: ‘struct file’ has no member named ‘f_flags’
/lib/modules/2.6.32-41-generic/build/include/linux/fs.h: In function ‘put_write_access’:
/lib/modules/2.6.32-41-generic/build/include/linux/fs.h:2130: warning: implicit declaration of function ‘atomic_dec’
In file included from /usr/include/asm/termios.h:1,
from /lib/modules/2.6.32-41-generic/build/include/linux/termios.h:5,
from /lib/modules/2.6.32-41-generic/build/include/linux/tty.h:11,
from ftdi_sio.c:255:
/lib/modules/2.6.32-41-generic/build/include/asm-generic/termios.h:51:25: error: asm/uaccess.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/module.h:14,
from ftdi_sio.c:258:
/lib/modules/2.6.32-41-generic/build/include/linux/elf.h:7:21: error: asm/elf.h: No such file or directory
In file included from ftdi_sio.c:258:
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:20:23: error: asm/local.h: No such file or directory
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:21:24: error: asm/module.h: No such file or directory
In file included from ftdi_sio.c:258:
/lib/modules/2.6.32-41-generic/build/include/linux/module.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:302: error: field ‘arch’ has incomplete type
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:319: error: expected specifier-qualifier-list before ‘Elf_Sym’
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:455: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/lib/modules/2.6.32-41-generic/build/include/linux/module.h: In function ‘__module_get’:
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:470: warning: implicit declaration of function ‘local_inc’
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:470: warning: implicit declaration of function ‘__module_ref_addr’
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:472: warning: implicit declaration of function ‘local_read’
In file included from ftdi_sio.c:258:
/lib/modules/2.6.32-41-generic/build/include/linux/module.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:712: warning: type defaults to ‘int’ in declaration of ‘Elf_Ehdr’
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:712: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/usb.h:14,
from ftdi_sio.c:261:
/lib/modules/2.6.32-41-generic/build/include/linux/delay.h:14:23: error: asm/delay.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/usb.h:14,
from ftdi_sio.c:261:
/lib/modules/2.6.32-41-generic/build/include/linux/delay.h: In function ‘ndelay’:
/lib/modules/2.6.32-41-generic/build/include/linux/delay.h:39: warning: implicit declaration of function ‘udelay’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/interrupt.h:12,
from /lib/modules/2.6.32-41-generic/build/include/linux/usb.h:15,
from ftdi_sio.c:261:
/lib/modules/2.6.32-41-generic/build/include/linux/hardirq.h:10:25: error: asm/hardirq.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/interrupt.h:13,
from /lib/modules/2.6.32-41-generic/build/include/linux/usb.h:15,
from ftdi_sio.c:261:
/lib/modules/2.6.32-41-generic/build/include/linux/irqflags.h:57:26: error: asm/irqflags.h: No such file or directory
I'm thinking your missing the asm symlink. I didn't go through everything, but a lot of these errors are missing "asm/XXXX.h".
Let's take a look at the first error. Check your include directory in your kernel:
#/usr/src/linux/include> ls
In this directory you should have a "linux" directory, which should contain linkage.h. Opening this we see:
#include <asm/linkage.h>
So it's looking for an "asm" directory in /usr/src/linux/include. Do you have on there? Is it pointing at the correct architecture for your system? Here's the top of my linux/include
mike#linux-4puc:/usr/src/linux/include> ls -l
total 120
drwxr-xr-x 3 root root 4096 Aug 1 10:51 acpi
lrwxrwxrwx 1 root root 47 Aug 1 12:08 asm -> /usr/src/linux-3.1.10-1.16/arch/x86/include/asm
My system didn't originally have this symlink so I had to add it in when I started via:
mike#linux-4puc:/usr/src/linux/include> ln -s /usr/src/linux-3.1.10-1.16/arch/x86/include/asm asm

error: ‘CODEC_TYPE_AUDIO’ undeclared when make m3u8-segmenter

I want to make m3u8-segmenter for Http Live Stream: https://github.com/johnf/m3u8-segmenter
There are errors when I make, the errors are:
gcc -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast -Wwrite-strings -Werror m3u8-segmenter.c -o m3u8-segmenter -lavformat -lavcodec -lavutil
m3u8-segmenter.c: In function ‘add_output_stream’:
m3u8-segmenter.c:82:14: error: ‘CODEC_TYPE_AUDIO’ undeclared (first use in this function)
m3u8-segmenter.c:82:14: note: each undeclared identifier is reported only once for each function it appears in
m3u8-segmenter.c:94:14: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
m3u8-segmenter.c: In function ‘main’:
m3u8-segmenter.c:338:5: error: ‘av_open_input_file’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1090) [-Werror=deprecated-declarations]
m3u8-segmenter.c:352:5: error: implicit declaration of function ‘guess_format’ [-Werror=implicit-function-declaration]
m3u8-segmenter.c:352:5: error: nested extern declaration of ‘guess_format’ [-Werror=nested-externs]
m3u8-segmenter.c:352:10: error: assignment makes pointer from integer without a cast [-Werror]
m3u8-segmenter.c:371:18: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
m3u8-segmenter.c:376:18: error: ‘CODEC_TYPE_AUDIO’ undeclared (first use in this function)
m3u8-segmenter.c:387:5: error: ‘av_set_parameters’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1434) [-Werror=deprecated-declarations]
m3u8-segmenter.c:392:5: error: ‘dump_format’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1559) [-Werror=deprecated-declarations]
m3u8-segmenter.c:406:5: error: ‘url_fopen’ is deprecated (declared at /usr/local/include/libavformat/avio.h:279) [-Werror=deprecated-declarations]
m3u8-segmenter.c:411:5: error: ‘av_write_header’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1492) [-Werror=deprecated-declarations]
m3u8-segmenter.c:444:67: error: ‘PKT_FLAG_KEY’ undeclared (first use in this function)
m3u8-segmenter.c:455:13: error: ‘put_flush_packet’ is deprecated (declared at /usr/local/include/libavformat/avio.h:293) [-Werror=deprecated-declarations]
m3u8-segmenter.c:456:13: error: ‘url_fclose’ is deprecated (declared at /usr/local/include/libavformat/avio.h:280) [-Werror=deprecated-declarations]
m3u8-segmenter.c:476:13: error: ‘url_fopen’ is deprecated (declared at /usr/local/include/libavformat/avio.h:279) [-Werror=deprecated-declarations]
m3u8-segmenter.c:482:13: error: ‘av_write_header’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1492) [-Werror=deprecated-declarations]
m3u8-segmenter.c:514:5: error: ‘url_fclose’ is deprecated (declared at /usr/local/include/libavformat/avio.h:280) [-Werror=deprecated-declarations]
cc1: all warnings being treated as errors
make: *** [all] Error 1
You're getting those errors because for some reason, this block in libav_compat.h took effect:
/* Support older versions of ffmpeg and libav */
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 64, 0)
#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
#define AV_PKT_FLAG_KEY PKT_FLAG_KEY
#endif
But whichever headers are supposed to define CODEC_TYPE_AUDIO and CODEC_TYPE_VIDEO don't. From the comment there, it looks like you probably should update your other software (ffmpeg and/or libav) and then try again.

Resources