[SOLVED]Problems with i686-elf-gcc

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
bashcommando
Member
Member
Posts: 62
Joined: Mon Jan 06, 2014 4:23 pm

[SOLVED]Problems with i686-elf-gcc

Post by bashcommando »

Hello again, I am having problems with my cross-compiled version of gcc. Just like the tutorial I cross-compiled gcc and binutils(and had to build some packages from the source). Whenever I try to compile something with it it says it that ld can not find certain files and the build fails. Any help? I am currently using GNU/Linux(Pinguy 14.04) and I don't know what to do. :D Please help?
Last edited by bashcommando on Wed Jan 21, 2015 4:25 pm, edited 1 time in total.
Building an operating system is like building an airplane, you don't want it to crash.
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Problems with i686-elf-gcc

Post by gerryg400 »

bashcommando wrote:Hello again, I am having problems with my cross-compiled version of gcc. Just like the tutorial I cross-compiled gcc and binutils(and had to build some packages from the source). Whenever I try to compile something with it it says it that ld can not find certain files and the build fails. Any help? I am currently using GNU/Linux(Pinguy 14.04) and I don't know what to do. :D Please help?
Please read your post. Do you really think that there is enough information there to guarantee that someone can provide constructive help ?

Hint: The answer is not "Yes".
If a trainstation is where trains stop, what is a workstation ?
User avatar
bashcommando
Member
Member
Posts: 62
Joined: Mon Jan 06, 2014 4:23 pm

Re: Problems with i686-elf-gcc

Post by bashcommando »

gerryg400 wrote:
bashcommando wrote:Hello again, I am having problems with my cross-compiled version of gcc. Just like the tutorial I cross-compiled gcc and binutils(and had to build some packages from the source). Whenever I try to compile something with it it says it that ld can not find certain files and the build fails. Any help? I am currently using GNU/Linux(Pinguy 14.04) and I don't know what to do. :D Please help?
Please read your post. Do you really think that there is enough information there to guarantee that someone can provide constructive help ?

Hint: The answer is not "Yes".
I don't need the hint, what else can I provide? Oh wait, I am using gcc 4.9.2, binutils 2.25 and here is a error log(I got a different error this time):

Code: Select all

/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 3 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 4 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 5 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 6 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 7 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 8 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 9 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 10 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 11 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 12 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 13 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 14 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 15 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 16 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 17 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 18 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 19 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 20 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 21 has invalid symbol index 22
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_line): relocation 0 has invalid symbol index 2
/usr/lib/gcc/i686-linux-gnu/4.8/../../../i386-linux-gnu/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: error: ld returned 1 exit status
Did that help?
Building an operating system is like building an airplane, you don't want it to crash.
ExeTwezz
Member
Member
Posts: 104
Joined: Sun Sep 21, 2014 7:16 am
Libera.chat IRC: exetwezz

Re: Problems with i686-elf-gcc

Post by ExeTwezz »

bashcommando wrote:

Code: Select all

/usr/lib/gcc/i686-linux-gnu/4.8/../../../i386-linux-gnu/crt1.o: In function `_start':
Did you compile with

Code: Select all

-ffreestanding
?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Problems with i686-elf-gcc

Post by Combuster »

cross-compiler
Why is the only instance of "elf" in the thread title, and everything else "linux-gnu"? There's no cross-compiler involved anywhere.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
iansjack
Member
Member
Posts: 4707
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Problems with i686-elf-gcc

Post by iansjack »

Minimalism is all very well in its place, but you are still not providing enough information. At the least we need to know the contents of your $PATH variable and the command line that you are using to compile your program. The fact that it is trying to link against your normal library files rather than the cross-compiler ones indicates some fairly fundamental mistake.

Also note that whatever you are trying to compile does not contain a "main" function which C assumes exists (crt1.o will call it) unless you tell it otherwise. What are you trying to compile? A kernel, a user program, a library, or what?
User avatar
bashcommando
Member
Member
Posts: 62
Joined: Mon Jan 06, 2014 4:23 pm

Re: Problems with i686-elf-gcc

Post by bashcommando »

Combuster wrote:
cross-compiler
Why is the only instance of "elf" in the thread title, and everything else "linux-gnu"? There's no cross-compiler involved anywhere.
ExeTwezz wrote:
bashcommando wrote:

Code: Select all

/usr/lib/gcc/i686-linux-gnu/4.8/../../../i386-linux-gnu/crt1.o: In function `_start':
Did you compile with

Code: Select all

-ffreestanding
?
Thanks for replying, no I didn't compile it with -ffreestanding and yes I am using a cross-compiler. It is located in ~/opt/cross/bin/i686-elf-gcc.
iansjack wrote:Minimalism is all very well in its place, but you are still not providing enough information. At the least we need to know the contents of your $PATH variable and the command line that you are using to compile your program. The fact that it is trying to link against your normal library files rather than the cross-compiler ones indicates some fairly fundamental mistake.

Also note that whatever you are trying to compile does not contain a "main" function which C assumes exists (crt1.o will call it) unless you tell it otherwise. What are you trying to compile? A kernel, a user program, a library, or what?
A program to test if it would work, my path was just like it said in the tutorial.

Code: Select all

void main() {
    asm volatile("nop");
}
And sorry again for being a noob. OS development is confusing, I will try to read a lot more of the wiki and search ddg before posting my next question.
Building an operating system is like building an airplane, you don't want it to crash.
User avatar
bashcommando
Member
Member
Posts: 62
Joined: Mon Jan 06, 2014 4:23 pm

Re: Problems with i686-elf-gcc

Post by bashcommando »

ExeTwezz wrote:
bashcommando wrote:

Code: Select all

/usr/lib/gcc/i686-linux-gnu/4.8/../../../i386-linux-gnu/crt1.o: In function `_start':
Did you compile with

Code: Select all

-ffreestanding
?
So I compiled with -ffreestanding and it gave me the error I had before:

Code: Select all

ffreestanding
/home/bashcommando/opt/cross/lib/gcc/i686-elf/4.9.2/../../../../i686-elf/bin/ld: cannot find crt0.o: No such file or directory
/home/bashcommando/opt/cross/lib/gcc/i686-elf/4.9.2/../../../../i686-elf/bin/ld: cannot find crtbegin.o: No such file or directory
/home/bashcommando/opt/cross/lib/gcc/i686-elf/4.9.2/../../../../i686-elf/bin/ld: cannot find -lgcc
/home/bashcommando/opt/cross/lib/gcc/i686-elf/4.9.2/../../../../i686-elf/bin/ld: cannot find -lc
/home/bashcommando/opt/cross/lib/gcc/i686-elf/4.9.2/../../../../i686-elf/bin/ld: cannot find -lgcc
/home/bashcommando/opt/cross/lib/gcc/i686-elf/4.9.2/../../../../i686-elf/bin/ld: cannot find crtend.o: No such file or directory
collect2: error: ld returned 1 exit status
What noobish mistake did I do this time?
Edit: I figured it out. I don't have libgcc for i686-elf.
Building an operating system is like building an airplane, you don't want it to crash.
User avatar
bashcommando
Member
Member
Posts: 62
Joined: Mon Jan 06, 2014 4:23 pm

Re: Problems with i686-elf-gcc

Post by bashcommando »

ExeTwezz wrote:
bashcommando wrote:

Code: Select all

/usr/lib/gcc/i686-linux-gnu/4.8/../../../i386-linux-gnu/crt1.o: In function `_start':
Did you compile with

Code: Select all

-ffreestanding
?
I tried to recompile but:

Code: Select all

⏚ [bashcommando:/home … 86-elf-gcc/gcc-4.9.2] $ make all-target-libgcc
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libiberty'
make[2]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libiberty/testsuite'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libiberty/testsuite'
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libiberty'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/lto-plugin'
make  all-am
make[2]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/lto-plugin'
make[2]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/lto-plugin'
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/lto-plugin'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/intl'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/intl'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/build-i686-pc-linux-gnu/libiberty'
make[2]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/build-i686-pc-linux-gnu/libiberty/testsuite'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/build-i686-pc-linux-gnu/libiberty/testsuite'
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/build-i686-pc-linux-gnu/libiberty'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/build-i686-pc-linux-gnu/fixincludes'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/build-i686-pc-linux-gnu/fixincludes'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/zlib'
true "AR_FLAGS=rc" "CC_FOR_BUILD=gcc" "CFLAGS=-g -O2" "CXXFLAGS=-g -O2" "CFLAGS_FOR_BUILD=-g -O2" "CFLAGS_FOR_TARGET=-g -O2" "INSTALL=/usr/bin/install -c" "INSTALL_DATA=/usr/bin/install -c -m 644" "INSTALL_PROGRAM=/usr/bin/install -c" "INSTALL_SCRIPT=/usr/bin/install -c" "LDFLAGS=-static-libstdc++ -static-libgcc " "LIBCFLAGS=-g -O2" "LIBCFLAGS_FOR_TARGET=-g -O2" "MAKE=make" "MAKEINFO=makeinfo --split-size=5000000 " "PICFLAG=" "PICFLAG_FOR_TARGET=" "SHELL=/bin/bash" "EXPECT=expect" "RUNTEST=runtest" "RUNTESTFLAGS=" "exec_prefix=/home/bashcommando/opt/cross" "infodir=/home/bashcommando/opt/cross/share/info" "libdir=/home/bashcommando/opt/cross/lib" "prefix=/home/bashcommando/opt/cross" "tooldir=/home/bashcommando/opt/cross/i686-elf" "AR=ar" "AS=as" "CC=gcc" "CXX=g++" "LD=ld" "LIBCFLAGS=-g -O2" "NM=nm" "PICFLAG=" "RANLIB=ranlib" "DESTDIR=" DO=all multi-do # make
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/zlib'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libbacktrace'
make  all-am
make[2]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libbacktrace'
true  DO=all multi-do # make
make[2]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libbacktrace'
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libbacktrace'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libcpp'
test -f config.h || (rm -f stamp-h1 && make stamp-h1)
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libcpp'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libdecnumber'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libdecnumber'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/fixincludes'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/fixincludes'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/gcc'
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/gcc'
Checking multilib configuration for libgcc...
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/i686-elf/libgcc'
Makefile:165: ../.././gcc/libgcc.mvars: No such file or directory
make[1]: *** No rule to make target `../.././gcc/libgcc.mvars'.  Stop.
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/i686-elf/libgcc'
make: *** [all-target-libgcc] Error 2
Building an operating system is like building an airplane, you don't want it to crash.
gardinirafael
Posts: 21
Joined: Mon Feb 03, 2014 12:52 pm

Re: Problems with i686-elf-gcc

Post by gardinirafael »

bashcommando wrote:
ExeTwezz wrote:
bashcommando wrote:

Code: Select all

/usr/lib/gcc/i686-linux-gnu/4.8/../../../i386-linux-gnu/crt1.o: In function `_start':
Did you compile with

Code: Select all

-ffreestanding
?
I tried to recompile but:

Code: Select all

⏚ [bashcommando:/home … 86-elf-gcc/gcc-4.9.2] $ make all-target-libgcc
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libiberty'
make[2]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libiberty/testsuite'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libiberty/testsuite'
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libiberty'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/lto-plugin'
make  all-am
make[2]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/lto-plugin'
make[2]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/lto-plugin'
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/lto-plugin'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/intl'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/intl'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/build-i686-pc-linux-gnu/libiberty'
make[2]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/build-i686-pc-linux-gnu/libiberty/testsuite'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/build-i686-pc-linux-gnu/libiberty/testsuite'
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/build-i686-pc-linux-gnu/libiberty'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/build-i686-pc-linux-gnu/fixincludes'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/build-i686-pc-linux-gnu/fixincludes'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/zlib'
true "AR_FLAGS=rc" "CC_FOR_BUILD=gcc" "CFLAGS=-g -O2" "CXXFLAGS=-g -O2" "CFLAGS_FOR_BUILD=-g -O2" "CFLAGS_FOR_TARGET=-g -O2" "INSTALL=/usr/bin/install -c" "INSTALL_DATA=/usr/bin/install -c -m 644" "INSTALL_PROGRAM=/usr/bin/install -c" "INSTALL_SCRIPT=/usr/bin/install -c" "LDFLAGS=-static-libstdc++ -static-libgcc " "LIBCFLAGS=-g -O2" "LIBCFLAGS_FOR_TARGET=-g -O2" "MAKE=make" "MAKEINFO=makeinfo --split-size=5000000 " "PICFLAG=" "PICFLAG_FOR_TARGET=" "SHELL=/bin/bash" "EXPECT=expect" "RUNTEST=runtest" "RUNTESTFLAGS=" "exec_prefix=/home/bashcommando/opt/cross" "infodir=/home/bashcommando/opt/cross/share/info" "libdir=/home/bashcommando/opt/cross/lib" "prefix=/home/bashcommando/opt/cross" "tooldir=/home/bashcommando/opt/cross/i686-elf" "AR=ar" "AS=as" "CC=gcc" "CXX=g++" "LD=ld" "LIBCFLAGS=-g -O2" "NM=nm" "PICFLAG=" "RANLIB=ranlib" "DESTDIR=" DO=all multi-do # make
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/zlib'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libbacktrace'
make  all-am
make[2]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libbacktrace'
true  DO=all multi-do # make
make[2]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libbacktrace'
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libbacktrace'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libcpp'
test -f config.h || (rm -f stamp-h1 && make stamp-h1)
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libcpp'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libdecnumber'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/libdecnumber'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/fixincludes'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/fixincludes'
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/gcc'
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/host-i686-pc-linux-gnu/gcc'
Checking multilib configuration for libgcc...
make[1]: Entering directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/i686-elf/libgcc'
Makefile:165: ../.././gcc/libgcc.mvars: No such file or directory
make[1]: *** No rule to make target `../.././gcc/libgcc.mvars'.  Stop.
make[1]: Leaving directory `/home/bashcommando/Desktop/Projects/i686-elf-gcc/gcc-4.9.2/i686-elf/libgcc'
make: *** [all-target-libgcc] Error 2

You did not follow gcc build recomendations.

Try to exit gcc directory and create another directory for call the make.

More instructions: http://wiki.osdev.org/GCC_Cross-Compiler
User avatar
bashcommando
Member
Member
Posts: 62
Joined: Mon Jan 06, 2014 4:23 pm

Re: Problems with i686-elf-gcc

Post by bashcommando »

gardinirafael wrote: You did not follow gcc build recomendations.

Try to exit gcc directory and create another directory for call the make.

More instructions: http://wiki.osdev.org/GCC_Cross-Compiler
So I have to re-download gcc again? I already followed the instructions. I'll try again.
Building an operating system is like building an airplane, you don't want it to crash.
gardinirafael
Posts: 21
Joined: Mon Feb 03, 2014 12:52 pm

Re: Problems with i686-elf-gcc

Post by gardinirafael »

bashcommando wrote:
gardinirafael wrote: You did not follow gcc build recomendations.

Try to exit gcc directory and create another directory for call the make.

More instructions: http://wiki.osdev.org/GCC_Cross-Compiler
So I have to re-download gcc again? I already followed the instructions. I'll try again.
No, you haven't. re-extract GCC files and call make out of GCC dir

Example:

cd /home/user
extract command
mkdir build_dir
cd build_dir

Inside of build dir, you call the make

../gccdir/make
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: Problems with i686-elf-gcc

Post by max »

gardinirafael wrote:... call make out of GCC dir

Example:

cd /home/user
extract command
mkdir build_dir
cd build_dir

Inside of build dir, you call the make

../gccdir/make
No, you don't do it like this, because it doesn't matter from where you 'make' the project, but from/to where you 'configure'd it.
You call the binutils/gcc/whatever configure scripts from within the build dir and then call make within the build dir.

Code: Select all

mkdir gcc-4.x-build
cd gcc-4.x-build
../gcc-4.x/configure yourflags
make
make install
User avatar
bashcommando
Member
Member
Posts: 62
Joined: Mon Jan 06, 2014 4:23 pm

Re: Problems with i686-elf-gcc

Post by bashcommando »

max wrote:
gardinirafael wrote:... call make out of GCC dir

Example:

cd /home/user
extract command
mkdir build_dir
cd build_dir

Inside of build dir, you call the make

../gccdir/make
No, you don't do it like this, because it doesn't matter from where you 'make' the project, but from/to where you 'configure'd it.
You call the binutils/gcc/whatever configure scripts from within the build dir and then call make within the build dir.

Code: Select all

mkdir gcc-4.x-build
cd gcc-4.x-build
../gcc-4.x/configure yourflags
make
make install
gardinirafael wrote:
bashcommando wrote:
gardinirafael wrote: You did not follow gcc build recomendations.

Try to exit gcc directory and create another directory for call the make.

More instructions: http://wiki.osdev.org/GCC_Cross-Compiler
So I have to re-download gcc again? I already followed the instructions. I'll try again.
No, you haven't. re-extract GCC files and call make out of GCC dir

Example:

cd /home/user
extract command
mkdir build_dir
cd build_dir

Inside of build dir, you call the make

../gccdir/make
I followed the tutorial as accurate as possible and downgraded to gcc 4.8.3 and binutils 2.24. I got this:

Code: Select all

/home/bashcommando/opt/cross/lib/gcc/i686-elf/4.8.3/../../../../i686-elf/bin/ld: cannot find crt0.o: No such file or directory
/home/bashcommando/opt/cross/lib/gcc/i686-elf/4.8.3/../../../../i686-elf/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
What else am I doing wrong?
Building an operating system is like building an airplane, you don't want it to crash.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Problems with i686-elf-gcc

Post by Combuster »

What else am I doing wrong?
Reading, as usual:
GCC Cross-Compiler wrote:Note how this compiler is not able to compile normal C programs.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply