LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 08-05-2016, 06:49 PM   #1
Haythem
Member
 
Registered: Jun 2012
Distribution: Slackware
Posts: 79

Rep: Reputation: Disabled
clang target issue


I'm building from 7.9 version of the book, I built llvm with clang but I'm not able to compile simple programs by clang.

I bieleve the problem is the default target in clang is different than my lfs target
Code:
root@lfs://usr/lib64/gcc# clang --version
clang version 3.8.1 (tags/RELEASE_381/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
However my gcc target is:
Code:
/usr/lib64/gcc/x86_64-lfs-linux/5.3.0/
I can compile simple programs by clang with:
Code:
clang --target=x86_64-lfs-linux foo.c
My question is how to compile llvm with default target name x86_64-lfs-linux
I tried -DLLVM_TARGETS_TO_BUILD="x86_64-lfs-linux;AMDGPU" but doesn't compile.

Thanks you
 
Old 08-08-2016, 12:42 PM   #2
Krejzi
Member
 
Registered: Jan 2015
Posts: 215

Rep: Reputation: Disabled
First of all, your LFS target is wrong if you followed the book. It should be x86_64-pc-linux-gnu on GCC 5.x and later. And the target doesn't really matter for clang. You'd need to patch it manually so it displays the correct triple (again, which doesn't matter at all).
 
Old 08-08-2016, 01:42 PM   #3
Haythem
Member
 
Registered: Jun 2012
Distribution: Slackware
Posts: 79

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Krejzi View Post
First of all, your LFS target is wrong if you followed the book. It should be x86_64-pc-linux-gnu on GCC 5.x and later. And the target doesn't really matter for clang. You'd need to patch it manually so it displays the correct triple (again, which doesn't matter at all).
I'm following the book with minor changes like buildign x86_64 version, and gcc target triplet, (very few minor changes). However I could fix the target triplet name by setting this variable during build -DLLVM_DEFAULT_TARGET_TRIPLE.
 
Old 08-08-2016, 01:43 PM   #4
Krejzi
Member
 
Registered: Jan 2015
Posts: 215

Rep: Reputation: Disabled
Again, out of curiosity, why does the clang target matter?
 
Old 08-08-2016, 02:00 PM   #5
Haythem
Member
 
Registered: Jun 2012
Distribution: Slackware
Posts: 79

Original Poster
Rep: Reputation: Disabled
because if default target is not set correctly, clang shows this error when trying to compile foo.c program:
/
Code:
usr/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/bin/ld: cannot find -lgcc
clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)
and I have to pass --target=x86_64-lfs-linux to clang everytime. I thin it should be the case even with lfs book target, have to set --target=x86_64-pc-linux-gnu otherwise clang wont work (i haven't tested it though).
 
Old 08-08-2016, 02:07 PM   #6
Krejzi
Member
 
Registered: Jan 2015
Posts: 215

Rep: Reputation: Disabled
Ah, right. That makes sense. Again, out of curiosity, why did you change the gcc target to contain lfs? Branding, marketing, something else?
 
Old 08-08-2016, 02:11 PM   #7
Haythem
Member
 
Registered: Jun 2012
Distribution: Slackware
Posts: 79

Original Poster
Rep: Reputation: Disabled
I use slackware and the gcc target for slackware is x86_64-slackware-linux-gnu. I don't have to stick with default gcc target so changed it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to determine asymmetric routing issue when ping target not working zousheng Linux - Newbie 3 12-14-2014 07:36 AM
LXer: LLVM Clang 3.3, Early Clang 3.4 Benchmarks LXer Syndicated Linux News 0 06-23-2013 10:00 PM
[SOLVED] issue: iptables: No chain/target/match by that name bschulte Linux - Networking 3 09-20-2011 12:02 PM
Slack 13 - no target disk - Acer Aspire one 11.6 - sata issue? egrep Slackware 15 11-12-2009 01:46 AM
issue with indexmaker (mrtg) and special characters within target html file hernandezf001 Linux - Server 1 06-26-2009 02:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 11:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration