www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Bug 96] New: phobos build doesn't use CFLAGS_FOR_BUILD in most cases


             Bug #: 96
           Summary: phobos build doesn't use CFLAGS_FOR_BUILD in most
    Classification: Unclassified
           Product: GDC
           Version: development
          Platform: x86
        OS/Version: Other
            Status: NEW
          Severity: major
          Priority: Normal
         Component: libgphobos
        AssignedTo: ibuclaw gdcproject.org
        ReportedBy: slavo5150 yahoo.com

Created attachment 56
  --> http://bugzilla.gdcproject.org/attachment.cgi?id=56

Migrated from

Matthew Caron - 2012-06-06
If you configure the build with CFLAGS_FOR_BUILD set (not CFLAGS) as
crosstool-ng-dlang (https://bitbucket.org/xdpcx/crosstool-ng-dlang/) does, you
won't get those flags passed in to what you're building correctly.

This is especially troublesome when trying to build with -fno-section-anchors
as proscribed in the infamous issue 120

The attached patch, while inelegant, fixes the problem by liberally seasoning
the build rules with CFLAGS_FOR_BUILD. It is not necessarily elegant, but
illustrates the principle and actually works. It should apply cleanly to the
default branch.

See attachment <lots_of_cflags.patch>

Iain Buclaw - 2012-06-06
1. It should be DFLAGS, not CFLAGS
2. You will want to assign CFLAGS to OUR_CFLAGS, rather than paste it
3. Similarly for DFLAGS, assign it to ALL_DFLAGS so it will be included where
4. The name FLAGS_FOR_BUILD could probably be named FLAGS_FOR_TARGET, as it
appropriately matches where you will be wanting to use them (when I see BUILD,
I think of the host the compiler will be running off, not the target it is
compiling for). 

If you make a pull request on github, and I'll look it over.



Matthew Caron - 2012-06-07
Thanks for the feedback, Iain. I will make the requested changes and submit a
pull request from github.

Please note that, without making changes to crosstool-ng (which is even more
difficult than making changes to gdc, as crosstool-ng is a bit of a jumbly mess
in spots), I can't rename certain variables, since it's kind of a "this is how
crosstool calls gcc's build". In the end, I patched it how I did because it
ended up being the path of least resistance. If I could have figured out how to
get crosstool-ng to pass DFLAGS to the build, I would have just done that.

I know that this seems like a really poor solution, and I make no defense of
it, save that it actually works and it got me where I needed to be.

Anyway, it may take me some time to do this - since I've gotten what needs to
be done finished, this has now become an "on my own time" project. So, expect a
pull request and further correspondence from a different account/email
address/etc., because I'll be working at it from home.

Matthew Caron - 2012-07-13
So, finally, after a month, I'm getting back to this.

Your point about FLAGS_FOR_TARGET is well taken, and I'm working to fix that.
However, it's not that simple. The main application here is building it under
crosstool, and I cannot, for the life if me, find where CFLAGS_FOR_TARGET gets
set - it's set when libphobos gets built to: "CFLAGS_FOR_TARGET=-g -Os", but I
can't figure out where that comes from, and it's driving me nuts (I've been
researching it for about six hours already).

Configure bugmail: http://bugzilla.gdcproject.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
Feb 01 2014