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

The GCC build does not work with MingW/TDM #9

Open
BobVul opened this issue Dec 2, 2014 · 4 comments
Open

The GCC build does not work with MingW/TDM #9

BobVul opened this issue Dec 2, 2014 · 4 comments
Assignees
Labels
Milestone

Comments

@BobVul
Copy link

BobVul commented Dec 2, 2014

The GCC build passes -static-libstdc++, which is not a valid option in TDM-GCC (http://stackoverflow.com/a/19080526). Apparently static linking is the default anyway.

This is probably more TDM-GCC doing something wrong, since this probably shouldn't be reported as an error (aborting compilation).

Possible workarounds in the build script include checking the GCC version or retrying without that option on error. Neither option is particularly nice.

I leave this issue here in case someone else stumbles on the same problem.

@BobVul
Copy link
Author

BobVul commented Dec 2, 2014

This is actually fixed in TDM-GCC 4.8.1:

The "-static-libstdc++" option, though still unnecessary, no longer causes a compilation error.

@BobVul BobVul closed this as completed Dec 2, 2014
@alecmev
Copy link
Owner

alecmev commented Dec 2, 2014

As far as I know, GCC uses the shared version of libstdc++, if it's available:

When the g++ program is used to link a C++ program, it normally automatically links against libstdc++. If libstdc++ is available as a shared library, and the -static option is not used, then this links against the shared version of libstdc++. Source.

That's why I've specified it explicitly. However, I could probably just reduce it to -static.

@BobVul
Copy link
Author

BobVul commented Dec 2, 2014

TDM-GCC is, ah... different from vanilla GCC. From their quirks page:

  • TDM-GCC doesn't link your programs with the libgcc or libstdc++ runtime DLLs by default.
  • Other toolchains default to DLL runtime linkage in order to allow you to throw exceptions among DLLs and EXEs.
  • TDM-GCC lets you throw exceptions among DLLs and EXEs even with the static runtime.
  • Your programs will not rely on any additional DLLs when compiling with default options.
  • TDM-GCC still includes DLL versions of the libgcc and libstdc++ runtimes, which you can enable for your program with "-shared-libgcc" and "-shared-libstdc++" if desired.

As quoted earlier, the -static-libstdc++ option was only added in 4.8.1.

TDM-GCC is fairly popular as a Win32 port of GCC (the other major one being MingW, which TDM-GCC is based on). It's also the default for Code::Blocks. So, not exactly obscure, but considering they've fixed it in the latest version it matters even less now.

@alecmev
Copy link
Owner

alecmev commented Dec 2, 2014

I see. But still, replacing -static-libgcc -static-libstdc++ with -static probably wouldn't hurt anybody, while adding out-of-the-box compatibility with older versions of TDM-GCC.

@alecmev alecmev reopened this Dec 2, 2014
@alecmev alecmev added the bug label Dec 2, 2014
@alecmev alecmev added this to the 1.3.0 milestone Dec 2, 2014
@alecmev alecmev self-assigned this Dec 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants