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.
Last night I was trying to setup my i686-elf-gcc cross compiler. After spending like an hour trying to figure out what was wrong with my current installation (I had the binaries from the debian repository, which I had assumed would work but seemed to be broken for me) and eventually decided to compile it myself. When I was finally done, I tried compiling something and it worked just fine. However, after closing out of that shell and opening a new one it no longer worked properly and kept giving a variety of different errors. I figured out that I forgot to export some of my environment variables in my zshrc, but after fixing that (I think) it still seems broken. Here are the relevant files/errors:
/tmp/ccdUfcT0.s: Assembler messages:
/tmp/ccdUfcT0.s:18: Error: invalid instruction suffix for `push'
/tmp/ccdUfcT0.s:44: Error: invalid instruction suffix for `push'
makefile:19: recipe for target 'src/hello.o' failed
make: *** [src/hello.o] Error 1
This is using the code from here, by the way (with some modifications to makefiles and other parts of the code unrelated to this), and I was able to compile the kernel as of last night... I'm now unable to compile both modules and the kernel but for simplicity I am just posting the test module: https://github.com/GruntTheDivine/infin ... ules/hello
iansjack wrote:Can we assume that you have also built the appropriate binutils?
That error often occurs when you try to assemble 32-bit code with a 64-bit assembler.
No, I didn't do that. I assumed I didn't have to since I had the old binutils from the debian package and the first time I tried compiling the ISO it worked fine. I just tried compiling it with the guide on the wiki and got this error:
I'm honestly not even sure what I was using for the binutils before. I am assuming they were the ones included in cross-gcc-dev but I really have no clue. I do have 64-bit binutils on the system. Any clue how I can fix the errors during compilation?
nv wrote:Any clue how I can fix the errors during compilation?
I'd have another go at building binutils. I can't help but think that you must have done something wrong as it is normally a very straightforward procedure. You did use a separate build directory, didn't you, rather than building in the source directory?
Edit: It looks as if your problem with binutils may have been that you were using a very old version. Which versions of binutils and gcc did you try to build?
nv wrote:I tried building binutils-2.9.1 and gcc-4.9.2. GCC built correctly.
****, I'm stupid. That is an ancient version of binutils. I don't know why I thought that was the most recent... gonna try building a modern version now.
nv wrote:I tried building binutils-2.9.1 and gcc-4.9.2. GCC built correctly.
****, I'm stupid. That is an ancient version of binutils. I don't know why I thought that was the most recent... gonna try building a modern version now.