Skip to Content.
Sympa Menu

svadev - Re: [svadev] clang: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)

svadev AT lists.siebelschool.illinois.edu

Subject: Svadev mailing list

List archive

Re: [svadev] clang: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)


Chronological Thread 
  • From: Jonas Wagner <jonas.wagner AT epfl.ch>
  • To: Stefan.Scheruebl AT continental-corporation.com
  • Cc: svadev AT cs.uiuc.edu
  • Subject: Re: [svadev] clang: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)
  • Date: Fri, 21 Nov 2014 23:45:38 +0100
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/svadev/>
  • List-id: <svadev.cs.uiuc.edu>

Hi,

Great that it works now!

The errors that you see feel a bit mysterious to me... let me tell you what should happen:

- You invoke clang for linking, and pass the -fmemsafety option. e.g.:

        clang -fmemsafety foo.o bar.o -o foobar

  Usually, you can achieve this behavior if you set LDFLAGS=-fmemsafety prior to invoking ./configure or so.

- The clang driver sees the -fmemsafety option, and transforms it to a set of libraries and libpaths.
- Clang invokes the system linker without the -fmemsafety option, but with the object files and all the libraries required for memsafety.

Now I haven't tested this very recently... and never on Cygwin. Would it be a lot of trouble for you to develop under Linux? VMs are quite quick to set up these days :)

Cheers,
Jonas

On Wed, Nov 19, 2014 at 6:42 AM, <Stefan.Scheruebl AT continental-corporation.com> wrote:
Hi Jonas,

thanks for your response! Main thing first - I'm now able to compile without errors :-)

But I think I've still knowlege leaks regarding the Clang/LLVM design. So I try to explain what has happend in my fail case out of my view - correct me if I'm wrong...

1) Clang is the C-Frontend and works properly with the -fmemsaftey option (in my clang compilation)
2) The Clang compilation uses the native linker - in my case part of gcc - to link the native executeable which does not supply the -fmemsafety option support
3) LLVM supplies no native linker - till now - only a IR code linker
4) So the linker works correct if the -fmemsafety option is not used but in my case I forgot to add the safecode libraries to the linker call

Question:
1: How can I configure the clang compilation in a way that the linker is called without this -fmemsafety option automatically?
2: How can I configure the clang compilation in a way that the missing safecode libraries are automatically assigned to the linker command line when I call clang?

This command worked for me - how can I compile clang to use all the parameter as default?

$ CFLAGS="-g -fmemsafety -integrated-as" clang testcode.c -I/home/uid04950/WORK/LLVM_INSTALL/include -L/home/uid04950/WORK/LLVM_INSTALL/lib -lsc_dbg_rt -lsc_bb_rt -lgcc -lpoolalloc_bitmap -lstdc++ -lgdtoa -lgdtoa -lgcc_s -lc

Stefan




Von:        Jonas Wagner <jonas.wagner AT epfl.ch>
An:        Stefan.Scheruebl AT continental-corporation.com,
Kopie:        svadev AT cs.uiuc.edu
Datum:        18.11.2014 14:47
Betreff:        Re: [svadev] clang: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)




Hi,

sorry for the late reply!

In the second case, the linker command likely fails because you didn't add the -fmemsafety option to the linker command line.

In the first case, it seems to fail because gcc does not recognize the -fmemsafety flag. I don't understand why clang would call GCC to link the program instead of doing it itself. Maybe this is the default behavior under cygwin? Have you checked whether the issue arises also when you run this under Linux?

Best,
Jonas





Archive powered by MHonArc 2.6.16.

Top of Page