LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 05-23-2008, 04:16 PM   #1
The00Dustin
Member
 
Registered: Jan 2006
Posts: 68

Rep: Reputation: 15
configure: error: GRUB requires a working absolute objcopy; upgrade your binutils


I am trying to compile grub on Fedora 8 because I need to apply the patch for bug 250299.

First, I downloaded and installed http://mirrors.kernel.org/fedora/rel....97-19.src.rpm

Next, I extracted the included grub-0.97.tar.gz to /usr/src/

At this point, if I run configure, I will get the error mentioned in the subject, as follows:

Code:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking for gcc... (cached) gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking dependency style of gcc... (cached) gcc3
checking for ranlib... ranlib
checking whether optimization for size works... yes
checking whether gcc has -fno-stack-protector... yes
checking whether -Wundef works... yes
checking whether -falign-loops works... yes
checking for objcopy... objcopy
checking if C symbols get an underscore after compilation... no
checking whether objcopy works for absolute addresses... no
configure: error: GRUB requires a working absolute objcopy; upgrade your binutils
However, I am running binutils 2.17.50.0.18 which is the latest in the fedora repo, so I cannot upgrade, and I do not know how to downgrade.

I saw another issue where this same error was happening, and someone suggested downloading ftp://alpha.gnu.org/gnu/grub/grub-0.97.tar.gz and using it.

I tried this and determined that that is the exact file included in the srpm I had downloaded, and the error still surfaces when I try it.

Additionally, if I apply the included grub-fedora-8.patch, the configure file disappears. I can get it from the tar again, but I will still get the same error, so while I need to know how I am supposed to compile after applying that patch (which I apply before the patch for the aforementioned bug), but that point is moot until I can determine how to fix this binutils issue.
 
Old 05-27-2008, 08:42 AM   #3
The00Dustin
Member
 
Registered: Jan 2006
Posts: 68

Original Poster
Rep: Reputation: 15
I may be dense, but I'm not sure what you're getting at. That was a problem I had compiling grub in F7, and I determined the problem was missing headers. In this case, I am getting a totally different error, and those headers aren't missing.

On a whim, I tried installing some other headers where 32-bit ones didn't exist (ilbstdc++-devel in this case), but that made no difference on the error I am getting.

Also, when I said:
Quote:
I saw another issue where this same error was happening, and someone suggested downloading ftp://alpha.gnu.org/gnu/grub/grub-0.97.tar.gz and using it.
I was referring to another LQ suggestion from someone else's post (the other post wasn't especially relevant, but it was as close to relevant as I had found). I also tried yahoo and google, but found very little at all and nothing leading to a solution (it should be noted that I am consistently exceptionally bad at searching).

Anyway, I didn't post the config.log earlier. Here is the relevant part of it:
Code:
configure:3870: checking whether objcopy works for absolute addresses
configure:3883: gcc -c -m32 -g  -Wall -Wmissing-prototypes -Wunused -Wshadow -Wpointer-arith -falign-jumps=1 -falign-loops=1 -falign-functions=1 -Wundef conftest.c >&5
conftest.c:3: warning: no previous prototype for 'cmain'
configure:3886: $? = 0
configure:3896: gcc -m32 -g -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 conftest.o -o conftest.exec
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000002000
configure:3899: $? = 0
configure:3907: objcopy -O binary conftest.exec conftest
configure:3910: $? = 0
configure:3896: gcc -m32 -g -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 conftest.o -o conftest.exec
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000008000
configure:3899: $? = 0
configure:3907: objcopy -O binary conftest.exec conftest
configure:3910: $? = 0
configure:3918: cmp -s conftest.old conftest
configure:3921: $? = 1
configure:3932: result: no
configure:3935: error: GRUB requires a working absolute objcopy; upgrade your binutils
Any suggestions on how to resolve this would be appreciated. As previously noted, I haven't tried compiling a newer copy of binutils manually, because I doubt it would help (I can't imagine the Fedora repo copy really doesn't work), and because I am concerned that manually compiling it could lead to other problems.

I am also still curious as to whether anyone can tell me whether or not I should use the configure script from the source after applying grub-fedora-8.patch since said patch deletes said script (but I certainly don't know how else to go about building it with that patch). Should I post a separate topic on that?

Last edited by The00Dustin; 05-27-2008 at 08:44 AM. Reason: re-ordered sentences for easier read
 
Old 05-27-2008, 08:59 AM   #4
The00Dustin
Member
 
Registered: Jan 2006
Posts: 68

Original Poster
Rep: Reputation: 15
Resolved

This is the "not especially" relevant thread I mentioned earlier (it may also be the article you meant to refer me to):
http://www.linuxquestions.org/questi...nutils-603125/
I revisited it, and it looked more relevant (I tuned out once you guys started talking about LFS, so I didn't notice your suggestion:
Code:
./configure --prefix=/hd/usr CC=gcc34
was actually about the original issue.)
After installing compat-gcc-34 (and compat-gcc-34-c++ for good measure), I tried configure again, and the configure script worked fine, so hopefully that's all I needed. Thanks.
 
Old 05-27-2008, 09:00 AM   #5
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,149

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
I notice, in your output, that the _start value was defaulted to different addresses in the two compilations. Since cmp is doing a byte-by-byte comparison, that may explain why it failed.

Whoever wrote the config script seems to have assumed that any failure of the cmp indicated an objcopy failure. I suspect that the assumption may be incorrect.
 
Old 05-27-2008, 09:24 AM   #6
The00Dustin
Member
 
Registered: Jan 2006
Posts: 68

Original Poster
Rep: Reputation: 15
Resolved

Cool info, and you may be right, but it turns out that using an older version of gcc got through it, so I am going to leave that (potential err) to the coders in case it was nothing but a compatibility problem. Since you were probably posting before I noted that the issue was resolved, I am noting that again here. I ultimately used this command:
Code:
./configure CC=gcc34
as I didn't want to install to /hd/usr. Also, I didn't get make to work with the fedora patch applied, so I went without that and will ask about said patch in a separate thread, but aside from that, grub is at least giving xen the correct amount of memory now.
 
Old 10-21-2010, 03:15 AM   #7
M.e.M.O.
LQ Newbie
 
Registered: Oct 2010
Posts: 3

Rep: Reputation: 0
Sorry for bumping up an old thread. But I have the same problem, and the solution here does not apply to it.

I am trying to compile a grub pxe boot image, and I get the same error in the first post. And also solution in the last post does not apply to it because of this :

Code:
./configure --prefix=/usr --enable-diskless --enable-rtl8139 CC=gcc34
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc34
checking for gcc... (cached) gcc34
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
Trying gcc34 as compiler fails as you can see, and without gcc34 parameter I get the same log in the first post. What should I do ?

Thanks in advance.

Last edited by M.e.M.O.; 10-21-2010 at 03:16 AM.
 
Old 10-21-2010, 11:29 AM   #8
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,149

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
What's in the config.log file?

Often the "cannot create executable" problem is just that you don't have write permission on the directory into which the executable is to be created.
 
Old 01-05-2011, 08:13 AM   #9
dkayser
LQ Newbie
 
Registered: Jan 2011
Posts: 1

Rep: Reputation: 0
Just to add, I have had the same problem. Using gcc-3.4 solves the build. However, the command line I used to configure was:

./configure CC=gcc-3.4
 
Old 01-06-2011, 05:15 AM   #10
M.e.M.O.
LQ Newbie
 
Registered: Oct 2010
Posts: 3

Rep: Reputation: 0
Thanks for the input. I'll try that one out.
 
Old 06-01-2011, 07:19 AM   #11
eric957
LQ Newbie
 
Registered: Jun 2011
Posts: 1

Rep: Reputation: Disabled
Cannot create executable

@M.e.M.O. I had the same error configuring with an alternate version of gcc. Looking at config.log explained it. It turned out that Grub builds to 32 bits binaries, and the alternative compiler did not have the 32 bits libraries in /usr/lib32/gcc/i686-linux-gnu. Even if they're probably not used in the particular case of Grub, the small test compiled by configure does require them.

My 2 cts...
 
Old 07-23-2011, 10:25 AM   #12
ravidborse
LQ Newbie
 
Registered: Jun 2008
Posts: 9

Rep: Reputation: 0
Smile Small Changes in configure file

To Solve this error just do minute changes in configure file

Below is the Snippet of configure file:

echo $ECHO_N "checking whether ${OBJCOPY} works for absolute addresses...
....
....
for link_addr in 0x2000 0x8000 0x7C00; do
....
....
if { ac_try='${OBJCOPY-objcopy} --only-section=.text -O binary conftest.exec conftest'
....
....



The Lines with Bold Should be replaced.
 
Old 11-10-2013, 12:45 AM   #13
nycbrit
LQ Newbie
 
Registered: Nov 2013
Posts: 7

Rep: Reputation: Disabled
Post

I had this problem when compiling grub4dos (for glrdr). Adding --only-section=.text to configure didn't solve all problems, as it's referenced elsewhere in the Makefile.in files. Obviously the configure test is there for a reason. Quickest solution was to write a bash script called objcopy containing "/usr/bin/objcopy --only-section=.text $@" and add it to the start of PATH env var.

Grub still fails to build, as the new .note.gnu.build-id section gets in the way. I tried using the newer binutils with -Wl,--build-id=none to remove the section, but it produced an invalid grub binary. Eventually I installed binutils version 2.10.1 (using --prefix). To get binutils 2.10.1 to build with gcc 4.7, I had to replace some variable arrays [] with pointers.

Then there's a trick - to get grub4dos to build with gcc 4.7, you need to run configure with the system installed version of binutils as gcc47 will call as with option --32 which the older as won't understand. Then export LDFLAGS="-B <path to binutils 2.10.1>", and run make. Ugly, but it works.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
configure: error: GRUB requires a working absolute objcopy; upgrade your binutils kcoriginal Linux - Software 11 11-11-2008 02:34 AM
Installation of Binutils(configure:error:installation or configuration problem:C ...) h_r0019 Linux From Scratch 1 05-05-2007 07:40 AM
Adobe Acrobate Reader Requires A Plugin-That Requires Open LDAP That Requires Berkely Old_Fogie Slackware 10 05-08-2006 05:04 AM
make: *** [configure-libiberty] Error 1 in 5.4. Binutils-2.15.91.0.2 - Pass 1 Flash_G Linux From Scratch 3 06-30-2005 08:51 PM
configure grub to dual boot - not working. John5788 Linux - General 8 04-12-2005 01:23 PM


All times are GMT -5. The time now is 12:37 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration