Compiling a program with an outdated gcc version
This is probably a very difficult information troubleshooting problem that I can practically provide, but I hope someone can at least point me in a possible direction.
I am trying to install HTK ( http://htk.eng.cam.ac.uk/ ), which according to this page should be installed using gcc 3.4. Their backward compatibility method is:
#yum install compat-gcc-34-c++ compat-gcc-34
won't work for me since I'm running Ubuntu (on this note, I take it I can't just install YUM and the subsequent package as it's a completely different distribution, but if I'm wrong I love hearing it).
Instead, I installed two versions of gcc 3.4 - 3.4.0 and 3.4.6 using the instructions from this site. Then I added the lines suggested by this page to the top of the makefile (in this note, what's the difference between makefile and makefile.in? I tried to add lines at the top of both files independently) as for version 3.4.0 and 3.4.6, but both refused. I also tried, no doubt, to compile it with my current version (4.4.1), but that also failed. I got 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
Thanks for any help you can provide.
a source to share
Thus, the presence of makefile.in indicates that the program is using autoconf. In this case, I suggest you put both makefile and makefile.in back as they were, and instead do the configuration step:
GCC_VERSION=3.4.0 PREFIX=/usr/local/gcc/${GCC_VERSION}/bin/ CC=${PREFIX}gcc CPP=${PREFIX}g++ ./configure
Obviously, you have to edit this to match the actual compiler version and the path where you installed it, as well as add any additional configuration arguments you need.
a source to share
Install gcc-3.4
from Ubuntu repositories ( sudo apt-get install gcc-4.3
).
Then configure the project with ./configure CC="gcc-4.3"
and proceed as usual.
It might not work, but point in the right direction.
EDIT: The X11 development libraries on Ubuntu are named libx11-dev
, but they may not be the only development libraries you are missing: read the errors and try to guess what other libraries you are missing (if you notice the title is missing try searching for http: // packages .ubuntu.com for filename and adding relative package with sudo apt-get install
).
a source to share
First set of errors:
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 cannot find X11 headers. They will probably be something like /usr/X11R6/include
. Try adding that include the path to your make command like
make CFLAGS="$CFLAGS -I/usr/X11R6/include"
If the makefile is non-standard, you might have to edit it to include this path. If you run your config script with
./configure CFLAGS="$CFLAGS -I/usr/X11R6/include" # Include any other options
a source to share