[Issue 9805] New: DFLAGS append behavior insufficient, DFLAGS_PRE also needed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 24 03:45:57 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9805

           Summary: DFLAGS append behavior insufficient, DFLAGS_PRE also
                    needed
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: j.e.aten at gmail.com


--- Comment #0 from Jason E. Aten <j.e.aten at gmail.com> 2013-03-24 03:45:55 PDT ---
Related to Issue 6822, recent alterations in the Ubuntu (showed up in 12.04
precise for me)  default options to the linker ld make it so that the argument
order to the linker can become critical. Details:
https://wiki.ubuntu.com/NattyNarwhal/ToolchainTransition

Case study: In order to successfully link the Thrift bindings for D during a
make check on the D test suite for Thrift
(https://github.com/apache/thrift.git), I was forced to manually pre-pend
options to the dmd command line. Fortunately there were only 6 files that
needed manually compiling, but had the project been larger, the lack of a way
to prepend compiler and linker options to the dmd command line would have been
disastrous.  As the documentation for DFLAGS notes, these options are suffixed
(appended) to the dmd command line. Unfortunately the recent linker default
changes in Ubuntu (--as-needed is now the default in 12.04, ugh) makes the
linker very sensitive to the exact sequence and order of the linker options.

Example of non-successful compile: (note that the -L--no-as-needed is at the
end, the same place that DFLAGS in dmd.conf places it)

dmd -L-levent ../libthriftd-event.a -L-lssl -L-lcrypto ../libthriftd-ssl.a -w
-wi -O -release -inline -I../../../lib/d/src -Igen-d
../../../lib/d/libthriftd.a -ofclient_pool_test client_pool_test.d 
-L--no-as-needed


Example of successful compile:

dmd   -L--no-as-needed -L-levent ../libthriftd-event.a -L-lssl -L-lcrypto
../libthriftd-ssl.a -w -wi -O -release -inline -I../../../lib/d/src -Igen-d
../../../lib/d/libthriftd.a -ofclient_pool_test client_pool_test.d 


The only difference is that the -L--no-as-needed comes at the beginning.

Hence we should implement an additional version of DFLAGS called DFLAGS_PRE
that prepends instead of appends its options to the dmd command line.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list