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

Allow the user to overwrite a global -link-defaultlib-shared flag #2646

Closed
wilzbach opened this issue Apr 6, 2018 · 7 comments
Closed

Allow the user to overwrite a global -link-defaultlib-shared flag #2646

wilzbach opened this issue Apr 6, 2018 · 7 comments

Comments

@wilzbach
Copy link
Contributor

wilzbach commented Apr 6, 2018

Now that OS packers are starting to add the new -link-defaultlib-shared (see #2443) to their global ldc.conf file, this option breaks release build scripts somehow.
What do you think about:

  1. Adding a CLI flag to negate this, e.g. -disable-link-defaultlib-shared? (the last seen option would take precedence)
  2. Let -static overwrite the global -link-defaultlib-shared preference? At the moment one just gets an error:

Error: Can't use -link-defaultlib-shared and -static together

@kinke
Copy link
Member

kinke commented Apr 6, 2018

Adding a CLI flag to negate this

-link-defaultlib-shared=false is working as expected, last seen option takes precedence as usual.

Let -static overwrite the global -link-defaultlib-shared preference?

Would probably indeed be useful for distros shipping with a default -link-defaultlib-shared switch.

@wilzbach
Copy link
Contributor Author

wilzbach commented Apr 6, 2018

-link-defaultlib-shared=false is working as expected, last seen option takes precedence as usual.

Great! Just missing documentation then?

> ldc -help
...
Linking options:

  -L=<linkerflag>                         - Pass <linkerflag> to the linker
  -Xcc=<ccflag>                           - Pass <ccflag> to GCC/Clang for linking
  -defaultlib=<lib1,lib2,...>             - Default libraries to link with (overrides previous)
  -disable-linker-strip-dead              - Do not try to remove unused symbols during linking
  -link-defaultlib-debug                  - Link with debug versions of default libraries
  -link-defaultlib-shared                 - Link with shared versions of default libraries
  -linker=<lld-link|lld|gold|bfd|...>     - Linker to use
  -mscrtlib=<libcmt[d]|msvcrt[d]>         - MS C runtime library to link with
  -static                                 - Create a statically linked binary, including all system dependencies

Maybe the boolean flags could be marked with e.g. -link-defaultlib-shared=<true,false> somehow?
Not sure what the standard on this is - DMD would do this

-link-defaultlib-shared
-link-defaultlib-shared=<on,off>

(e.g.-color -> https://dlang.org/dmd#switch-color)

BTW is there any reason why ldc without args and ldc -help print different pages?

@kinke
Copy link
Member

kinke commented Apr 6, 2018

Maybe the boolean flags could be marked with e.g. -link-defaultlib-shared=<true,false> somehow?

It's just a default LLVM Boolean commandline option with default help formatting, which doesn't mark the Boolean options in a special way. -static is a bool too, as most other options are, so -static[=<true|TRUE|True|1|false|FALSE|False|0>] are all valid cmdline args.

BTW is there any reason why ldc without args and ldc -help print different pages?

I must confess I probably never invoked ldc2 without args and so will have to check its output. ;)

@kinke
Copy link
Member

kinke commented Apr 13, 2018

-static now overriding -link-defaultlib-shared & ldc2 without args printing categorized help (but still lacks the help footer, for which I didn't quickly find a solution).

@kinke kinke closed this as completed Apr 13, 2018
@p0nce
Copy link
Contributor

p0nce commented Jul 15, 2018

Hello,

What is the recommended way to say you want a static defaultlib? is it -static or -link-defaultlib-shared=false?

@kinke
Copy link
Member

kinke commented Jul 15, 2018

The latter, assuming you don't want to enforce static C libs too.

@p0nce
Copy link
Contributor

p0nce commented Jul 15, 2018

I hadn't thought about that. Indeed what we probably need is dynamic C libs, static D runtime (on POSIX).

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

No branches or pull requests

3 participants