* Trouble building AR @ 2013-06-18 20:08 Uri Moszkowicz 2013-06-18 23:16 ` Ian Lance Taylor 0 siblings, 1 reply; 9+ messages in thread From: Uri Moszkowicz @ 2013-06-18 20:08 UTC (permalink / raw) To: gcc-help Hi, 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. Thanks! ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Trouble building AR 2013-06-18 20:08 Trouble building AR Uri Moszkowicz @ 2013-06-18 23:16 ` Ian Lance Taylor 2013-06-19 19:10 ` Uri Moszkowicz 0 siblings, 1 reply; 9+ messages in thread From: Ian Lance Taylor @ 2013-06-18 23:16 UTC (permalink / raw) To: Uri Moszkowicz; +Cc: gcc-help On Tue, Jun 18, 2013 at 1:07 PM, Uri Moszkowicz <uri@4refs.com> wrote: > 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. 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? Ian ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Trouble building AR 2013-06-18 23:16 ` Ian Lance Taylor @ 2013-06-19 19:10 ` Uri Moszkowicz 2013-06-19 19:25 ` Ian Lance Taylor 0 siblings, 1 reply; 9+ messages in thread From: Uri Moszkowicz @ 2013-06-19 19:10 UTC (permalink / raw) To: Ian Lance Taylor; +Cc: gcc-help 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: <root>/gcc-4.7.2 <root>/binutils-2.21.1 // linked all directories in gcc-4.7.2 <root>/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 <.o files> -static -L/tools/gcc-4.7.2/lib64 <.a files> -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 <user> <group> 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 (<root>/x86_64 above: ./prev-ld/ld-new, ./stage1-ld/ld-new, and ./ld/ld-new). Any idea what's wrong now? On Tue, Jun 18, 2013 at 6:16 PM, Ian Lance Taylor <iant@google.com> wrote: > On Tue, Jun 18, 2013 at 1:07 PM, Uri Moszkowicz <uri@4refs.com> wrote: > >> 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. > > 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? > > Ian ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Trouble building AR 2013-06-19 19:10 ` Uri Moszkowicz @ 2013-06-19 19:25 ` Ian Lance Taylor 2013-06-19 21:21 ` Uri Moszkowicz 0 siblings, 1 reply; 9+ messages in thread From: Ian Lance Taylor @ 2013-06-19 19:25 UTC (permalink / raw) To: Uri Moszkowicz; +Cc: gcc-help On Wed, Jun 19, 2013 at 12:10 PM, Uri Moszkowicz <uri@4refs.com> wrote: > ld exists in the target path: > -rwxr-xr-x 4 <user> <group> 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 (<root>/x86_64 > above: ./prev-ld/ld-new, ./stage1-ld/ld-new, and ./ld/ld-new). Any > idea what's wrong now? 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. Ian ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Trouble building AR 2013-06-19 19:25 ` Ian Lance Taylor @ 2013-06-19 21:21 ` Uri Moszkowicz 2013-06-19 21:38 ` Ian Lance Taylor 0 siblings, 1 reply; 9+ messages in thread From: Uri Moszkowicz @ 2013-06-19 21:21 UTC (permalink / raw) To: Ian Lance Taylor; +Cc: gcc-help No luck - same error :( I see the following list in config.log: /tools/gcc-4.7.2/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find -lpwl collect2: error: ld returned 1 exit status Is that of interest? Maybe I should just try a different GCC / binutils combination. Any other suggestions to help figure out what's wrong? On Wed, Jun 19, 2013 at 2:25 PM, Ian Lance Taylor <iant@google.com> wrote: > On Wed, Jun 19, 2013 at 12:10 PM, Uri Moszkowicz <uri@4refs.com> wrote: > >> ld exists in the target path: >> -rwxr-xr-x 4 <user> <group> 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 (<root>/x86_64 >> above: ./prev-ld/ld-new, ./stage1-ld/ld-new, and ./ld/ld-new). Any >> idea what's wrong now? > > 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. > > Ian ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Trouble building AR 2013-06-19 21:21 ` Uri Moszkowicz @ 2013-06-19 21:38 ` Ian Lance Taylor 2013-06-19 22:04 ` Uri Moszkowicz 0 siblings, 1 reply; 9+ messages in thread From: Ian Lance Taylor @ 2013-06-19 21:38 UTC (permalink / raw) To: Uri Moszkowicz; +Cc: gcc-help On Wed, Jun 19, 2013 at 2:20 PM, Uri Moszkowicz <uri@4refs.com> wrote: > No luck - same error :( I see the following list in config.log: > > /tools/gcc-4.7.2/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../x86_64-unknown-linux-gnu/bin/ld: > cannot find -lpwl > collect2: error: ld returned 1 exit status Errors in config.log are normal. > Is that of interest? Maybe I should just try a different GCC / > binutils combination. Any other suggestions to help figure out what's > wrong? You said the program is failing when you try to use it. Try running gcc -o foo foo.c -Wl,-debug That should show all the places where the collect2 program is looking for ld. Then we need to find out why it is not looking in the right place. Ian ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Trouble building AR 2013-06-19 21:38 ` Ian Lance Taylor @ 2013-06-19 22:04 ` Uri Moszkowicz 2013-06-19 23:06 ` Ian Lance Taylor 0 siblings, 1 reply; 9+ messages in thread From: Uri Moszkowicz @ 2013-06-19 22:04 UTC (permalink / raw) To: Ian Lance Taylor; +Cc: gcc-help Log uploaded here: http://www.4refs.com/gcc.log It seems to be looking in the right places just not for the right file. It looks for "real-ld", "collect-ld", and "ld-new" but not "ld". On Wed, Jun 19, 2013 at 4:38 PM, Ian Lance Taylor <iant@google.com> wrote: > On Wed, Jun 19, 2013 at 2:20 PM, Uri Moszkowicz <uri@4refs.com> wrote: >> No luck - same error :( I see the following list in config.log: >> >> /tools/gcc-4.7.2/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../x86_64-unknown-linux-gnu/bin/ld: >> cannot find -lpwl >> collect2: error: ld returned 1 exit status > > Errors in config.log are normal. > >> Is that of interest? Maybe I should just try a different GCC / >> binutils combination. Any other suggestions to help figure out what's >> wrong? > > You said the program is failing when you try to use it. Try running > gcc -o foo foo.c -Wl,-debug > That should show all the places where the collect2 program is looking > for ld. Then we need to find out why it is not looking in the right > place. > > Ian ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Trouble building AR 2013-06-19 22:04 ` Uri Moszkowicz @ 2013-06-19 23:06 ` Ian Lance Taylor 2013-06-21 19:19 ` Uri Moszkowicz 0 siblings, 1 reply; 9+ messages in thread From: Ian Lance Taylor @ 2013-06-19 23:06 UTC (permalink / raw) To: Uri Moszkowicz; +Cc: gcc-help On Wed, Jun 19, 2013 at 3:04 PM, Uri Moszkowicz <uri@4refs.com> wrote: > Log uploaded here: > > http://www.4refs.com/gcc.log > > It seems to be looking in the right places just not for the right > file. It looks for "real-ld", "collect-ld", and "ld-new" but not "ld". This looks like a bug. It looks like it has been fixed in current mainline. It looks like when you build with the binutils as a sibling directory, it finds ld-new in the ld directory. Then it mistakenly starts looking for that, rather than ld. I haven't tried but you may be able to work around this by using the GCC configure option --with-plugin-ld=/path/to/your/ld. Ian ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Trouble building AR 2013-06-19 23:06 ` Ian Lance Taylor @ 2013-06-21 19:19 ` Uri Moszkowicz 0 siblings, 0 replies; 9+ messages in thread From: Uri Moszkowicz @ 2013-06-21 19:19 UTC (permalink / raw) To: Ian Lance Taylor; +Cc: gcc-help Thanks for identifying it - good so I'm not crazy :) I tried your fix and I think it worked? I get this error when linking now: <.a file>: could not read symbols: Bad value collect2: error: ld returned 1 exit status I tried building the latest stable GCC, 4.8.1, and binutils, 2.23.2, but an error buildling it too: /lib64/ld-linux-x86-64.so.2: could not read symbols: Invalid operation This is on a RHEL4u8WS machine. On Wed, Jun 19, 2013 at 6:06 PM, Ian Lance Taylor <iant@google.com> wrote: > On Wed, Jun 19, 2013 at 3:04 PM, Uri Moszkowicz <uri@4refs.com> wrote: >> Log uploaded here: >> >> http://www.4refs.com/gcc.log >> >> It seems to be looking in the right places just not for the right >> file. It looks for "real-ld", "collect-ld", and "ld-new" but not "ld". > > This looks like a bug. It looks like it has been fixed in current > mainline. It looks like when you build with the binutils as a sibling > directory, it finds ld-new in the ld directory. Then it mistakenly > starts looking for that, rather than ld. I haven't tried but you may > be able to work around this by using the GCC configure option > --with-plugin-ld=/path/to/your/ld. > > Ian ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-06-21 19:19 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-06-18 20:08 Trouble building AR Uri Moszkowicz 2013-06-18 23:16 ` Ian Lance Taylor 2013-06-19 19:10 ` Uri Moszkowicz 2013-06-19 19:25 ` Ian Lance Taylor 2013-06-19 21:21 ` Uri Moszkowicz 2013-06-19 21:38 ` Ian Lance Taylor 2013-06-19 22:04 ` Uri Moszkowicz 2013-06-19 23:06 ` Ian Lance Taylor 2013-06-21 19:19 ` Uri Moszkowicz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).