Edrusb / DAR

DAR - Disk ARchive
http://dar.linux.free.fr/
GNU General Public License v2.0
138 stars 19 forks source link

error: invalid argument '-std=c++14' not allowed with 'C' #29

Closed ryandesign closed 3 years ago

ryandesign commented 3 years ago

Describe the bug

dar 2.7.1.RC1 fails to build for me on macOS 10.13.6 with Apple LLVM version 9.1.0 (clang-902.0.39.2) from Xcode 9.4.1. This compiler supports C++14 but defaults to C++98 mode so configure output contains:

checking for c++14 support... no
checking for c++ support with -std=c++14 option set... yes

(I guess that second message should be changed to read "checking for c++14 support with -std=c++14 option set".)

The build fails with:

depbase=`echo bnonzero.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    ccache /usr/bin/clang -DHAVE_CONFIG_H -I. -I../..  -DLIBDAR_MODE=64 -I'./../libdar' -DDAR_LOCALEDIR=\"/opt/local/share/locale\" -DDAR_SYS_DIR=\"\"  -I/opt/local/include   -std=c++14   -pipe -Os -Werror=implicit-function-declaration -arch x86_64 -MT bnonzero.o -MD -MP -MF $depbase.Tpo -c -o bnonzero.o bnonzero.c &&\
    mv -f $depbase.Tpo $depbase.Po
error: invalid argument '-std=c++14' not allowed with 'C'
make[3]: *** [bnonzero.o] Error 1

If however I configure with -std=c++14 in CXXFLAGS then configure output contains:

checking for c++14 support... yes

and the build succeeds. This suggests that when the configure script determines that it must add -std=c++14, it is adding it to more than just CXXFLAGS and maybe it shouldn't do that.

To Reproduce compile dar 2.7.1.RC1 with a version of clang that supports C++14 (e.g. open source clang 3.5 and later) but does not default to it (e.g. open source clang less than 6.0) (open source clang 3.4 supports C++14 but only with the -std=c++1y flag not the -std=c++14 flag)

Expected behavior Successful build

Screenshots n/a

Software used: dar 2.7.1.RC1 source code from https://dar.edrusb.org/dar.linux.free.fr/Interim_releases/ compiled with Apple LLVM version 9.1.0 (clang-902.0.39.2) from Xcode 9.4.1

Operating system used: macOS 10.13.6

Additional context n/a

Edrusb commented 3 years ago

Yep, I've fixed that too in 2.7.1.RC2 here Thanks for your feedback!

Edrusb commented 3 years ago

the just release 2.7.1 should have this fixed now, closing this issue

ryandesign commented 3 years ago

when the configure script determines that it must add -std=c++14, it is adding it to more than just CXXFLAGS and maybe it shouldn't do that

This problem still exists in 2.7.1.

Edrusb commented 3 years ago

yep I missed fixing it, reopening the issue.

Edrusb commented 3 years ago

I could reproduce the problem, 2.7.2.RC1 (release candidate) has a fix for that, 2.7.2 will be available in a few days

Edrusb commented 3 years ago

2.7.2 should be OK with that problem now, if it was still not the case :