Issue 21046 - How to remove unittest when linking
Summary: How to remove unittest when linking
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: druntime (show other issues)
Version: D2
Hardware: x86_64 Linux
: P4 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-16 08:24 UTC by cbleser
Modified: 2024-12-07 13:40 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description cbleser 2020-07-16 08:24:35 UTC
I have not been able to finf a way to link program without unittest if I link with library archives which has been compile with -unittest.

The if just one of the .a/.o has been compile with -unittest the main program is linked with unittest.

This means that you have to recompile all the libraries or else the main just run the unittest.

This has changed after the dmd compiler --DRT-testmode=run-main was introduced.

I don't know if the dmd/linker has a switch which can force unittest out of the linking process?

Best
Carsten
Comment 1 Rainer Schuetze 2020-07-18 06:43:50 UTC
I guess you didn't mean to set component "visuald".

I don't think you can easily strip the unittests, because they are referenced by the ModuleInfo that is generated for each module. A workaround might be to embed the testmode setting into the executable:

extern(C) __gshared string[] rt_options = [ "testmode=run-main" ];
Comment 2 dlangBugzillaToGithub 2024-12-07 13:40:33 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/17409

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB