Thread overview
[Issue 6431] [RDMD] Modifying a library doesn't trigger a rebuild
Dec 07, 2017
Timothee Cour
Dec 07, 2017
Timothee Cour
Dec 07, 2017
Timothee Cour
Dec 07, 2017
Timothee Cour
Dec 07, 2017
Timothee Cour
Dec 07, 2017
Timothee Cour
Jun 09, 2022
RazvanN
Dec 17, 2022
Iain Buclaw
December 07, 2017
https://issues.dlang.org/show_bug.cgi?id=6431

Timothee Cour <timothee.cour2@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timothee.cour2@gmail.com

--- Comment #5 from Timothee Cour <timothee.cour2@gmail.com> ---
reopening as i just bumped on this issue
rdmd build 20171126
DMD64 D Compiler v2.077.0

build_lib
build_main
edit bar/foo.d
build_lib
build_main => doesn't rebuild

./setup.sh:
## rdmd doesn't rebuild if a dependent library changes
build_lib(){
        dmd -of=libfoo.a -lib bar/foo.d
}

build_main(){
        exe=./main
        rdmd --build-only -of$exe -Llibfoo.a --exclude=bar main.d
        $exe
}


./main.d:
import bar.foo;
void main(){ fun(); }


./bar/foo.d:
module bar.foo;
import std.stdio;
void fun(){writeln("ok4");}

--
December 07, 2017
https://issues.dlang.org/show_bug.cgi?id=6431

Timothee Cour <timothee.cour2@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--
December 07, 2017
https://issues.dlang.org/show_bug.cgi?id=6431

Timothee Cour <timothee.cour2@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P1
                 OS|Windows                     |All
           Severity|normal                      |critical

--
December 07, 2017
https://issues.dlang.org/show_bug.cgi?id=6431

--- Comment #6 from Timothee Cour <timothee.cour2@gmail.com> ---
also:
* rdmd --makedepend doesn't mention the dependent libs (libfoo.a)
* dmd -deps neither
* dmd -v neither

--
December 07, 2017
https://issues.dlang.org/show_bug.cgi?id=6431

--- Comment #7 from Timothee Cour <timothee.cour2@gmail.com> ---
also:

when adding `pragma(lib, "foo");` in main.d:
(and s/-Llibfoo.a/-lfoo -L./ to make the build succeed), the dependency on lib
foo will appear in both --makedepend, -deps, -v, and the rebuild will happen.

without `pragma(lib, "foo");` in main.d:
the dependency is not caught even if command line mentions -Llibfoo.a or -lfoo
-L.

Is that desired behavior? requiring pragma(lib) seems less flexible

--
December 07, 2017
https://issues.dlang.org/show_bug.cgi?id=6431

--- Comment #8 from Timothee Cour <timothee.cour2@gmail.com> ---
ok the existing behavior is definitely buggy: when the dependent library is in a directory not equal to ".", a change to that library will not trigger recompilation:

```
./setup.sh:

## buggy behavior (correct behavior only with build_dir=.)
build_dir=temp

build_lib(){
        mkdir -p temp
        dmd -of=$build_dir/libfoo.a -lib bar/foo.d
}

build_main(){
        exe=./main
        rdmd -v --build-only -of$exe -L-lfoo -L-L$build_dir --exclude=bar
main.d
        $exe
}

build_all(){
        build_lib
        build_main
        touch $build_dir/libfoo.a
        build_main
}



./main.d:
pragma(msg, "compiling...");
import bar.foo;
pragma(lib, "foo");
void main(){ fun(); }


./bar/foo.d:
module bar.foo;
void fun(){
        import std.stdio;
        writeln("ok1");
}
```

--
June 09, 2022
https://issues.dlang.org/show_bug.cgi?id=6431

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com
          Component|dmd                         |tools

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=6431

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2

--