top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

Trouble building AR

0 votes
33 views

I'm having trouble building GCC. I've decompressed GCC 4.7.2 source into a directory and binutils 2.21.1 into a directory in parallel with symbolic links to all subdirectories. I ran the contrib script to get all other dependencies and then ran GCC's configure in a parallel directory, following all installation instructions. It builds just fine but when I install it AR seems to be missing. Any idea what happened to it and how to get it?

Looks like it's supposed to be built with binutils and I'm getting other tools from it like LD just not that one. There is a program called gcc-ar that seems to exist but not sure if it's the same tool? It may appear if I build binutils by itself but I'm trying to build them together so that I can get -flto optimization to work, as apparently GCC balks at using the linker plugin if they weren't built together.

posted Jun 18, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button
This is the command that I used:

    ../gcc-4.7.2/configure --prefix=/tools/gcc-4.7.2 --enable-static
    make -j10
    make install

My directory structure looks like this:

    /gcc-4.7.2
    /binutils-2.21.1 // linked all directories in gcc-4.7.2
    /x86_64 // configure called from here

I wiped the directory x86_64 clean and tried again and this time it seems to have worked so I guess it was a fluke. Maybe I shouldn't be compiling in parallel?

Now I'm getting a different error though when using the compiler:

    collect2: fatal error: cannot find 'ld'

My compile command is this:

    /tools/gcc-4.7.2/bin/g++ -o myExec -Xlinker -R /tools/gcc-4.7.2/lib64
    -static -L/tools/gcc-4.7.2/lib64  -lnsl -ldl
    -Wl,--wrap,open -Wl,--wrap,close -Wl,--wrap,lseek -Wl,--wrap,write
    -Wl,--wrap,printf -Wl,--wrap,puts -Wl,--wrap,vfprintf -Wl,--wrap,fputc
    -Wl,--wrap,putchar -flto -O3 -mtune=generic -fuse-linker-plugin
    -L/tools/gcc-4.7.2/lib64 -lm -lstdc++ -lsupc++

ld exists in the target path:

    -rwxr-xr-x 4   6238594 Jun 18 16:06 /tools/gcc-4.7.2/bin/ld

strace shows a number of stat calls before GCC exists but not to this path or LD at all. Seems to be looking for ld-new and real-ld. I don't see either of those in the installed directory (/tools/gcc-4.7.2) but
I see a few instances of ld-new in the build directory (/x86_64 above: ./prev-ld/ld-new, ./stage1-ld/ld-new, and ./ld/ld-new). Any idea what's wrong now?

2 Answers

+1 vote

Tell us exactly how you ran configure.
It's not clear from the above: did you build the binutils also, or did you only build GCC?

answer Jun 18, 2013 by anonymous
0 votes

I'm just guessing but try removing your gcc object directory, while not touching your installed binutils, and build again. These days GCC looks for the linker at configure time and it may not have found it when you ran your configure.

answer Jun 19, 2013 by anonymous
Similar Questions
+1 vote

I'm trying to build GCC 4.7.2 with binutils 2.23.1 and am getting a compile error:

dwarf.o: In function get_TAG_name': /w/umoszkow/gcc/x86_64/binutils/../../gcc-4.7.2/binutils/dwarf.c:662: undefined reference toget_DW_TAG_name'
dwarf.o: In function get_FORM_name': /w/umoszkow/gcc/x86_64/binutils/../../gcc-4.7.2/binutils/dwarf.c:678: undefined reference toget_DW_FORM_name' dwarf.o: In function get_AT_name': /w/umoszkow/gcc/x86_64/binutils/../../gcc-4.7.2/binutils/dwarf.c:1867: undefined reference toget_DW_AT_name'
collect2: error: ld returned 1 exit status

Any idea how to get around this build problem? My arch is x86_64 and my OS is RHEL4u8WS.

+1 vote

My system is ubuntu 14.04 LTS 64 bit and I've installed build-essential. Also tried purge and reinstall libc6-dev. Doesn't work.

from /home/xxx/gcc-4.8.2-build/../gcc-4.8.2/libgcc/libgcov.c:27:
/usr/include/features.h:374:25: fatal error: sys/cdefs.h: No such file or directory

0 votes

When I was building GCC, I found out that stage1-gcc is not compiled with optimization (such as -O2). So the compilation of stage2 is very slow. Is this intended or not? If not, did I made some mistakes in configure options and caused this?

+1 vote

Here's a small piece of code:

 static struct {
 const char fmt[10];
 } const x = { "%dn" };
 static const char * const fmt = "%dn";
 printf(fmt, 1);
 printf(x.fmt, 1);

The second printf produces a warning:

 test.c:105:10: warning: format string is not a string literal
[-Wformat-nonliteral]
 printf(x.fmt, 1);
 ^~~~~

From my point of view both format strings are identical. Why can't gcc deduce the format string in the second case?

+1 vote

I'm on /dev/sda7. I want to install gcc with C++ support in /dev/sda2.

  1. Is it possible to install gcc in /dev/sda2?
  2. What are the dependencies to install gcc? Or which packages should I install there in /dev/sda2 before installing gcc?
  3. What is cross compiler? How can I install gcc as cross compiler? When do we need to install gcc as cross compiler?
  4. Can someone explain the method of installing cross compiled gcc?

Useful Links with Similar Problem
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#470/147, 3rd Floor, 5th Main,
HSR Layout Sector 7,
Bangalore - 560102,
Karnataka INDIA.
QUERY HOME
...