Menu

#21 Build fails when dependency tracking is disabled

v1.15
closed-works-for-me
nobody
None
5
2020-07-09
2020-07-07
No

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).

Discussion

  • Shachar Shemesh

    Shachar Shemesh - 2020-07-07

    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.

     
  • Shachar Shemesh

    Shachar Shemesh - 2020-07-07
    • status: open --> closed-works-for-me
     
  • Ryan Carsten Schmidt

    I am building in a clean directory. I build tons of software with --disable-dependency-tracking and 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:

    # If the compiler supports precompiled headers the GNU way, we need to add a few rules here
    if PRECOMPILED_HEADERS
    # Generate precompiled headers
    precomp.h.gch: precomp.h
        $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.h.Tpo -c -o $@.comp $<
        mv -f $(DEPDIR)/$*.h.Tpo $(DEPDIR)/$*.h.Po
        mv -f $@.comp $@
    

    PRECOMPILED_HEADERS is a variable set by your configure.ac:

    # Checks for compiler precompiled headers support
    AC_MSG_CHECKING([whether compiler supports gcc style precompiled headers])
    
    touch conftest.h
    rm -f a.out
    if $CXX -c conftest.h >/dev/null 2>&1 && test "! -e a.out -a -f conftest.h.gch"
    then
        AM_CONDITIONAL(PRECOMPILED_HEADERS, true)
        AC_MSG_RESULT([yes])
    else
        rm -f a.out
        AM_CONDITIONAL(PRECOMPILED_HEADERS, false)
        AC_MSG_RESULT([no])
    fi
    

    Whether or not I'm using --disable-dependency-tracking , ./configure output says:

    checking whether compiler supports gcc style precompiled headers... yes
    

    Please reopen this bug report.

     
  • Ryan Carsten Schmidt

    I think at least one problem with the code in your configure.ac is that

    test "! -e a.out -a -f conftest.h.gch"
    

    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:

    test ! -e a.out -a -f conftest.h.gch
    

    But that still doesn't fully fix the problem.

    One way to improve the situation is to use $CXXFLAGS when doing the conftest:

    if $CXX $CXXFLAGS -c conftest.h
    

    That way, when $CXXFLAGS contains multiple -arch flags, as it did in my initial case in #19, the compilation of conftest.h will fail (with the error clang: 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-tracking is used when only a single -arch flag (or no -arch flag) is used, since your code assumes a .deps directory will be created but with --disable-dependency-tracking it 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).

     
  • Shachar Shemesh

    Shachar Shemesh - 2020-07-08

    I am going to solve bug #19 by removing precompiled headers altogether. As such, reopening this ticket is moot.

     
  • Ryan Carsten Schmidt

    That'll work, thank you.

     

Log in to post a comment.