scttnlsn / dandelion

Incremental Git repository deployment.
http://scttnlsn.github.io/dandelion
MIT License
738 stars 60 forks source link

Gem install on macos Mojave gives compilation error #168

Closed kurtf closed 5 years ago

kurtf commented 5 years ago

TL;DR The dependency rugged@0.26 fails to compile on macOS 10.14.2 Mojave. Rebuilding with rugged@0.27.7 fixed it for me. Posting it as an issue here for posterity. I'll submit a PR.

I updated to Mojave and dandelion stopped working. I tried reinstalling dandelion with gem install dandelion, and saw errors about not finding cmake. I ended up reinstalling cmake and XCode command line tools, and trying again. The mkmf.log still seemed to indicate missing C compiler

"cmake .. -DBUILD_CLAR=OFF -DTHREADSAFE=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=-fPIC -DCMAKE_BUILD_TYPE=RelWithDebInfo  "
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:14 (PROJECT):
  The CMAKE_C_COMPILER:

    /Library/Developer/CommandLineTools/usr/bin/cc

  is not a full path to an existing compiler tool.

...but the real issue was revealed in the CMakeError.log

Performing C SOURCE FILE Test HAVE_STRUCT_STAT_ST_MTIM failed with the following output:
Change Dir: /Users/kurtf/.gem/ruby/2.3.0/gems/rugged-0.26.0/vendor/libgit2/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_98d7e/fast"
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_98d7e.dir/build.make CMakeFiles/cmTC_98d7e.dir/build
Building C object CMakeFiles/cmTC_98d7e.dir/src.c.o
/Library/Developer/CommandLineTools/usr/bin/cc   -fPIC -DHAVE_STRUCT_STAT_ST_MTIM   -o CMakeFiles/cmTC_98d7e.dir/src.c.o   -c /Users/kurtf/.gem/ruby/2.3.0/gems/rugged-0.26.0/vendor/libgit2/build/CMakeFiles/CMakeTmp/src.c
/Users/kurtf/.gem/ruby/2.3.0/gems/rugged-0.26.0/vendor/libgit2/build/CMakeFiles/CMakeTmp/src.c:7:37: error: no member named 'st_mtim' in 'struct stat'
(void)sizeof(((struct stat *)0)->st_mtim);
                ~~~~~~~~~~~~~~~~~~  ^
1 error generated.
make[1]: *** [CMakeFiles/cmTC_98d7e.dir/src.c.o] Error 1
make: *** [cmTC_98d7e/fast] Error 2

Source file was:

#include <sys/types.h>
#include <sys/stat.h>

int main()
{
(void)sizeof(((struct stat *)0)->st_mtim);
return 0;
}

There was another similar compilation error with a reference to stat->st_mtime_nsec

I tried recompiling dandelion with the latest version of rugged - updated the relevant line in dandelion.gemspec to be s.add_dependency 'rugged', '0.27.7'

..then built from source and installed, and dandelion seems to be working.

scttnlsn commented 5 years ago

Resolved in https://github.com/scttnlsn/dandelion/pull/170