Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 329797 - sys-devel/llvm-gcc should install as though it were vanilla gcc (via USE flag)
Summary: sys-devel/llvm-gcc should install as though it were vanilla gcc (via USE flag)
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High enhancement
Assignee: Bernard Cafarelli
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-25 16:04 UTC by Mark Wood
Modified: 2011-04-07 09:59 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wood 2010-07-25 16:04:41 UTC
Currently when you install any version of llvm-gcc, you cannot prompt portage to replace the system libstdc++ with the one provided by llvm-gcc. This creates problems when attempting to self-host clang or remove vanilla gcc (I have my reasons for doing this).

The fix could be implemented fairly easily by a use flag promting the llvm-gcc  libstdc++ to be copied to /usr/lib

Reproducible: Always

Steps to Reproduce:
1.emerge llvm-gcc
2.
3.

Actual Results:  
systems libstdc++ remains the one provided by gcc

Expected Results:  
libstdc++ is replaced by the one provided by llvm-gcc
Comment 1 Mark Wood 2010-07-25 18:34:16 UTC
(In reply to comment #0)
> Currently when you install any version of llvm-gcc, you cannot prompt portage
> to replace the system libstdc++ with the one provided by llvm-gcc. This creates
> problems when attempting to self-host clang or remove vanilla gcc (I have my
> reasons for doing this).
> 
> The fix could be implemented fairly easily by a use flag promting the llvm-gcc 
> libstdc++ to be copied to /usr/lib
> 
> Reproducible: Always
> 
> Steps to Reproduce:
> 1.emerge llvm-gcc
> 2.
> 3.
> 
> Actual Results:  
> systems libstdc++ remains the one provided by gcc
> 
> Expected Results:  
> libstdc++ is replaced by the one provided by llvm-gcc
> 

While trying to hack together a ebuild, I realized that the fix should allow llvm-gcc to install as though it were a vanilla gcc, replacing all related libraries and binaries (if possible)
Comment 2 Mark Wood 2010-08-08 20:08:11 UTC
Changed the bug title to properly reflect what the issue is.

I am not sure if it would be easy to create a gcc profile for llvm-gcc, but it would be highly appreciated.
Comment 3 Bernard Cafarelli gentoo-dev 2010-08-19 19:37:05 UTC
Hmm, yes this is probably doable, but this requires a lot of testing (like the new gcc versions masked in tree) and probably some toolchain update to allow "alternate" gcc. There were talks like that for icc support
Comment 4 Mark Wood 2010-08-19 19:56:31 UTC
(In reply to comment #3)
> Hmm, yes this is probably doable, but this requires a lot of testing (like the
> new gcc versions masked in tree) and probably some toolchain update to allow
> "alternate" gcc. There were talks like that for icc support
> 

Well, if you could do it, I certainly could test it :) It would be great to see the foundations laid for a more llvm friendly gentoo.
Comment 5 Fabian Groffen gentoo-dev 2010-08-22 18:22:37 UTC
hmmm, yeah, letting gcc-config deal with it, is most probably the most simple approach that also works.
Comment 6 Mark Wood 2010-08-22 19:32:19 UTC
(In reply to comment #5)
> hmmm, yeah, letting gcc-config deal with it, is most probably the most simple
> approach that also works.
> 

My thinking was that as llvm-gcc does everything that gcc does and uses the same libraries, creating a gcc-config wouldn't be hugely difficult. 
Comment 7 Fabian Groffen gentoo-dev 2010-08-22 20:07:52 UTC
Perhaps something like:

    # create gcc-config entry
    dodir /etc/env.d/gcc
    local gcc_envd_base="/etc/env.d/gcc/${CHOST}-llvm-${MY_PV}"

    gcc_envd_file="${ED}${gcc_envd_base}"
    echo "GCC_PATH=\"${BINPATH}\"" >> ${gcc_envd_file}

    # maybe this needs tweaking for multilib (llvm insists on being so)
    LDPATH="${LIBPATH}"
    echo "LDPATH=\"${LDPATH}\"" >> ${gcc_envd_file}
    echo "STDCXX_INCDIR=\"g++-v${GCC_VERS/\.*/}\"" >> ${gcc_envd_file}
    is_crosscompile && echo "CTARGET=${CTARGET}" >> ${gcc_envd_file}

But it seems the ebuild needs some path changes to better match gcc's layout.  So maybe this isn't as simple as I initially thought.
Comment 8 Mark Wood 2010-08-23 10:31:53 UTC
(In reply to comment #7)
> Perhaps something like:
>     # create gcc-config entry
>     dodir /etc/env.d/gcc
>     local gcc_envd_base="/etc/env.d/gcc/${CHOST}-llvm-${MY_PV}"
>     gcc_envd_file="${ED}${gcc_envd_base}"
>     echo "GCC_PATH=\"${BINPATH}\"" >> ${gcc_envd_file}
>     # maybe this needs tweaking for multilib (llvm insists on being so)
>     LDPATH="${LIBPATH}"
>     echo "LDPATH=\"${LDPATH}\"" >> ${gcc_envd_file}
>     echo "STDCXX_INCDIR=\"g++-v${GCC_VERS/\.*/}\"" >> ${gcc_envd_file}
>     is_crosscompile && echo "CTARGET=${CTARGET}" >> ${gcc_envd_file}
> But it seems the ebuild needs some path changes to better match gcc's layout. 
> So maybe this isn't as simple as I initially thought.


I would have thought the only ebuild change required in that respect would be to src_install()? Or is there some added complexity? I know that GCC ebuilds use an ETYPE (I don't know how that works), could llvm-gcc possibly also utilize this?
Comment 9 Mark Wood 2010-08-30 09:48:27 UTC
My understanding of ebuilds is poor at best. but to try and get things moving I might try and throw something together later and do some testing to see if it resembles something functional.
Comment 10 Fabian Groffen gentoo-dev 2010-08-30 10:31:39 UTC
If you want to play to try and see if you can get it sort of working, have a look at e.g. qlist sys-devel/gcc to see where files are stored, and look into toolchain.eclass for some of the voodoo behind it.  sys-devel/gcc-apple might reveal some things for you as well.  Also have a look at gcc-config and what it looks for to detect and switch to a gcc profile.
Comment 11 Mark Wood 2010-08-31 10:42:47 UTC
(In reply to comment #10)
> If you want to play to try and see if you can get it sort of working, have a
> look at e.g. qlist sys-devel/gcc to see where files are stored, and look into
> toolchain.eclass for some of the voodoo behind it.  sys-devel/gcc-apple might
> reveal some things for you as well.  Also have a look at gcc-config and what it
> looks for to detect and switch to a gcc profile.

Had an attempt at splicing a gcc ebuild with the llvm-gcc ebuild and it didn't work out very well, issues with toolchain.eclass. So I'll need to look at making "inherit toolchain" work or manually do whatever it is that toolchain.eclass does.

Also just to note that this doesn't imply the task is very difficult, it's just that my lack of experience in writing ebuilds means this is mostly guesswork :)

If it does turn out to be a large task, it would probably be more worthwhile to focus efforts on allowing clang to replace gcc (which would most likely be a large project) as llvm-gcc isn't heavily developed any more and Apple's decision to make llvm/clang the default compiler framework in XCode 4 will accelerate development and make clang a viable GCC replacement in the near future. 

Also just to note, should the clang work be seen as the best option, the only work that _should_ be needed is to create a clang gcc-config, or something similar. Canonical have indicated they intend to make clang the default compiler in the near future (even considering 2.8 as a starting point) which means lots of nice upstream code to make everything build properly.
Comment 12 Mark Wood 2010-08-31 10:55:09 UTC
Your tip about gcc-apple may have been a good one. It appears to do what I want, but since I'm no ebuild wizard it might take me a while to fix it for llvm-gcc.

What I will also need to look at is whether or not any version of glibc builds these days, because this would be fairly pointless if it can't build a core component of the system.
Comment 13 Bernard Cafarelli gentoo-dev 2011-04-07 09:59:46 UTC
llvm-gcc will be officially dropped upstream in next release in favor of clang and dragonegg, so marking this bug as WONTFIX.

Hacked support for dragonegg would be possible, it "just" needs a gcc profile which loads its plugin, but first we need dragonegg in tree and a gcc that supports it (probably 4.6, need to test it)