www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4095] New: compiling with -op -od and using absolute paths for source files make dmd write object files anywhere

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4095

           Summary: compiling with -op -od and using absolute paths for
                    source files make dmd write object files anywhere
           Product: D
           Version: 1.057
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: nfxjfg gmail.com


--- Comment #0 from nfxjfg gmail.com 2010-04-15 17:53:13 PDT ---
When passing absolute paths to dmd, compiling with -op and -od will make dmd
write the object file into the same directory as the source file. But it really
should write somewhere inside the directory passed by -od.

Demonstration:
cd /tmp/x/
dmd -op -od/tmp/x/ /tmp/test/foo.d
# dmd creates /tmp/test/foo.o
# it really should crate it somewhere under /tmp/x/
# (maybe /tmp/x/tmp/test/foo.o ?)

This makes -op and -od utterly useless for build scripts or any other advanced
use. Actually, it makes dmd look like dirtying include directories, and you
have to manually clean up them.

What is the point of -od, when dmd decides to write the object files somewhere
else anyway? It doesn't make any sense, thus it must be a bug.

Note that build scripts can not use -od without -op: modules with same name
(but different packages) will map to the same filename. E.g. modules a.foo and
b.foo will both map to foo.o, and dmd will simply overwrite one of these files,
leading to missing symbols in the linker stage.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 15 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4095



--- Comment #1 from nfxjfg gmail.com 2010-04-15 18:00:36 PDT ---
Note that ldc supports the -oq switch, which is much more friendlier to build
scripts. Bug 3541 has a patch to enhance dmd with -oq. In combination with
-deps, -oq uses object filenames that can be easily known by build script,
instead of having to emulate dmd's path handling to find out the final object
filename.

E.g. in the example above, where should foo.o really be written? The
filename/path must not clash with other modules named "foo", and using the
package name seems the simplest solution. Which is exactly what -oq does.

Further note that the only properly working build tool for D, xfbuild, uses
incredible kludges to work this around. When there are modules with the same
name/different packages, it does several compile runs to avoid dmd overwriting
the object files it just created in the same run.

I hope this is motivation enough to solve this problem "upstream".

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 15 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4095



--- Comment #2 from nfxjfg gmail.com 2010-04-15 18:06:07 PDT ---
I have to add that this doesn't really only apply to absolute paths. Relative
paths to source files exhibit similarly messed up behavior, but I'm not really
sure why or what it actually does or is supposed to do. It's something for a
separate bug report.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 15 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4095



--- Comment #3 from nfxjfg gmail.com 2010-12-02 09:43:39 PST ---
As of dmd 1.065, the behaviour seems to be slightly different. Anyway, it still
doesn't work. dmd keeps overwriting its own object files if there are modules
with same name from different packages.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 02 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4095



--- Comment #4 from nfxjfg gmail.com 2010-12-02 10:16:51 PST ---
(In reply to comment #3)
 dmd keeps overwriting its own object files if there are modules
 with same name from different packages.
Scratch that, up on closer inspection, the problem is exactly the same as described in the initial comment. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 02 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4095


nfxjfg gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 06 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4095


Brad Roberts <braddr puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |braddr puremagic.com
         Resolution|WONTFIX                     |


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 06 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4095


Manu <turkeyman gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |turkeyman gmail.com


--- Comment #5 from Manu <turkeyman gmail.com> 2013-07-31 15:08:38 PDT ---
This is still a problem...
VisualD makes use of this extensively, which causes lots of problems.
Plz can haz fix? :)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 31 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4095


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #6 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-07-31
15:13:50 PDT ---
(In reply to comment #1)
 Note that ldc supports the -oq switch, which is much more friendlier to build
 scripts. Bug 3541 has a patch to enhance dmd with -oq.
It also has a pull, but it needs more votes: https://github.com/D-Programming-Language/dmd/pull/1871 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 31 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4095



--- Comment #7 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-07-31
15:14:41 PDT ---
Btw why is this tagged as only D1, doesn't it affect D2 as well?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 31 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4095


Manu <turkeyman gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Platform|Other                       |All
            Version|1.057                       |D1 & D2
         OS/Version|Linux                       |All


--- Comment #8 from Manu <turkeyman gmail.com> 2013-07-31 15:17:53 PDT ---
I guess it's just ancient ;)

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