OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 04, 2021 10:53 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Help Building Binutils
PostPosted: Thu Nov 26, 2020 10:37 am 
Offline

Joined: Tue Nov 17, 2020 9:14 am
Posts: 6
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 :-| )


Top
 Profile  
 
 Post subject: Re: Help Building Binutils
PostPosted: Thu Nov 26, 2020 10:53 am 
Offline
Member
Member

Joined: Tue Aug 11, 2020 12:14 pm
Posts: 95
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.


Top
 Profile  
 
 Post subject: Re: Help Building Binutils
PostPosted: Thu Nov 26, 2020 11:06 am 
Offline
Member
Member

Joined: Sun Aug 23, 2020 4:35 pm
Posts: 129
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>

_________________
My OS: TritiumOS
https://github.com/foliagecanine/tritium-os
void warranty(laptop_t laptop) { if (laptop.broken) return laptop; }
I don't get it: Why's the warranty void?


Top
 Profile  
 
 Post subject: Re: Help Building Binutils
PostPosted: Thu Nov 26, 2020 11:49 am 
Offline

Joined: Tue Nov 17, 2020 9:14 am
Posts: 6
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...


Top
 Profile  
 
 Post subject: Re: Help Building Binutils
PostPosted: Thu Nov 26, 2020 1:16 pm 
Offline
Member
Member

Joined: Tue Aug 11, 2020 12:14 pm
Posts: 95
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.


Top
 Profile  
 
 Post subject: Re: Help Building Binutils
PostPosted: Thu Nov 26, 2020 2:28 pm 
Offline
Member
Member

Joined: Sun Aug 23, 2020 4:35 pm
Posts: 129
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

_________________
My OS: TritiumOS
https://github.com/foliagecanine/tritium-os
void warranty(laptop_t laptop) { if (laptop.broken) return laptop; }
I don't get it: Why's the warranty void?


Top
 Profile  
 
 Post subject: Re: Help Building Binutils
PostPosted: Fri Nov 27, 2020 7:54 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 16, 2006 12:01 pm
Posts: 7506
Location: Germany
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.

_________________
Every good solution is obvious once you've found it.


Top
 Profile  
 
 Post subject: Re: Help Building Binutils
PostPosted: Fri Nov 27, 2020 8:27 am 
Offline

Joined: Tue Nov 17, 2020 9:14 am
Posts: 6
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group