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

[BUG] Cannot link with :gcc built-in toolchain on MacOS #12

Closed
tcbrindle opened this issue Jan 6, 2020 · 1 comment · Fixed by #17
Closed

[BUG] Cannot link with :gcc built-in toolchain on MacOS #12

tcbrindle opened this issue Jan 6, 2020 · 1 comment · Fixed by #17
Labels
bug Something isn't working
Milestone

Comments

@tcbrindle
Copy link
Contributor

Describe the bug

In MacOS, /usr/bin/g++ actually invokes clang++. A simple test project using dds build -t :gcc compiles successfully, but fails to link as it cannot find libstdc++fs (and even if it could it probably wouldn't work).

Steps to Reproduce

  1. Write a simple test project
  2. Attempt to build with dds build -t :gcc
  3. Receive linker error message

dds Output

22:35:15] [info ] [example] Compile: example.test.cpp
[22:35:16] [info ] [example] Compile: example.test.cpp                          -     757ms [1/1]
[22:35:16] [info ] Compilation completed in 801ms
[22:35:16] [info ] Archiving completed in 0ms
[22:35:16] [info ] [example] Link: test/example                  
[22:35:16] [info ] [example] Link: test/example                   -     86ms
[22:35:16] [error] Failed to link executable [/Users/tristan/Coding/dds-experiments/example/_build/test/./example]. Link command was [g++ -fPIC -fdiagnostics-color /Users/tristan/Coding/dds-experiments/example/_build/obj/example.test.cpp.o /Users/tristan/Coding/dds-experiments/example/_build/_test-driver/v1/catch2/catch-main.cpp.o -pthread -lstdc++fs -o/Users/tristan/Coding/dds-experiments/example/_build/test/./example] [Exited 1], produced output:
ld: library not found for -lstdc++fs
clang: error: linker command failed with exit code 1 (use -v to see invocation)

[22:35:16] [error] Linking a runtime binary (executable/shared library/DLL) failed
[22:35:16] [error] 
Linking a runtime binary file failed. There are a variety of possible causes
for this error. Refer to the documentation for more information.

[22:35:16] [error] Refer: https://vector-of-bool.github.io/docs/dds/err/link-failure.html

Desktop (please complete the following information):

  • Operating System: MacOS
  • Compiler: Clang pretending to be GCC
  • dds Version: 0.1.0-alpha.2

Additional context

Perhaps on MacOS, the built-in :gcc toolchain should be special-cased to use the Clang Compiler-ID setting, rather than GNU? (Which also doesn't work right now, but that's #11 )

@tcbrindle tcbrindle added the bug Something isn't working label Jan 6, 2020
@vector-of-bool
Copy link
Owner

Urgh. This is one of those very aggravating platform quirks.

In this case, I think things will be fixed by removing -lstdc++fs as a default link flag. This was a flag that I needed for my own case but should never have been applied universally. Other than that, gcc being aliased to AppleClang should "just work."

@vector-of-bool vector-of-bool added this to the 0.1.0-alpha.3 milestone Jan 12, 2020
@vector-of-bool vector-of-bool added this to To do in 0.1.0-alpha.3 Jan 12, 2020
@vector-of-bool vector-of-bool moved this from To do to In progress in 0.1.0-alpha.3 Jan 12, 2020
@vector-of-bool vector-of-bool moved this from In progress to Done in 0.1.0-alpha.3 Jan 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
0.1.0-alpha.3
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants