Installation problem on Mac OS X: Error while installing nokogiri/pg

Hi, gang. I’m a journalist with only moderate technical skills. I’m trying to install diaspora* on my recent Mac OS X laptop (10.13.6)

—begin—

An error occurred while installing nokogiri (1.8.5), and Bundler cannot
continue.
Make sure that gem install nokogiri -v '1.8.5' succeeds before bundling.

An error occurred while installing pg (1.0.0), and Bundler cannot
continue.
Make sure that gem install pg -v '1.0.0' succeeds before bundling.

—end—

It’s likely I made errors earlier in the installation process, which I can describe in greater detail if necessary.

Any recommendations?

Thanks!

What are you trying to do? Do you want to develop on diaspora, just give it a try to see how it looks, or do you want to run a production-like setup?

Primarily I want to check it out, then perhaps put a pod into production. (I’m not a developer.)

I see. So, here is a thing: our macOS guides are currently a little bit outdated, and getting started on macOS isn’t so easy in the first place. You have to install a bunch of packages, which maybe isn’t what you really want to do if you just want to check it out.

We’re currently working on something that will make the setup much easier for local development guides, and will also fit your “just trying it out” use-case. Would you be fine if I said “please wait two weeks or so, and I’ll get back to you with new guides to set up a local development instance”? Or do you want to jump in right now?

Help with the specific issue I raised would be more useful. (Clearly I know I “have to install a bunch of packages” – I got most of the way through the process.)

As for a quick-and-dirty trial environment: 1&1 Internet seems to be the only ones offering one-click installs (via Bitnami). But they block IP addresses in The Netherlands, where I currently am. It would be great if others offered it, too, whether that’s the Foundation or private companies.

As for waiting for a better local-development guide: That’s only useful to me if it addresses the specific issue I’m having now.

Thanks!

Well.

Please paste the entire output of bundle install, there are some additional lines there with the exact error that occured during compiling.

Thanks for your reply. Here you go, cutting out some lines in the middle (as noted).

That warning at the beginning might be relevant, but I’ve had no luck getting past it. (“gem install bundler” running as the diaspora user returns “ERROR: While executing gem … (Gem::FilePermissionError) / You don’t have write permissions for the /Library/Ruby/Gems/2.3.0 directory.” Running it under sudo returns a similar error, referencing the /usr/bin directory.)


$ bin/bundle install --full-index

Warning: the running version of Bundler (1.16.2) is older than the version that created the lockfile (1.16.5). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.

_...[REMOVED  MANY LINES THAT BEGIN WITH "Fetching", "Using", and "Installing"]..._

Installing pg 1.0.0 with native extensions

Installing nokogiri 1.8.5 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /Users/disapora/diaspora/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.8.5/ext/nokogiri

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20181020-33512-iop1i1.rb

extconf.rb

checking if the C compiler accepts ... yes

checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no

Building nokogiri using packaged libraries.

Using mini_portile version 2.3.0

checking for iconv.h... yes

checking for gzdopen() in -lz... yes

checking for iconv... yes

************************************************************************

IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxml2-2.9.8

with the following patches applied:

- 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch

- 0002-Fix-nullptr-deref-with-XPath-logic-ops.patch

- 0003-Fix-infinite-loop-in-LZMA-decompression.patch

Team Nokogiri will keep on doing their best to provide security

updates in a timely manner, but if this is a concern for you and want

to use the system library instead; abort this installation process and

reinstall nokogiri as follows:

gem install nokogiri -- --use-system-libraries

[--with-xml2-config=/path/to/xml2-config]

[--with-xslt-config=/path/to/xslt-config]

If you are using Bundler, tell it to use the option:

bundle config build.nokogiri --use-system-libraries

bundle install

Note, however, that nokogiri is not fully compatible with arbitrary

versions of libxml2 provided by OS/package vendors.

************************************************************************

Extracting libxml2-2.9.8.tar.gz into tmp/x86_64-apple-darwin17/ports/libxml2/2.9.8... OK

Running git apply with

/Users/disapora/diaspora/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.8.5/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch...

OK

Running git apply with

/Users/disapora/diaspora/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.8.5/patches/libxml2/0002-Fix-nullptr-deref-with-XPath-logic-ops.patch...

OK

Running git apply with

/Users/disapora/diaspora/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.8.5/patches/libxml2/0003-Fix-infinite-loop-in-LZMA-decompression.patch...

OK

Running 'configure' for libxml2 2.9.8... OK

Running 'compile' for libxml2 2.9.8... ERROR, review

'/Users/disapora/diaspora/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.8.5/ext/nokogiri/tmp/x86_64-apple-darwin17/ports/libxml2/2.9.8/compile.log'

to see what happened. Last lines are:

========================================================================

CC testdso.lo

CCLD testdso.la

CC xmllint.o

CCLD xmllint

ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)

ld: warning: ignoring file /usr/local/Cellar/xz/5.2.4/lib/liblzma.dylib, file was built for x86_64 which is

not the architecture being linked (i386): /usr/local/Cellar/xz/5.2.4/lib/liblzma.dylib

Undefined symbols for architecture i386:

"_lzma_auto_decoder", referenced from:

_xz_head in libxml2.a(xzlib.o)

"_lzma_code", referenced from:

_xz_decomp in libxml2.a(xzlib.o)

"_lzma_end", referenced from:

___libxml2_xzclose in libxml2.a(xzlib.o)

"_lzma_properties_decode", referenced from:

_is_format_lzma in libxml2.a(xzlib.o)

ld: symbol(s) not found for architecture i386

clang: error: linker command failed with exit code 1 (use -v to see invocation)

make[2]: *** [xmllint] Error 1

make[1]: *** [all-recursive] Error 1

make: *** [all] Error 2

========================================================================

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

Provided configuration options:

--with-opt-dir

--without-opt-dir

--with-opt-include

--without-opt-include=${opt-dir}/include

--with-opt-lib

--without-opt-lib=${opt-dir}/lib

--with-make-prog

--without-make-prog

--srcdir=.

--curdir

--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/$(RUBY_BASE_NAME)

--help

--clean

--use-system-libraries

--enable-static

--disable-static

--with-zlib-dir

--without-zlib-dir

--with-zlib-include

--without-zlib-include=${zlib-dir}/include

--with-zlib-lib

--without-zlib-lib=${zlib-dir}/lib

--enable-cross-build

--disable-cross-build

/Users/disapora/diaspora/vendor/bundle/ruby/2.3.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:402:in

`block in execute': Failed to complete compile task (RuntimeError)

from

/Users/disapora/diaspora/vendor/bundle/ruby/2.3.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:373:in

`chdir'

from

/Users/disapora/diaspora/vendor/bundle/ruby/2.3.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:373:in

`execute'

from

/Users/disapora/diaspora/vendor/bundle/ruby/2.3.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:115:in

`compile'

from

/Users/disapora/diaspora/vendor/bundle/ruby/2.3.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:154:in

`cook'

from extconf.rb:365:in `block (2 levels) in process_recipe'

from extconf.rb:257:in `block in chdir_for_build'

from extconf.rb:256:in `chdir'

from extconf.rb:256:in `chdir_for_build'

from extconf.rb:364:in `block in process_recipe'

from extconf.rb:262:in `tap'

from extconf.rb:262:in `process_recipe'

from extconf.rb:551:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/Users/disapora/diaspora/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-17/2.3.0/nokogiri-1.8.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/disapora/diaspora/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.8.5 for

inspection.

Results logged to

/Users/disapora/diaspora/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-17/2.3.0/nokogiri-1.8.5/gem_make.out

An error occurred while installing nokogiri (1.8.5), and Bundler cannot continue.

Make sure that `gem install nokogiri -v '1.8.5'` succeeds before bundling.

In Gemfile:

devise_lastseenable was resolved to 0.0.6, which depends on

rails was resolved to 5.1.6, which depends on

actioncable was resolved to 5.1.6, which depends on

actionpack was resolved to 5.1.6, which depends on

actionview was resolved to 5.1.6, which depends on

rails-dom-testing was resolved to 2.0.3, which depends on

nokogiri

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /Users/disapora/diaspora/vendor/bundle/ruby/2.3.0/gems/pg-1.0.0/ext

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20181020-33512-123fw90.rb

extconf.rb

checking for pg_config... no

No pg_config... trying anyway. If building fails, please try again with

 --with-pg-config=/path/to/pg_config

checking for libpq-fe.h... no

Can't find the 'libpq-fe.h header

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

Provided configuration options:

--with-opt-dir

--without-opt-dir

--with-opt-include

--without-opt-include=${opt-dir}/include

--with-opt-lib

--without-opt-lib=${opt-dir}/lib

--with-make-prog

--without-make-prog

--srcdir=.

--curdir

--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/$(RUBY_BASE_NAME)

--with-pg

--without-pg

--enable-windows-cross

--disable-windows-cross

--with-pg-config

--without-pg-config

--with-pg_config

--without-pg_config

--with-pg-dir

--without-pg-dir

--with-pg-include

--without-pg-include=${pg-dir}/include

--with-pg-lib

--without-pg-lib=${pg-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/Users/disapora/diaspora/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-17/2.3.0/pg-1.0.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/disapora/diaspora/vendor/bundle/ruby/2.3.0/gems/pg-1.0.0 for

inspection.

Results logged to

/Users/disapora/diaspora/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-17/2.3.0/pg-1.0.0/gem_make.out

An error occurred while installing pg (1.0.0), and Bundler cannot continue.

Make sure that `gem install pg -v '1.0.0'` succeeds before bundling.

In Gemfile:

pg

$

Well yeah. As the macOS install guides say:

This guide only describes the important differences from the standard installation, full step by step guide to follow

So you need to follow the regular install guides, and cross-reference the macOS guide to check for varaints. In that case, you skipped the installation of RVM as described in the guides: https://wiki.diasporafoundation.org/Installation/Ubuntu/Xenial#RVM - which explains why you needed to run bundler as root (which you should, in general, never do.), and why the nokogiri build fails.

A-ha! Thanks for the reference. I’ll give that a whirl and report back with any further problems.

I am no expert on (installing) diaspora, but the first line in the pasted log should be a hint:

Warning: the running version of Bundler (1.16.2) is older than the version that created the lockfile (1.16.5). We suggest you upgrade to the latest version of Bundler by running gem install bundler.

/edit: you noticed that yourself too… nm…

Many thanks again for your help. I ran into additional problems; at this point I’m giving up for the time being.

And you’re not going to share them so that others could gain something? Well, okay then…

@tgeller you might find some use in the problems I had (on Mac OS 10.13), detailed in this discussion. In short, bundling also failed at nokogiri. My installation is old, and has failed a number of times, and I was trying to get it working again, rather than doing a fresh install. It also concerns the setup for the project website, not for the diaspora* app.

I couldn’t identify the exact error, but in short, I uninstalled everything, right back to Homebrew. I then fixed all PATH instances as suggested by CSammy, and started from scratch.

It also seems that XCode Command Line Tools was not installed properly; this might have been broken during the upgrade to OS 10.13.

I’d recommend uninstalling and trying again, this time following exactly the sequence in the installation guide. It seems you decided to do some things differently for reasons you found in external source. Not that you have to hop between two pages to install on Mac: the Mac OS installation guide and Notes On Installing and Running Diaspora.

Thanks for the advice, @goob, but I really am giving up. The difficulty is greater than my motivation.

I have other comments, but don’t feel the community would be receptive to them.

It’s a great concept, and I hope it continues to improve. Cheers!