Build fails when dependency tracking is disabled
Brought to you by:
thesun
Hi, rsyncrypto 1.14 doesn't build on macOS if the --disable-dependency-tracking argument is passed to configure:
./configure --disable-dependency-tracking
/usr/bin/clang++ -DHAVE_CONFIG_H -I. -I/opt/local/include -pipe -Os -std=c++11 -stdlib=libc++ -arch x86_64 -MT precomp.h.gch -MD -MP -MF .deps/.h.Tpo -c -o precomp.h.gch.comp precomp.h
clang: warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated [-Wdeprecated]
error: error opening '.deps/.h.Tpo': No such file or directory
1 error generated.
make: *** [precomp.h.gch] Error 1
It builds fine if I don't pass --disable-dependency-tracking to ./configure, however it is necessary to pass --disable-dependency-tracking to ./configure in order to build for multiple architectures simultaneously (a "universal" build).
This problem did not reproduce on my system. Please make sure that you are building from a clean directory (run
make distclean).If the problem persists, please report it as a bug on
automake, as rsyncrypto uses that to track dependencies.I am building in a clean directory. I build tons of software with
--disable-dependency-trackingand rsyncrypto 1.14 is the only one that fails this way. (Even rsyncrypto 1.12 didn't fail this way.)I think it is caused by this code in your Makefile.am:
PRECOMPILED_HEADERSis a variable set by your configure.ac:Whether or not I'm using
--disable-dependency-tracking,./configureoutput says:Please reopen this bug report.
I think at least one problem with the code in your configure.ac is that
does nothing useful. It's just testing a string. It'll give the same result as testing any other string, such as
test "hello world". You probably meant to write it without the quotes:But that still doesn't fully fix the problem.
One way to improve the situation is to use
$CXXFLAGSwhen doing the conftest:That way, when
$CXXFLAGScontains multiple-archflags, as it did in my initial case in #19, the compilation of conftest.h will fail (with the errorclang: error: cannot use 'precompiled-header' output with multiple -arch options), so the build wil not try to make precompiled headers and the build will succeed.However, the build will still fail if
--disable-dependency-trackingis used when only a single-archflag (or no-archflag) is used, since your code assumes a .deps directory will be created but with--disable-dependency-trackingit won't be. So you should also check the value of$enable_dependency_tracking, which could be "yes" or "no" or the empty string.I believe the attached patch covers all the cases. It works for me in every scenario I tried (single arch dependency tracking disabled; single arch dependency tracking enabled; single arch not specifying dependency tracking (default is enabled); two-arch dependency tracking disabled).
I am going to solve bug #19 by removing precompiled headers altogether. As such, reopening this ticket is moot.
That'll work, thank you.