[cfe-dev] cross compiling with 6.0.0 not finding gcc paths

Miller Henry via cfe-dev cfe-dev at lists.llvm.org
Wed Apr 18 12:35:23 PDT 2018


I’ve tried every path in my sysroot up to crtbegin.o and it doesn’t make a difference
/home/repo/jdx/wr8-baytrail_64/buildbox/
/home/repo/jdx/wr8-baytrail_64/buildbox/usr
/home/repo/jdx/wr8-baytrail_64/buildbox/usr/lib64/
/home/repo/jdx/wr8-baytrail_64/buildbox/usr/lib64/x86_64-wrs-linux
/home/repo/jdx/wr8-baytrail_64/buildbox/usr/lib64/x86_64-wrs-linux/5.2.0/

From: Tomasz Mikolajczyk [mailto:tmmikolajczyk at gmail.com]
Sent: Wednesday, April 18, 2018 2:01 PM
To: Miller Henry <MillerHenry at JohnDeere.com>
Cc: Manoj Gupta <manojgupta at google.com>; cfe-dev at lists.llvm.org
Subject: Re: [cfe-dev] cross compiling with 6.0.0 not finding gcc paths

I would try the following
--gcc-toolchain=/home/repo/jdx/wr8-baytrail_64/buildbox/usr/

On Wed, 18 Apr 2018, 20:54 Miller Henry via cfe-dev, <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>> wrote:
No.  I played with a few alternate paths, but that doesn’t seem to make a difference.  Any other ideas?

    [2/2] Linking C executable cmTC_68894
   FAILED: cmTC_68894
    : && /opt/jdx/tools//usr/bin/clang --sysroot=/home/repo/jdx/wr8-baytrail_64/buildbox -fno-omit-frame-pointer -gsplit-dwarf -v --gcc-toolchain=/home/repo/jdx/wr8-baytrail_64/buildbox/usr/lib64/ --target=x86_64-wrs-linux  --sysroot=/home/repo/jdx/wr8-baytrail_64/buildbox -rdynamic -O2 -L/home/repo/jdx/wr8-baytrail_64/buildbox/usr/local/lib -Wl,--gdb-index -lrt -lpthread -Wl,--disable-new-dtags CMakeFiles/cmTC_68894.dir/testCCompiler.c.o  -o cmTC_68894   && :
    clang version 6.0.0 (tags/RELEASE_600/final)
    Target: x86_64-wrs-linux
    Thread model: posix
    InstalledDir: /opt/jdx/tools//usr/bin
     "/opt/jdx/tools/sysroots/x86_64-wrlinuxsdk-linux/usr/bin/x86_64-wrs-linux/x86_64-wrs-linux-ld" --sysroot=/home/repo/jdx/wr8-baytrail_64/buildbox -export-dynamic -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_68894 /home/repo/jdx/wr8-baytrail_64/buildbox/usr/lib/../lib64/crt1.o /home/repo/jdx/wr8-baytrail_64/buildbox/usr/lib/../lib64/crti.o crtbegin.o -L/home/repo/jdx/wr8-baytrail_64/buildbox/usr/local/lib -L/home/repo/jdx/wr8-baytrail_64/buildbox/lib/../lib64 -L/home/repo/jdx/wr8-baytrail_64/buildbox/usr/lib/../lib64 -L/home/repo/jdx/wr8-baytrail_64/buildbox/lib -L/home/repo/jdx/wr8-baytrail_64/buildbox/usr/lib --gdb-index -lrt -lpthread --disable-new-dtags CMakeFiles/cmTC_68894.dir/testCCompiler.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o /home/repo/jdx/wr8-baytrail_64/buildbox/usr/lib/../lib64/crtn.o
   /opt/jdx/tools/sysroots/x86_64-wrlinuxsdk-linux/usr/bin/x86_64-wrs-linux/x86_64-wrs-linux-ld: error: cannot open crtbegin.o: No such file or directory
   /opt/jdx/tools/sysroots/x86_64-wrlinuxsdk-linux/usr/bin/x86_64-wrs-linux/x86_64-wrs-linux-ld: error: cannot open crtend.o: No such file or directory
    /opt/jdx/tools/sysroots/x86_64-wrlinuxsdk-linux/usr/bin/x86_64-wrs-linux/x86_64-wrs-linux-ld: error: cannot find -lgcc
    /opt/jdx/tools/sysroots/x86_64-wrlinuxsdk-linux/usr/bin/x86_64-wrs-linux/x86_64-wrs-linux-ld: error: cannot find -lgcc
    clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
   ninja: build stopped: subcommand failed.


From: Manoj Gupta [mailto:manojgupta at google.com<mailto:manojgupta at google.com>]
Sent: Wednesday, April 18, 2018 12:44 PM
To: Miller Henry <MillerHenry at JohnDeere.com<mailto:MillerHenry at JohnDeere.com>>
Cc: cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>
Subject: Re: [cfe-dev] cross compiling with 6.0.0 not finding gcc paths

Does it help to pass the following to the clang command line: --gcc-toolchain=/home/repo/jdx/wr8-baytrail_64/buildbox/usr/lib64 ?

On Wed, Apr 18, 2018 at 7:52 AM Miller Henry via cfe-dev <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>> wrote:


I’m building for an embedded system, this is working fine with gcc 5.2.0, but I’ve become interested in clang.  In 3.9.1 everything builds fine (once I fixed the real bugs – thank you to everyone who wrote useful warnings).  I’m interested in trying clang 6.0.0, and there things don’t build.

The first error I get is is from cmake:
    [2/2] Linking C executable cmTC_03cd5
FAILED: cmTC_03cd5
    : && /opt/jdx/tools//usr/local/share/icecc/bin//clang --sysroot=/home/user/repo/jdx/wr8-baytrail_64/buildbox -fno-omit-frame-pointer -gsplit-dwarf -fdiagnostics-color=always --target=x86_64-wrs-linux  --sysroot=/home/repo/jdx/wr8-baytrail_64/buildbox -rdynamic -O2 -L/home/repo/jdx/wr8-baytrail_64/buildbox/usr/local/lib -Wl,--gdb-index -lrt -lpthread -Wl,--disable-new-dtags CMakeFiles/cmTC_03cd5.dir/testCCompiler.c.o  -o cmTC_03cd5   && :
/opt/jdx/tools/sysroots/x86_64-wrlinuxsdk-linux/usr/bin/x86_64-wrs-linux/x86_64-wrs-linux-ld: error: cannot open crtbegin.o: No such file or directory
/opt/jdx/tools/sysroots/x86_64-wrlinuxsdk-linux/usr/bin/x86_64-wrs-linux/x86_64-wrs-linux-ld: error: cannot open crtend.o: No such file or directory
    /opt/jdx/tools/sysroots/x86_64-wrlinuxsdk-linux/usr/bin/x86_64-wrs-linux/x86_64-wrs-linux-ld: error: cannot find -lgcc
    /opt/jdx/tools/sysroots/x86_64-wrlinuxsdk-linux/usr/bin/x86_64-wrs-linux/x86_64-wrs-linux-ld: error: cannot find -lgcc
    clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)

crtbegin.o is in /home/repo/jdx/wr8-baytrail_64/buildbox/usr/lib64/x86_64-wrs-linux/5.2.0/crtbegin.o When I copy the missing files to /home/repo/jdx/wr8-baytrail_64/buildbox/usr/lib64 cmake passes and but the build fails on unable to find <string> and <vector>, I started to add include paths for jdx/wr8-baytrail_64/buildbox/usr/include/c++/5.2.0/ and that gets farther.  However it is time to stop hacking the wrong way and fix the real problem. I suspect the problem is related to clang not understanding my --target option and thus not asking gcc for the paths to the missing files, but I don’t really know how to make this work.

A search finds https://stackoverflow.com/questions/4160262/clang-linker-problem, but it isn’t helpful because the code in that area has changed so much.

My host is x86-64 linux.  The target OS is x86_64 embedded linux (the sysroot is NOT compatible with the host libraries)

Can someone give me a hint about where I should look to make this work. I can change either the command line arguments or the clang source code but I’m not clear on where the right place to look is.
_______________________________________________
cfe-dev mailing list
cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180418/5c848a44/attachment.html>


More information about the cfe-dev mailing list