OSDev.org
https://forum.osdev.org/

Help Building Binutils
https://forum.osdev.org/viewtopic.php?f=13&t=37787
Page 1 of 1

Author:  Sect0r [ Thu Nov 26, 2020 10:37 am ]
Post subject:  Help Building Binutils

Hello!
I've been following the wiki tutorial on how to build my compiler and im running into a bit of a problem,
Code:
mkdir build-binutils
cd build-binutils
../binutils-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror

do i need to have '/binutils-x.y.z/configure' in my '/src' directory, is it already on the cygwin system or am i just dumb?

Thanks in advance!
(sorry if this isn't the correct place to post this issue :-| )

Author:  sj95126 [ Thu Nov 26, 2020 10:53 am ]
Post subject:  Re: Help Building Binutils

It's hard to say because you didn't post any error messages, but here's how I built binutils on cygwin:
Code:
export PREFIX=/usr/local/x86_64-elf
export TARGET=x86_64-elf
export PATH="$PREFIX/bin:$PATH"

cd build-binutils
../binutils-2.34/configure --target=$TARGET --prefix=$PREFIX --with-sysroot --disable-nls --disable-werror
make ; make install

There may be some library prerequisites. I'm not remembering which at the moment, but I think I remember that the cygwin repository didn't offer all of them and some had to be built from source.

Author:  foliagecanine [ Thu Nov 26, 2020 11:06 am ]
Post subject:  Re: Help Building Binutils

binutils-x.y.z is a placeholder for whatever version of binutils you are building.

For example, for binutils 2.31, you would download and extract it.
It should produce the binutils-2.31 folder.
Then you would create and cd into your build-binutils folder.
Then you would execute the configure script in the binutils-2.31 folder by doing ../binutils-2.31/configure <arguments>

Author:  Sect0r [ Thu Nov 26, 2020 11:49 am ]
Post subject:  Re: Help Building Binutils

sj95126 wrote:
It's hard to say because you didn't post any error messages, but here's how I built binutils on cygwin:
Code:
export PREFIX=/usr/local/x86_64-elf
export TARGET=x86_64-elf
export PATH="$PREFIX/bin:$PATH"

cd build-binutils
../binutils-2.34/configure --target=$TARGET --prefix=$PREFIX --with-sysroot --disable-nls --disable-werror
make ; make install

There may be some library prerequisites. I'm not remembering which at the moment, but I think I remember that the cygwin repository didn't offer all of them and some had to be built from source.


Oh, i'm sorry.
I'm using Cygwin and installed binutils with the package selection thing, i just need to build it.

Code:
../binutils-2.34/configure --target=$TARGET --prefix=$PREFIX --with-sysroot --disable-nls --disable-werror
-bash: ../binutils-2.34/configure: No such file or directory



is there a specific directory it is in or...

Author:  sj95126 [ Thu Nov 26, 2020 1:16 pm ]
Post subject:  Re: Help Building Binutils

configure should definitely be at the top level of the binutils-x.y.z directory.

I would just download the binutils-x.y.z sources from gnu.org and build them. That's what I did (binutils 2.34 on cygwin64/Win10). Both it and gcc built just fine for both 32-bit and 64-bit elf targets.

Author:  foliagecanine [ Thu Nov 26, 2020 2:28 pm ]
Post subject:  Re: Help Building Binutils

The tree should look something like this:
Code:
|
├── binutils-2.31.1
│   └── configure
├── build-binutils
├── build-gcc
└── gcc-7.3.0
    └── configure

To build binutils, cd into build-binutils, then run the ../binutils-2.31.1/configure command.
To build gcc, cd into build-gcc, then run the ../gcc-7.3.0/configure command

Author:  Solar [ Fri Nov 27, 2020 7:54 am ]
Post subject:  Re: Help Building Binutils

Sect0r wrote:
I'm using Cygwin and installed binutils with the package selection thing, i just need to build it.


The binutils you install via your platform's package manager -- no matter whether that's Cygwin, Windows, Linux or something else -- is a ready-built package of binutils binaries that are targeted for your platform. That is fine if you want to use the binutils to handle binaries for your platform. For building your "My Own OS" compiler, they are not necessary.

If you want to build your own binutils, targeting your own "My Own OS" platform, you start with the sources for binutils, which you can (and should!) download directly from the GNU.org FTP server.

The "binutils-x.y.z" directory mentioned in the Wiki How-To is the directory where those sources are located.

Author:  Sect0r [ Fri Nov 27, 2020 8:27 am ]
Post subject:  Re: Help Building Binutils

Solar wrote:
Sect0r wrote:
I'm using Cygwin and installed binutils with the package selection thing, i just need to build it.


The binutils you install via your platform's package manager -- no matter whether that's Cygwin, Windows, Linux or something else -- is a ready-built package of binutils binaries that are targeted for your platform. That is fine if you want to use the binutils to handle binaries for your platform. For building your "My Own OS" compiler, they are not necessary.

If you want to build your own binutils, targeting your own "My Own OS" platform, you start with the sources for binutils, which you can (and should!) download directly from the GNU.org FTP server.

The "binutils-x.y.z" directory mentioned in the Wiki How-To is the directory where those sources are located.


Oooooh..
That makes much more sense now, sorry.

Thanks for explaining it to me!

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/