2010-05-06 62 views
2

这可能是一个非常难以解决的问题,我可以实际提供的信息,但我希望有人能够至少指出我可能的方向。使用旧版本的gcc编译程序

我试图安装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 

谢谢你的任何帮助,你可以提供。

回答

1

它在我看来你缺少X11开发包。

+0

谢谢,那就是麻烦,感觉相当愚蠢,但由于安装gcc的旧版本的复杂性,我认为一定是问题所在。 – wyatt 2010-05-06 14:23:42

0

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

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

这可能行不通,但指出你在正确的方向。

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

+0

恩,你需要在这里做一些更正吗? – bmargulies 2010-05-06 13:24:55

+0

Yups,谢谢:) – baol 2010-05-06 13:26:54

+0

试图安装gcc-3.4导致错误找不到包gcc-3.4,我猜测它太简单了。 – wyatt 2010-05-06 13:43:25

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

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

+0

我试过这个,但得到错误“C预处理器”#{PREFIX} g ++“无法进行完整性检查。我以为这是因为该程序是用C编写的,并删除了CPP =部分。它因此被配置,并且makefile包含了CC =/usr/local这行......(Makefile.in代替了CC = @ CC @这一行,但是因为几乎所有变量都是这样的,所以我认为它是一些但是,我得到了同样的错误,让我试着处理X11的问题,有些人已经提到过,看看怎么回事。 – wyatt 2010-05-06 13:42:49

+0

#{PREFIX} g ++是一个错字...应该是$ {PREFIX} g ++ – 2010-05-06 21:55:15

2

的第一个错误可能表示原因:

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

在设置$ INCLUDE_PATH海合会需要一次一个。

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 
1

配置脚本重新配置你确定你已经安装了X11-devel包?看起来像缺乏X11头文件。