How to build a static lib properly?

ryuukk_ ryuukk.dev at gmail.com
Mon Mar 6 01:52:06 UTC 2023


On Monday, 6 March 2023 at 01:46:22 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
>> In the DCD's dub i changed targetType to "staticLibrary"
>
> You didn't need to do that, the default was correct.
>
>> Then i build:
>> 
>> ``dub build -c library`` for the library config
>
> Just ``$ dub build`` would've done it (first configuration is 
> default).
>
> Now for the errors, I think its a simple case of you are not 
> linking everything in. Use dub, don't do this manually.
>
> Here is the output for linking the client configuration, looks 
> a bit different ;)
>
> ```
> Linking dcd-client
> C:\Tools\D\ldc2-1.31.0-windows-multilib\bin\ldc2.exe 
> -of.dub\build\client-debug-windows-x86_64-ldc_v1.31.0-DF438D1296B6C9BC0E3D50D4EFA1EC5CE1C82F4ED9169185C58440A2BD5ED999\dcd-client.exe .dub\build\client-debug-windows-x86_64-ldc_v1.31.0-DF438D1296B6C9BC0E3D50D4EFA1EC5CE1C82F4ED9169185C58440A2BD5ED999\dcd-client.obj common\.dub\build\library-debug-windows-x86_64-ldc_v1.31.0-CF8574F0D3568FA37AB3781BE5A103C1AE1678C5ECADFFF15736AAEF48C13F12\dcd_common.lib C:\Users\alpha\AppData\Local\dub\packages\msgpack-d-1.0.1\msgpack-d\.dub\build\default-debug-windows-x86_64-ldc_v1.31.0-BA2035194DC7872ACAEF6D406F56AF24986B46F8626E1B06E81C1964C374BB12\msgpack-d.lib dsymbol\.dub\build\library-debug-windows-x86_64-ldc_v1.31.0-3E3FE60C47A7B98F87E3453CE72C2FF075DB7AD708F08100D68AACD7D4A3DD87\dcd_dsymbol.lib C:\Users\alpha\AppData\Local\dub\packages\emsi_containers-0.9.0\emsi_containers\.dub\build\library-debug-windows-x86_64-ldc_v1.31.0-04B3937CA3A0BD6CBBA647E8D9AB53AB78AB124AFAD7E416E7433F06812D4D00\emsi_containers.lib C:\Users\alpha\AppData\Local\dub\packages\libdparse-0.21.1\libdparse\.dub\build\library-debug-windows-x86_64-ldc_v1.31.0-E2B54AF26AC9977B374E024724763A7CD14ED2B981E84AA640F8193906B71D90\dparse.lib -g
> ```

Are you saying dub doesn't build a static dcd.lib?

What to do to make it so i get a static dcd.lib file that 
contains all the code it needs?

This comfort me in my desire to no longer use dub ever



More information about the Digitalmars-d-learn mailing list