Cataclysm-DDA icon indicating copy to clipboard operation
Cataclysm-DDA copied to clipboard

Makefile: ignore unused argument warning when linking

Open BouncyMaster opened this issue 2 years ago • 3 comments

Summary

None

Purpose of change

At least on OpenBSD with clang, passing -stdlib=libc++ when linking gives this error:

clang++: error: argument unused during compilation: '-stdlib=libc++'   [-Werror,-Wunused-command-line-argument]

Although not passing the argument when linking works on OpenBSD, it does not on Linux with clang and USE_LIBCXX=1.

Describe the solution

We ignore the warning we might get on BSDs while keeping the argument for systems where it is actually needed.

Describe alternatives you've considered

Not passing -stdlib=libc++ to LDFLAGS if building on BSDs. However, testing if the behaviour is the same on all other BSDs would be time consuming.

Testing

Successfully built tiles on OpenBSD with clang with this change.

Additional context

This is a continuation of this closed PR: #60208

BouncyMaster avatar Aug 17 '22 15:08 BouncyMaster

You could try to figure out if libc++ is used by default with something like echo 'int main(){}' | clang++ -x c++ - && ldd a.out|grep libc\+\+ and only passing the parameter if it's not.

andrei8l avatar Aug 17 '22 15:08 andrei8l

There is a catch, the ldd command does not exist on macOS.

BrettDong avatar Aug 18 '22 01:08 BrettDong

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not 'bump' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

stale[bot] avatar Sep 21 '22 03:09 stale[bot]