public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Help figuring out why nim gives the "collect2: fatal error: can't open nm output" error with older gcc versions
@ 2020-04-22  3:59 Kaushal Modi
  2020-04-22  4:03 ` Kaushal Modi
  0 siblings, 1 reply; 2+ messages in thread
From: Kaushal Modi @ 2020-04-22  3:59 UTC (permalink / raw)
  To: gcc-help

Hello,

I use gcc to compile the C/C++ code generated by Nim (https://nim-lang.org/
).

Nim has a feature where it can read in the nim code via pipe. So I can do

    echo echo NimVersion | nim c -r -

Above compiles and runs the "echo NimVersion" code. The first echo is the
shell echo command.

The reason I am emailing in this mailing list is that that simple command
fails with:

    collect2: fatal error: can't open nm output

for older gcc versions 6.1.0 and 7.2.0.

I have access to only 3 gcc versions (at work): 6.1.0, 7.2.0 and 9.1.0. And
gcc 6.1.0 needs to be the default version for various tool dependency
issues.

The above error does not happen when using gcc 9.1.0.

When I compile the same nim code with -v switches passed to gcc ( echo echo
NimVersion | nim c -r --parallelBuild:1 --passC:-v --passL:-v - ), I get:

GNU C11 (GCC) version 6.1.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 6.1.0, GMP version 6.0.0, MPFR version
3.1.2, MPC version 1.0.2, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 259643b47d2569a7cf09e8b7a67091e7
COLLECT_GCC_OPTIONS='-c' '-w' '-v' '-I'
'/home/kmodi/usr_local/apps/6/nim/devel/lib' '-I' '/home/kmodi/sandbox/nim'
'-o' '/tmp/kmodi/.cache/nim/stdinfile_d/@m..@s..@s..@s.
.@s..@sstdinfile.nim.c.o' '-mtune=generic' '-march=x86-64'
 as -v -W -I /home/kmodi/usr_local/apps/6/nim/devel/lib -I
/home/kmodi/sandbox/nim --64 -o /tmp/kmodi/.cache/nim/stdinfile_d/@m..@s.
.@s..@s..@s..@sstdinfile.nim.c.o /tmp/ccvkFqvG.s
GNU assembler version 2.20.51.0.2 (x86_64-redhat-linux) using BFD version
version 2.20.51.0.2-5.44.el6 20100205
COMPILER_PATH=/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/:/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/:/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/libexec/gcc/x86_64-pc-linux-gnu/:/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/:/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/
LIBRARY_PATH=/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/../lib64/:/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/:/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/:/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-c' '-w' '-v' '-I'
'/home/kmodi/usr_local/apps/6/nim/devel/lib' '-I' '/home/kmodi/sandbox/nim'
'-o' '/tmp/kmodi/.cache/nim/stdinfile_d/@m..@s..@s..@s.
.@s..@sstdinfile.nim.c.o' '-mtune=generic' '-march=x86-64'
Hint:  [Link]
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure
--prefix=/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0
--with-mpfr=/cad/adi/apps/gnu/linux/x86_64/6
--with-mpc=/cad/adi/apps/gnu/linux/x86_64/6
Thread model: posix
gcc version 6.1.0 (GCC)
COMPILER_PATH=/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/:/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/:/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/libexec/gcc/x86_64-pc-linux-gnu/:/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/:/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/
LIBRARY_PATH=/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/../lib64/:/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/:/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/:/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-o' '/tmp/kmodi/.cache/nim/stdinfile_d/stdinfile' '-v'
'-mtune=generic' '-march=x86-64'
 /cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/collect2
--eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o
/tmp/kmodi/.cache/nim/stdinfile_d/stdinfile /usr/lib/../lib64/crt1.o
/usr/lib/../lib64/crti.o
/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/crtbegin.o
-L/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/../lib64
-L/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0
-L/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-L/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib
-L/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../..
/tmp/kmodi/.cache/nim/stdinfile_d/stdlib_io.nim.c.o
/tmp/kmodi/.cache/nim/stdinfile_d/stdlib_system.nim.c.o
/tmp/kmodi/.cache/nim/stdinfile_d/@m..@s..@s..@s..@s..@sstdinfile.nim.c.o
-lm -ldl -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed
-lgcc_s --no-as-needed
/cad/adi/apps/gnu/linux/x86_64/6/local/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/crtend.o
/usr/lib/../lib64/crtn.o
collect2: fatal error: can't open nm output: Success
compilation terminated.
Error: execution of an external program failed: 'gcc   -o
/tmp/kmodi/.cache/nim/stdinfile_d/stdinfile
 /tmp/kmodi/.cache/nim/stdinfile_d/stdlib_io.nim.c.o
/tmp/kmodi/.cache/nim/stdinfile_d/stdlib_system.nim.c.o
/tmp/kmodi/.cache/nim/stdinfile_d/@m..@s..@s..@s..@s..@sstdinfile.nim.c.o
 -lm  -v  -ldl'


Can someone help figure out if this issue is due to something in my
environment or the way Nim handles gcc error codes?

Please do Reply All when replying as I am not subscribed to this mailing
list.

---

If someone doesn't mind reviewing the full debug effort of this issue on
the Nim issues page, here is the link:
https://github.com/nim-lang/Nim/issues/14060 .

Thanks.

--
Kaushal Modi

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Help figuring out why nim gives the "collect2: fatal error: can't open nm output" error with older gcc versions
  2020-04-22  3:59 Help figuring out why nim gives the "collect2: fatal error: can't open nm output" error with older gcc versions Kaushal Modi
@ 2020-04-22  4:03 ` Kaushal Modi
  0 siblings, 0 replies; 2+ messages in thread
From: Kaushal Modi @ 2020-04-22  4:03 UTC (permalink / raw)
  To: gcc-help

On Tue, Apr 21, 2020 at 11:59 PM Kaushal Modi <kaushal.modi@gmail.com>
wrote:

> Hello,
>
> I use gcc to compile the C/C++ code generated by Nim (
> https://nim-lang.org/).
>
> Nim has a feature where it can read in the nim code via pipe. So I can do
>
>     echo echo NimVersion | nim c -r -
>

I forgot to add an observation here.

Above should create an executable named stdinfile in the /tmp cache dir
($XDG_CACHE_HOME) and then run it.

Even though above fails with the "can't open nm output" fatal error, gcc
does actually end up compiling the stdinfile, which I can then manually run
and it runs fine.

The issue is that when nim is compiling that executable via gcc and then
running it, this fatal error happens somewhere inbetween.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-22  4:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22  3:59 Help figuring out why nim gives the "collect2: fatal error: can't open nm output" error with older gcc versions Kaushal Modi
2020-04-22  4:03 ` Kaushal Modi

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).