LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2176|回复: 11

error: cannot run C compiled programs.

[复制链接]
发表于 2008-3-17 18:03:47 | 显示全部楼层 |阅读模式
以前一直都是用的x86,昨天帮人装系统(pentiumD+945),尝试用amd64.但是没装多久就碰到了这个问题。一个出在grub上,一个出在gcc上。

  1. checking for a BSD-compatible install... /usr/bin/install -c
  2. checking whether build environment is sane... yes
  3. checking for a thread-safe mkdir -p... /bin/mkdir -p
  4. checking for gawk... gawk
  5. checking whether make sets $(MAKE)... yes
  6. checking build system type... x86_64-pc-linux-gnu
  7. checking host system type... x86_64-pc-linux-gnu
  8. checking whether to enable maintainer-specific portions of Makefiles... no
  9. checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc
  10. checking for x86_64-pc-linux-gnu-gcc... (cached) x86_64-pc-linux-gnu-gcc
  11. checking for C compiler default output file name... a.out
  12. checking whether the C compiler works... configure: error: cannot run C compiled programs.
  13. If you meant to cross compile, use `--host'.
  14. See `config.log' for more details.
复制代码

我在gentoo的handbook上看到有说明讲amd64不能用grub,需要用grub-static,所以grub的问题还可以解决。但是gcc的问题我找了不少资料都没有什么解决办法。(forums.gentoo.org上有人说用 USE="multilib" FEATURES="-sandbox" emerge gcc,但是也不行)
我估计后面还会碰到这个问题(例如glib什么的),所以这个问题不解决amd64的系统估计弄不好了。
请问各位有没有相关的经历和解决办法。


附上 emerge --info

  1. localhost ~ # emerge --info
  2. Portage 2.1.4.4 (hardened/amd64/multilib, gcc-4.1.1, glibc-2.5-r0, 2.6.24-gentoo-r3 x86_64)
  3. =================================================================
  4. System uname: 2.6.24-gentoo-r3 x86_64 Intel(R) Pentium(R) D CPU 3.00GHz
  5. Timestamp of tree: Mon, 17 Mar 2008 02:30:01 +0000
  6. app-shells/bash:     3.2_p17-r1
  7. dev-lang/python:     2.4.4-r9
  8. dev-python/pycrypto: 2.0.1-r6
  9. sys-apps/baselayout: 1.12.9
  10. sys-apps/sandbox:    1.2.18.1-r2
  11. sys-devel/autoconf:  2.61-r1
  12. sys-devel/automake:  1.9.6-r2, 1.10
  13. sys-devel/binutils:  2.18-r1
  14. sys-devel/gcc-config: 1.4.0-r4
  15. sys-devel/libtool:   1.5.26
  16. virtual/os-headers:  2.6.23-r3
  17. ACCEPT_KEYWORDS="amd64"
  18. CBUILD="x86_64-pc-linux-gnu"
  19. CFLAGS="-O2 -march=nocona -pipe -fomit-frame-pointer"
  20. CHOST="x86_64-pc-linux-gnu"
  21. CONFIG_PROTECT="/etc /usr/share/X11/xkb"
  22. CONFIG_PROTECT_MASK="/etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"
  23. CXXFLAGS="-O2 -march=nocona -pipe -fomit-frame-pointer"
  24. DISTDIR="/usr/portage/distfiles"
  25. FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"
  26. GENTOO_MIRRORS="ftp://ftp3.tsinghua.edu.cn/mirror/gentoo"
  27. LINGUAS="zh_CN"
  28. MAKEOPTS="-j3"
  29. PKGDIR="/usr/portage/packages"
  30. PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
  31. PORTAGE_TMPDIR="/var/tmp"
  32. PORTDIR="/usr/portage"
  33. SYNC="rsync://rsync.gentoo.org/gentoo-portage"
  34. USE="X alsa amd64 apache2 avi berkdb cairo cjk cracklib crypt dvb ffmpeg firefox ftp gif glx gnome gtk gtk2 gtkhtml hardened iconv javascript jpeg justify mad midi mp3 mpeg mpeg4
  35. msn multilib mysql nls nptl nptlonly opengl oss pam pdf php pic png python qq quicktime readline rmvb ruby ssl svg tcpd tiff truetype unicode urandom usb wma xml xml2 xorg xv zl
  36. ib" ALSA_CARDS="intel8x0" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate r
  37. oute share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host aut
  38. hz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_
  39. magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="zh_CN" USERLAND="GNU" VIDEO_CARDS="i810"
  40. Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
复制代码
 楼主| 发表于 2008-3-17 18:18:24 | 显示全部楼层
以前只知道amd64很多东西不能用,不知道现在是不是还是这样?还是换回x86把
回复 支持 反对

使用道具 举报

发表于 2008-3-17 18:23:45 | 显示全部楼层
gcc-config -l
然后gcc-config **
换一个gcc,然后env-update && source /etc/profile
行吗?应该是编译器链接的问题……
回复 支持 反对

使用道具 举报

发表于 2008-3-17 18:26:57 | 显示全部楼层
grub可以在amd64用的.
应该还是别的地方的问题,看了你的emerge info倒是没发现可疑的地方.

  1. gcc-config  -l
复制代码

看看输出什么?
回复 支持 反对

使用道具 举报

发表于 2008-3-17 18:44:48 | 显示全部楼层
把 /usr/bin/x86_64-pc-linux-gnu-gcc 移走,再试试
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-3-17 20:01:51 | 显示全部楼层
localhost ~ # gcc-config -l
[1] x86_64-pc-linux-gnu-4.1.1 *
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-3-17 20:09:41 | 显示全部楼层
localhost bin # mv x86_64-pc-linux-gnu-gcc ~/

localhost bin # eselect profile list
Available profile symlink targets:
  [1]   default-linux/amd64/2006.1
  [2]   default-linux/amd64/2006.1/desktop
  [3]   default-linux/amd64/2006.0/no-symlinks
  [4]   default-linux/amd64/2006.1/no-multilib *
  [5]   default-linux/amd64/2007.0
  [6]   default-linux/amd64/2007.0/desktop
  [7]   default-linux/amd64/2007.0/no-multilib
  [8]   default-linux/amd64/2007.0/server
  [9]   hardened/amd64
  [10]  hardened/amd64/multilib
  [11]  selinux/2007.0/amd64
  [12]  selinux/2007.0/amd64/hardened
localhost bin # eselect profile set 10
localhost bin # env-update
>>> Regenerating /etc/ld.so.cache...
localhost bin # source /etc/profile
localhost bin # emerge grub
Calculating dependencies... done!
>>> Verifying ebuild Manifests...

>>> Emerging (1 of 1) sys-boot/grub-0.97-r4 to /
* grub-0.97-patches-1.4.tar.bz2 RMD160 SHA1 SHA256 size ;-) ...          [ ok ]
* grub-0.97.tar.gz RMD160 SHA1 SHA256 size ;-) ...                       [ ok ]
* splash.xpm.gz RMD160 SHA1 SHA256 size ;-) ...                          [ ok ]
* checking ebuild checksums ;-) ...                                      [ ok ]
checking whether make sets $(MAKE)... yes
.................................................
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking whether to enable maintainer-specific portions of Makefiles... no
checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc
checking for x86_64-pc-linux-gnu-gcc... (cached) x86_64-pc-linux-gnu-gcc
checking for C compiler default output file name... a.out
<color=red>checking whether the C compiler works... configure: error: cannot run C compiled programs.</color>
If you meant to cross compile, use `--host'.
See `config.log' for more details.

!!! Please attach the following file when seeking support:
!!! /var/tmp/portage/sys-boot/grub-0.97-r4/work/grub-0.97/config.log

gcc也是一样
..................................
回复 支持 反对

使用道具 举报

发表于 2008-3-17 21:38:08 | 显示全部楼层
回复 支持 反对

使用道具 举报

发表于 2008-3-17 22:04:55 | 显示全部楼层
把失败的config.log贴上来看看,到底是为什么出错,你可以自己手动按照里面写的步骤测试一下。
回复 支持 反对

使用道具 举报

发表于 2008-3-17 22:28:37 | 显示全部楼层
楼主是不是用了ccache-config了?我上次出现这问题是这原因……
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表