使用旧版gcc编译程序

时间:2010-05-06 13:14:56

标签: c gcc ubuntu

使用我实际可以提供的信息进行故障排除可能是一个非常困难的问题,但我希望有人能够至少指出我可能的方向。

我正在尝试安装HTK(http://htk.eng.cam.ac.uk/),根据this页面需要使用gcc 3.4进行安装。他们实现向后兼容的方法:

#yum install compat-gcc-34-c++ compat-gcc-34

对我来说不起作用,因为我正在运行Ubuntu(在那个说明,我接受它我不能简单地安装YUM和后续包,因为它是一个完全不同的发行版,但如果我错了我'我喜欢听到它。)

我使用this网站的说明安装了两个版本的gcc 3.4 - 3.4.0和3.4.6。然后我将该页面建议的行添加到makefile的顶部(在这个注释中,makefile和makefile.in之间的区别是什么?我尝试将这些行添加到两个文件的顶部),版本3.4.0和3.4.6,但都失败了。我也尝试过,在机会上,用我当前的版本(4.4.1)编译它,但也失败了。我收到了错误:

(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

感谢您提供任何帮助。

6 个答案:

答案 0 :(得分:2)

第一个错误可能表明原因:

error: X11/Xlib.h: No such file or directory

有一次需要为gcc设置$ INCLUDE_PATH。

答案 1 :(得分:1)

因此,makefile.in的存在表明该程序正在使用autoconf。既然如此,我建议你把makefile和makefile.in放回原来的样子,而不是重做配置步骤:

GCC_VERSION=3.4.0 PREFIX=/usr/local/gcc/${GCC_VERSION}/bin/ CC=${PREFIX}gcc CPP=${PREFIX}g++ ./configure

显然,您应该编辑它以匹配编译器的实际版本和安装它的路径,以及添加所需的任何额外配置参数。

答案 2 :(得分:1)

在我看来,你错过了X11开发包。

答案 3 :(得分:1)

您确定已安装X11-devel软件包吗?看起来像是缺少X11头文件。

答案 4 :(得分:0)

从Ubuntu repos(gcc-3.4)安装sudo apt-get install gcc-4.3

然后使用./configure CC="gcc-4.3"配置项目并照常使用。

这可能不起作用,但请指出正确的方向。

编辑:Ubuntu上的X11开发库名为libx11-dev,但它们可能不是您唯一缺少的开发库:读取错误并尝试猜测您缺少的其他库(如果您注意到标头丢失尝试搜索http://packages.ubuntu.com以获取文件名,并使用sudo apt-get install添加相关包。

答案 5 :(得分:0)

第一组错误是

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

即。你的编译器找不到X11头文件。这些可能会像/usr/X11R6/include那样。尝试添加包含make命令的路径,例如

make CFLAGS="$CFLAGS -I/usr/X11R6/include"

如果makefile是非标准的,您可能需要编辑它以插入此路径。如果您使用

运行配置脚本重新配置
./configure CFLAGS="$CFLAGS -I/usr/X11R6/include" # Include any other options
相关问题