Error during gem install middleman

Hi,

Newbie here. I am trying to install middleman on ubuntu.

I have installed all the dependencies that I found: slim,
zlib1g-dev, build-essential, ruby-dev, zlibc.

The makefile part failed. The mkmf log has compilation errors from

stat.h. Googling a bit with error, it appears to be related to multiple
versions of time.h in the include path. I did find a few versions, but
no idea where to change the include path or if this is the right thing
to do.
Here’s the error from the gem install.

Building native extensions. This could take a while…
ERROR: Error installing middleman:
ERROR: Failed to build gem native extension.

current directory: /var/lib/gems/2.3.0/gems/ffi-1.9.10/ext/ffi_c
/usr/bin/ruby2.3 -r ./siteconf20160528-26401-yni4k9.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You
may
need configuration options.

I looked at the mkmf.log and it had errors related to stat.h

pkg-config --libs libffi
=> “-lffi\n”
“gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0
-I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I.
-Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat
-Werror=format-security -fPIC conftest.c -L. -L/usr/lib/x86_64-linux-gnu
-L. -Wl,-Bsymbolic-functions -Wl,-z,relro -fstack-protector -rdynamic
-Wl,-export-dynamic -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm -lc”
In file included from /usr/include/x86_64-linux-gnu/sys/stat.h:104:0,
from /usr/include/ruby-2.3.0/ruby/defines.h:31,
from /usr/include/ruby-2.3.0/ruby/ruby.h:36,
from /usr/include/ruby-2.3.0/ruby.h:33,
from conftest.c:1:
/usr/include/x86_64-linux-gnu/bits/stat.h:91:21: error: field ‘st_atim’
has incomplete type
struct timespec st_atim; /* Time of last access. /
^
/usr/include/x86_64-linux-gnu/bits/stat.h:92:21: error: field ‘st_mtim’
has incomplete type
struct timespec st_mtim; /
Time of last modification. */
^
There are more errors all from stat.h file.

Here are the versions of time.h:
-rw-r–r-- 1 root root 6673 May 28 15:30 /usr/include/time.h
-rw-r–r-- 1 root root 1572 May 12 19:52 /usr/include/linux/time.h
-rw-r–r-- 1 root root 6673 Apr 14 18:09
/usr/include/x86_64-linux-gnu/sys/time.h
-rw-r–r-- 1 root root 3465 Apr 14 18:09
/usr/include/x86_64-linux-gnu/bits/time.h

Hallo,

Maybe somebody here will know exactly what the problem is, but it’s
unlikely because this forum is for general questions about the ruby
programming language. A better place to ask about middleman is on the
developers’ github page:

Hi,
Thank you. I realized that middleman is failing in compilation of
ruby itself. That’s why I was hoping this forum will help. I have tried
to build ruby using rbenv:

   rbenv install 2.4.0-dev

   I get errors:

BUILD FAILED (Ubuntu 16.04 using ruby-build 20160426-33-g3304f96)

Inspect or clean up the working tree at
/tmp/ruby-build.20160531111035.15116
Results logged to /tmp/ruby-build.20160531111035.15116.log

Looking at the log file it has errors like this:

compiling dln_find.c
In file included from ./include/ruby/defines.h:137:0,
from ./include/ruby/ruby.h:36,
from ./include/ruby.h:33,
from main.c:13:
./include/ruby/missing.h:61:5: error: unknown type name ‘time_t’
time_t tv_sec; /* seconds /
^
In file included from ./include/ruby/defines.h:137:0,
from ./include/ruby/ruby.h:36,
from miniinit.c:12:
./include/ruby/missing.h:61:5: error: unknown type name ‘time_t’
time_t tv_sec; /
seconds */
^
In file included from ./include/ruby/ruby.h:1998:0,
from ./include/ruby.h:33,
from main.c:13:
./include/ruby/intern.h:908:27: error: expected ‘)’ before ‘long’
VALUE rb_time_new(time_t, long);
^
./include/ruby/intern.h:909:32: error: expected ‘)’ before ‘long’
VALUE rb_time_nano_new(time_t, long);
^

Let me know if there is a ruby installation forum that is better suited
for this.

Well, rbenv also has a github page, with an issues tracker, but, there
are no problems to compile ruby on the latest ubuntu. If you use google,
you can quickly find a list of packages which are dependencies:

I posted on ruby trunk. Hopefully, someone will point out a way to
address

Hi,
Thanks again. I got to that page earlier and replicated the steps
through rbenv. I tried through ruby-build as well. I also tried running
the make command from the folder. All of them lead to the same
compilation error.

I have posted on the rbenv git, but I suspect that this is related 

to ruby source + my machine.

Thanks
Sayee