# [SOLVED] Kompilacja

## Fazi

Witam.

Mam pewien problem. Zainstalowałem wczoraj Gentoo z pomocą Gentoo Handbook. Po zainstalowaniu i skonfigurowaniu grub'a uruchomilem nowy system przy jego pomocy. Wszystko wydawałoby się ok gdyby nie to, że kiedy chciałem wprowadzić pewne zmiany w pliku konfiguracyjnym gruba, dostawałem błąd:

grub: cannot execute binary file

Postanowiłem przeinstalować program. Usunąłem go, lecz gdy chcę zainstalować ponownie dostaję błędy, które można obejrzeć w załączonym logu.

```
>>> Unpacking source...

>>> Unpacking grub-0.97.tar.gz to /var/tmp/portage/sys-boot/grub-0.97-r3/work

>>> Unpacking splash.xpm.gz to /var/tmp/portage/sys-boot/grub-0.97-r3/work

>>> Unpacking grub-0.97-patches-1.4.tar.bz2 to /var/tmp/portage/sys-boot/grub-0.97-r3/work

 [32;01m*[0m Applying various patches (bugfixes/updates) ...

 [32;01m*[0m   001_all_grub-0.95.20040823-splash.patch ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m   003_all_grub-0.97-example-rescue-shell.patch ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m   005_all_grub-0.96-PIC.patch ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m   008_all_grub-0.97-AM_PROG_AS.patch ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m   010_all_grub-0.96-bounced-checks.patch ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m   015_all_grub-0.96-unsigned-addresses.patch ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m   020_all_grub-0.97-i2o-raid.patch ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m   021_all_grub-0.97-grub-special_device_names.patch ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m   040_all_grub-0.96-nxstack.patch ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m   060_all_grub-0.96-netboot-pic.patch ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m   070_all_grub-0.97-initrd_max_address.patch ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m   080_all_grub-0.97-geometry-26kernel.patch ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m   090_all_grub-0.97-intelmac.patch ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m   100_all_grub-0.97-splashimage-example.patch ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m   110_all_grub-0.97-ptable-fix.patch ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m   500_all_grub-0.97-netboot-gcc4.patch ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m Done with patching

 [32;01m*[0m Running eautoreconf in '/var/tmp/portage/sys-boot/grub-0.97-r3/work/grub-0.97' ...

 [32;01m*[0m Running aclocal ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m Running autoconf ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m Running autoheader ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m Running automake --add-missing --copy ...

[A[72C  [34;01m[ [32;01mok[34;01m ][0m

>>> Source unpacked.

>>> Compiling source in /var/tmp/portage/sys-boot/grub-0.97-r3/work/grub-0.97 ...

 * econf: updating grub-0.97/config.guess with /usr/share/gnuconfig/config.guess

 * econf: updating grub-0.97/config.sub with /usr/share/gnuconfig/config.sub

./configure --prefix=/usr --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/lib --datadir=/usr/lib/grub --exec-prefix=/ --disable-auto-linux-mem-opt --build=x86_64-pc-linux-gnu

checking for a BSD-compatible install... /bin/install -c

checking whether build environment is sane... yes

checking for a thread-safe mkdir -p... /bin/mkdir -p

checking for gawk... gawk

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

checking whether the C compiler works... configure: error: cannot run C compiled programs.

If you meant to cross compile, use `--host'.

See `config.log' for more details.

!!! Please attach the following file when filing a report to bugs.gentoo.org:

!!! /var/tmp/portage/sys-boot/grub-0.97-r3/work/grub-0.97/config.log

!!! ERROR: sys-boot/grub-0.97-r3 failed.

Call stack:

  ebuild.sh, line 1638:   Called dyn_compile

  ebuild.sh, line 985:   Called qa_call 'src_compile'

  ebuild.sh, line 44:   Called src_compile

  grub-0.97-r3.ebuild, line 85:   Called econf '--libdir=/lib' '--datadir=/usr/lib/grub' '--exec-prefix=/' '--disable-auto-linux-mem-opt'

  ebuild.sh, line 586:   Called die

!!! econf failed

!!! If you need support, post the topmost build error, and the call stack if relevant.

!!! A complete build log is located at '/var/tmp/portage/sys-boot/grub-0.97-r3/temp/build.log'.
```

Last edited by Fazi on Mon Sep 17, 2007 11:13 am; edited 1 time in total

----------

## arturx

widzisz to ?

 *Quote:*   

> checking whether the C compiler works... configure: error: cannot run C compiled programs. 
> 
> If you meant to cross compile, use `--host'. 

 

nie stosowałeś przypadkiem kompilacji skrośnej ? 

zapodaj gcc-config -l i emerge --info

----------

## Fazi

gcc-config -l zwraca:

```
 [1] x86_64-pc-linux-gnu-4.1.1 [32;01m*[0m
```

Natomiast emerge --info zwraca:

```
Portage 2.1.2.12 (default-linux/amd64/2007.0/desktop, gcc-4.1.1, glibc-2.5-r0, 2.6.22-gentoo-r5 x86_64)

=================================================================

System uname: 2.6.22-gentoo-r5 x86_64 Intel(R) Core(TM)2 CPU          6300  @ 1.86GHz

Gentoo Base System release 1.12.9

Timestamp of tree: Fri, 14 Sep 2007 17:20:01 +0000

app-shells/bash:     3.1_p17

dev-lang/python:     2.4.3-r4

dev-python/pycrypto: 2.0.1-r6

sys-apps/baselayout: 1.12.9

sys-apps/sandbox:    1.2.17

sys-devel/autoconf:  2.61

sys-devel/automake:  1.9.6-r2, 1.10

sys-devel/binutils:  2.16.1-r3

sys-devel/gcc-config: 1.3.14

sys-devel/libtool:   1.5.22

virtual/os-headers:  2.6.17-r2

ACCEPT_KEYWORDS="amd64"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=nocona -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc"

CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/terminfo"

CXXFLAGS="-march=nocona -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="distlocks metadata-transfer sandbox sfperms strict"

GENTOO_MIRRORS="http://src.gentoo.pl "

MAKEOPTS="-j3"

PKGDIR="/usr/portage/packages"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"

USE="X acl acpi alsa amd64 arts berkdb bitmap-fonts cairo cdr cli cracklib crypt cups dbus dri dvd dvdr dvdread eds emboss encode esd evo fam firefox fortran gdbm gif gnome gpm gstreamer gtk hal iconv ipv6 isdnlog jpeg kde kerberos ldap mad midi mikmod mmx mp3 mpeg mudflap ncurses nls nptl nptlonly ogg opengl openmp oss pam pcre pdf perl png pppd python qt3 qt3support qt4 quicktime readline reflection sdl session spell spl sse sse2 ssl svg tcpd tiff truetype truetype-fonts type1-fonts unicode vorbis xml xorg xv zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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 route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i810 mach64 mga neomagic nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo"

Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
```

PS. Co to jest kompilacja skrośna?

----------

## arturx

to jest kompilacja skrośna http://www.gentoo.org/doc/pl/cross-compiling-distcc.xml

ale ok odstaw ja na bok. Nie u ciebie kumam tego :

```

System uname: 2.6.22-gentoo-r5 x86_64 Intel(R) Core(TM)2 CPU          6300  @ 1.86GHz 

(...)

ACCEPT_KEYWORDS="amd64" 

```

jaki w końcu masz procek ? intel czy amd ?

Sprawdż czy zainstalujesz gruba z ACCEPT_KEYWORDS="x86"

-------------------------------

korekta  :Wink: 

```
Na platformie IA64 program ładujący nosi nazwę elilo
```

http://www.gentoo.org/doc/pl/handbook/handbook-ia64.xml?part=1&chap=10

oraz

http://gentoo-wiki.com/Cpuinfo

tak czy siak problem leży w architekturze, bliższy intelowi jest x86 niż amd64. Pakiety i tak są kompilowane na 64 bity w/g flag CXXFLAGS i CFLAGS, jesli sie myle to poprawcie

----------

## Crenshaw

 *arturx wrote:*   

> to jest kompilacja skrośna http://www.gentoo.org/doc/pl/cross-compiling-distcc.xml
> 
> ale ok odstaw ja na bok. Nie u ciebie kumam tego :
> 
> ```
> ...

 

Nie siej dezinformacji :>   ACCEPT_KEYWORDS="amd64" jest jak najbardziej poprawne jak i zbedne (hint: wystarczy wlasciwy CHOST):>

edit:

przeczytalem make.conf kolegi powyzej i wyglada ok jak dla mnie... tfu tfu, to emerge --info bylo :>

----------

## Fazi

Więc co jest nie tak?

----------

## jabol

zrób:

```
echo '#include <stdio.h>

#include <stdlib.h>

int main(void){puts("OK"); exit(0);}' > test.c

gcc -o test test.c

./test
```

I zobaczymy gdzie się wywali

----------

## scyld

 *Fazi wrote:*   

> Więc co jest nie tak?

 Sprawdź czy masz włączone w kernelu:

```
Executable file formats / Emulations

    [*] IA32 Emulation

    <*>   IA32 a.out support
```

----------

## Fazi

 *scyld wrote:*   

>  *Fazi wrote:*   Więc co jest nie tak? Sprawdź czy masz włączone w kernelu:
> 
> ```
> Executable file formats / Emulations
> 
> ...

 

To jest to, o czym zapomniałem podczas konfiguracji jądra. Wszystko już ok.

Dziękuję wszystkim za zainteresowanie.

----------

## cla

Zamontuj /proc

----------

