Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try using libtool to enable building dub static library dependencies per package #97

Open
atilaneves opened this issue Nov 19, 2020 · 1 comment

Comments

@atilaneves
Copy link
Owner

This ninja rule should do it:

libtool --mode=link --tag=CC cc -o $out $in
@kinke
Copy link
Contributor

kinke commented Feb 10, 2021

This is crucial, I've just stumbled upon this as major blocker for effective parallelization. So currently each static lib dub dependency is built via dmd -lib <all src files>, which makes the compiler compile all modules at once to individual object files and then archive them to a static lib. To replicate this with per-D-package building, the compiler would need to be invoked like this:

dmd -c src/a/a1.d src/a/a2.d -od=objs -op
=> builds package a: objs/src/a/a{1,2}.o
dmd -c src/b/b1.d src/b/b2.d -od=objs -op
=> builds package b: objs/src/b/b{1,2}.o
dmd -lib -ofmylib.a objs/src/a/a{1,2}.o objs/src/b/b{1,2}.o
=> using the D compiler for archiving allows LTO libs to be archived with LDC (not supported by ar)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants