Installing Ruby 1.9.3 Troubles with Clang - ruby

I am attempting to install Ruby 1.9.3 on Mac OS X Lion, same method as I discovered here:
Basically it's:
rvm install 1.9.3 --with-gcc=clang --with-readline-dir=$rvm_path/usr
However, this time Clang throws an error on the --with-readline-dir option:
Larson:~ andrewjl$ rvm install 1.9.3 --with-gcc=clang --with-readline-dir=$rvm_path/usr
clang: error: unsupported option '--with-readline'
clang: error: unsupported option '--with-opt-dir=/Users/andrewjl/.rvm/usr'
Is this an issue with Clang? Does anybody know how to get around this?
EDIT
After trying Shigeya's answer I get this error:
Larson:~ andrewjl$ rvm install 1.9.3-p125 --patch xcode-debugopt-fix-r34840.diff --with-readline-dir=$rvm_path/usr --with-openssl-dir=$rvm_path/usr --with-tcl-lib=/usr --with-tk-lib=/usr
Installing Ruby from source to: /Users/andrewjl/.rvm/rubies/ruby-1.9.3-p125, this may take a while depending on your cpu(s)...
ruby-1.9.3-p125 - #fetching
ruby-1.9.3-p125 - #downloading ruby-1.9.3-p125, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9505k 100 9505k 0 0 52267 0 0:03:06 0:03:06 --:--:-- 50727
ruby-1.9.3-p125 - #extracting ruby-1.9.3-p125 to /Users/andrewjl/.rvm/src/ruby-1.9.3-p125
ruby-1.9.3-p125 - #extracted to /Users/andrewjl/.rvm/src/ruby-1.9.3-p125
Applying patch 'xcode-debugopt-fix-r34840.diff' (located at /Users/andrewjl/.rvm/patches/ruby/1.9.3/p125/xcode-debugopt-fix-r34840.diff)
ruby-1.9.3-p125 - #autoreconf
Error running 'autoreconf', please read /Users/andrewjl/.rvm/log/ruby-1.9.3-p125/autoreconf.log
ruby-1.9.3-p125 - #configuring
Error running ' ./configure --prefix=/Users/andrewjl/.rvm/rubies/ruby-1.9.3-p125 --enable-shared --disable-install-doc --with-readline --with-opt-dir=/Users/andrewjl/.rvm/usr --with-openssl --with-tcl-lib=/usr --with-tk-lib=/usr --with-libyaml --with-gcc=clang ', please read /Users/andrewjl/.rvm/log/ruby-1.9.3-p125/configure.log
There has been an error while running configure. Halting the installation.
Here's the log file error:
/usr/local/include/fuse/fuse_compat.h:69:10: fatal error: 'sys/statfs.h' file not found
#include <sys/statfs.h>
^
clang: error: unable to execute command: Broken pipe: 13
clang: error: clang frontend command failed due to signal 2 (use -v to see invocation)
clang: note: diagnostic msg: Please submit a bug report to http://developer.apple.com/bugreporter/ and include command line arguments and all diagnostic information.
clang: note: diagnostic msg: Error generating preprocessed source(s).
yes
checking for strip... strip
checking for prefix of external symbols... _
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for if make is GNU make... yes
checking for nroff... /usr/bin/nroff
.ext/include/x86_64-darwin11.4.0/ruby/config.h updated
ruby library version = 1.9.1
configure: creating ./config.status
config.status: creating Makefile
configure: WARNING: unrecognized options: --with-readline, --with-openssl, --with-tcl-lib, --with-tk-lib, --with-libyaml
In file included from <built-in>:143:
In file included from <command line>:1:
In file included from /usr/local/include/fuse/fuse.h:26:
/usr/local/include/fuse/fuse_common.h:32:2: error: #error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
#error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
^
In file included from <built-in>:143:
In file included from <command line>:1:
In file included from /usr/local/include/fuse/fuse.h:857:
/usr/local/include/fuse/fuse_compat.h:69:10: fatal error: 'sys/statfs.h' file not found
#include <sys/statfs.h>
^
clang: error: unable to execute command: Broken pipe: 13
clang: error: clang frontend command failed due to signal 2 (use -v to see invocation)
clang: note: diagnostic msg: Please submit a bug report to http://developer.apple.com/bugreporter/ and include command line arguments and all diagnostic information.
clang: note: diagnostic msg: Error generating preprocessed source(s).
configure: WARNING: unrecognized options: --with-readline, --with-openssl, --with-tcl-lib, --with-tk-lib, --with-libyaml
config.status: creating ruby-1.9.pc
./configure: line 18932: syntax error near unexpected token `('
./configure: line 18932: ` sed 's/{\$([^(){}]*)[^{}]*}//g' ${srcdir}/common.mk'

Refer to this answer.
Even though both ruby-1.9.3-p125 and ruby-1.9.3-p194 some support for clang, installing Ruby with clang is generally not recommended.
(Note: I had to accept edit proposal first, then edit. Thank you very much for contribution.)

Related

gem install pg | error: ‘PQERRORS_SQLSTATE’ undeclared

I am working in openSuse Leap, using rbenv. After upgrading from Leap 15.1 to 15.2 I have a problem. I cannot make 'gem install pg'.
Reproduce:
gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /home/alex/.rbenv/versions/2.6.6/lib64/ruby/gems/2.6.0/gems/pg-1.2.3/ext
/home/alex/.rbenv/versions/2.6.6/bin/ruby -I /home/alex/.rbenv/versions/2.6.6/lib64/ruby/2.6.0 -r ./siteconf20200827-12823-54e7ke.rb extcon
f.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.
---
find / -name "pg_config" -print
/usr/lib/postgresql10/bin/pg_config
gem install pg -- --with-pg-config=/usr/lib/postgresql10/bin/pg_config
Building native extensions with: '--with-pg-config=/usr/lib/postgresql10/bin/pg_config'
This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /home/alex/.rbenv/versions/2.6.6/lib64/ruby/gems/2.6.0/gems/pg-1.2.3/ext
/home/alex/.rbenv/versions/2.6.6/bin/ruby -I /home/alex/.rbenv/versions/2.6.6/lib64/ruby/2.6.0 -r ./siteconf20200827-12620-silryo.rb extconf.rb --with-pg-config\=/usr/lib/postgresql10/bin/pg_config
Using config values from /usr/lib/postgresql10/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQsetSingleRowMode()... yes
checking for PQconninfo()... yes
checking for PQsslAttribute()... yes
checking for PQresultVerboseErrorMessage()... yes
checking for PQencryptPasswordConn()... yes
checking for PQresultMemorySize()... yes
checking for timegm()... yes
checking for rb_gc_adjust_memory_usage()... yes
checking for unistd.h... yes
checking for inttypes.h... yes
checking for C99 variable length arrays... yes
creating extconf.h
creating Makefile
current directory: /home/alex/.rbenv/versions/2.6.6/lib64/ruby/gems/2.6.0/gems/pg-1.2.3/ext
make "DESTDIR=" clean
current directory: /home/alex/.rbenv/versions/2.6.6/lib64/ruby/gems/2.6.0/gems/pg-1.2.3/ext
make "DESTDIR="
compiling gvl_wrappers.c
compiling pg.c
In file included from /home/alex/.rbenv/versions/2.6.6/include/ruby-2.6.0/ruby.h:33:0,
from pg.h:20,
from pg.c:49:
pg.c: In function ‘Init_pg_ext’:
pg.c:470:64: error: ‘PQERRORS_SQLSTATE’ undeclared (first use in this function); did you mean ‘PQERRORS_TERSE’?
rb_define_const(rb_mPGconstants, "PQERRORS_SQLSTATE", INT2FIX(PQERRORS_SQLSTATE));
^
/home/alex/.rbenv/versions/2.6.6/include/ruby-2.6.0/ruby/ruby.h:261:33: note: in definition of macro ‘RB_INT2FIX’
#define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
^
pg.c:470:56: note: in expansion of macro ‘INT2FIX’
rb_define_const(rb_mPGconstants, "PQERRORS_SQLSTATE", INT2FIX(PQERRORS_SQLSTATE));
^~~~~~~
pg.c:470:64: note: each undeclared identifier is reported only once for each function it appears in
rb_define_const(rb_mPGconstants, "PQERRORS_SQLSTATE", INT2FIX(PQERRORS_SQLSTATE));
^
/home/alex/.rbenv/versions/2.6.6/include/ruby-2.6.0/ruby/ruby.h:261:33: note: in definition of macro ‘RB_INT2FIX’
#define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
^
pg.c:470:56: note: in expansion of macro ‘INT2FIX’
rb_define_const(rb_mPGconstants, "PQERRORS_SQLSTATE", INT2FIX(PQERRORS_SQLSTATE));
^~~~~~~
pg.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-cast-function-type’
make: *** [Makefile:245: pg.o] Ошибка 1
make failed, exit code 2
Gem files will remain installed in /home/alex/.rbenv/versions/2.6.6/lib64/ruby/gems/2.6.0/gems/pg-1.2.3 for inspection.
Results logged to /home/alex/.rbenv/versions/2.6.6/lib64/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/pg-1.2.3/gem_make.out
OpenSuse Support Forum recommended that I report a bug on bugzilla:
'Looks like although dependencies are satisfied, there is an upstream compilation error likely due to a change in supported methods. Code identified the error, then tried to resolve on its own (apparently there is some error checking and fixes already in the code, maybe errors like this has happened before). That kind of error isn't likely going to be solved by an end user.'
But this did not solve the problem, please take a look.
Any ideas? Help would be very helpful.
UPD
LC_ALL=C sudo zypper in postgresql postgresql-server postgresql-contrib
[sudo] password for root:
Loading repository data...
Reading installed packages...
'postgresql' is already installed.
No update candidate for 'postgresql-12.0.1-lp152.5.5.noarch'. The highest available version is already installed.
'postgresql-server' is already installed.
No update candidate for 'postgresql-server-12.0.1-lp152.5.5.noarch'. The highest available version is already installed.
'postgresql-contrib' is already installed.
No update candidate for 'postgresql-contrib-12.0.1-lp152.5.5.noarch'. The highest available version is already installed.
Resolving package dependencies...
Nothing to do.
Not sure about Leap, but under Tumbleweed I solved exactly the same problem by removing postgresql10-devel and installing both postgresql12-devel and postgresql12-server-devel.

GCC compilation error when installing Nokogiri

I'm trying to run bundle install but I'm getting the Error while trying to Install Nokogiri 1.10.3
Here is the error message from mkmf.log.
gcc -o conftest -I/home/chille/.rvm/rubies/ruby-2.5.1/include/ruby-2.5.0/x86_64-linux -I/home/chille/.rvm/rubies/ruby-2.5.1/include/ruby-2$
gcc: error: unrecognized command line option '-Wmisleading-indentation'
gcc: error: unrecognized command line option '-Wimplicit-fallthrough=0'
gcc: error: unrecognized command line option '-Wduplicated-cond'
gcc: error: unrecognized command line option '-Wrestrict'
For those who do not read comments
Debian 10 users, if you find
gcc: error: unrecognized command line option '-Wduplicated-cond'
in mkmf.log
brew unlink gcc
is what you are looking for. I spend an hour looking for an answer and yes, i once missed the answer here, but luckily i have returned and spotted it.
I had faced a similar issue. My default compiler did not recognise certain command line options just like you are facing.
My gcc version was 10. I could solve it by adding an older gcc version (5.5) and set it as default for the gem installation purpose. I followed the step given in this thread to do so.

OGRE1.9 build error on OSX

I am trying to install ogre v1.9 using homebrew. brew install ogre --HEAD
At some point I get the following errors:
duplicate symbol __ZN4Ogre18ControllerFunctionIfE16getAdjustedInputEf in:
CMakeFiles/OgreMain.dir/src/OgreAlignedAllocator.cpp.o
CMakeFiles/OgreMain.dir/src/OgreAnimation.cpp.o
duplicate symbol __ZN4Ogre18ControllerFunctionIdE16getAdjustedInputEd in:
CMakeFiles/OgreMain.dir/src/OgreAlignedAllocator.cpp.o
CMakeFiles/OgreMain.dir/src/OgreAnimation.cpp.o
...
ld: 564 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/macosx/Ogre.framework/Versions/1.9.0/Ogre] Error 1
make[1]: *** [OgreMain/CMakeFiles/OgreMain.dir/all] Error 2
make: *** [all] Error 2
==> Formula
Tap: osrf/homebrew-simulation
Path: /usr/local/Library/Taps/osrf/homebrew-simulation/ogre.rb
==> Configuration
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew
HEAD: 01dd3e19f8e600c3f44a3b140103f330aa32447c
Last commit: 3 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit haswell
OS X: 10.10.2-x86_64
Xcode: N/A
CLT: 6.2.0.0.1.1424975374
Clang: 6.0 build 600
X11: 2.7.7 => /opt/X11
System Ruby: 2.0.0-p481
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby
Java: N/A
==> ENV
HOMEBREW_CC: clang
HOMEBREW_CXX: clang++
MAKEFLAGS: -j8
CMAKE_PREFIX_PATH: /usr/local
CMAKE_INCLUDE_PATH: /usr/include/libxml2:/opt/X11/include:/opt/X11/include/freetype2:/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
CMAKE_LIBRARY_PATH: /opt/X11/lib:/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
PKG_CONFIG_PATH:/usr/local/opt/libpng/lib/pkgconfig:/usr/local/opt/freetype/lib/pkgconfig:/usr/local/opt/libzzip/lib/pkgconfig
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/usr/local/Library/ENV/pkgconfig/10.10:/opt/X11/lib/pk gconfig:/opt/X11/share/pkgconfig
ACLOCAL_PATH: /usr/local/share/aclocal:/opt/X11/share/aclocal
PATH:/usr/local/Library/ENV/4.3:/usr/local/opt/cmake/bin:/usr/local/opt/doxygen/bin:/usr/local/opt/libpng/bin:/usr/local/opt/freetype/bin:/usr/local/opt/libzzip/bin:/opt/X11/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Error: ogre HEAD did not build
The errors are so many and all in OgreAlignedAllocator.cpp.o. I think there is something defined twice. I tried to uninstall all OGRE dependencies and reinstall them again, but I still get the same error.
Any suggestion how can I solve or debug this kind of error?
Ok! It was a mess in the last commit, I checked out a previous revision and it works.

autoconf: command not found Installing Cappuccino (Objective J)

I'm trying to install cappuccino. When I ran "./bootstrap.sh"
I'm getting this error:
Would you like to build the JavaScriptCore engine? This is optional but will
make building and running Cappuccino and Objective-J much faster.
Enter "yes" or "no":
yes
./bootstrap.sh: line 362: autoconf: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'groups'
sh configure
Detected <JavaScriptCore/JavaScript.h>
clang -o lib/libnarwhal.dylib narwhal.c -dynamiclib -0s -force_cpusubtype_ALL -mmacosx-version-min=10.4 -arch i386 -Iinclude -framework JavaScriptCore
clang: error: unknown argument: '-0s' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [lib/libnarwhal.dylib] Error 1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WARNING: building narwhal-jsc failed. Hit enter to continue.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================
Bootstrapping of Cappuccino and other required tools is complete.
NOTE: any changes made to the shell configuration files won't take place until
you restart the shell.
Any of you knows can fix this or if is a work around this?
Use Homebrew to install autoconf... the command should be:
brew install autoconf
You may also need to install the XCode command line utilities for brew to work.
For exact details of how brew installs autoconf see its formula: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/autoconf.rb

homebrew install postgresql problem

I'm new to OSX and want to install postgresql, as it is my preferred db for django.
I installed xcode and can start it, which is a prerequisite for homebrew.
Then I installed homebrew and run brew install postgresql, getting the following warning and errors. First of all I get an Xcode is not installed warning, whereas it is definitely installed. I think the reason for this warning is described in this post: https://github.com/mxcl/homebrew/issues/2567
Below the traceback.
TK$ brew install postgresql
Warning: Xcode is not installed! Builds may fail!
==> Downloading ftp://ftp.cwru.edu/pub/bash/readline-6.1.tar.gz
File already downloaded and cached to /Users/TK/Library/Caches/Homebrew
==> Downloading patches
######################################################################## 100.0%
######################################################################## 100.0%
==> Patching
patching file complete.c
patching file patchlevel
patching file readline.h
patching file patchlevel
==> ./configure --prefix=/usr/local/Cellar/readline/6.1 --mandir=/usr/local/Cell
checking build system type... i386-apple-darwin10.7.3
checking host system type... i386-apple-darwin10.7.3
Beginning configuration for readline-6.1 for i386-apple-darwin10.7.3
checking whether make sets $(MAKE)... no
checking for gcc... /usr/bin/cc
checking for C compiler default output file name...
configure: error: in `/private/tmp/homebrew-readline-6.1-3bbC/readline-6.1':
configure: error: C compiler cannot create executables
See `config.log' for more details.
==> Exit Status: 77
http://github.com/mxcl/homebrew/blob/master/Library/Formula/readline.rb#L24
==> Environment
/usr/local/Library/Homebrew/utils.rb:275:in `llvm_build_version': undefined method `/' for "/Developer":String (NoMethodError)
from /usr/local/Library/Homebrew/cmd/--config.rb:9:in `llvm'
from /usr/local/Library/Homebrew/cmd/--config.rb:61:in `config_s'
from /usr/local/bin/brew:116
If i run brew-config I get the following trackeback.
TK$ brew --config
Error: undefined method `/' for "/Developer":String
Please report this bug: https://github.com/mxcl/homebrew/wiki/new-issue
/usr/local/Library/Homebrew/utils.rb:275:in `llvm_build_version'
/usr/local/Library/Homebrew/cmd/--config.rb:9:in `llvm'
/usr/local/Library/Homebrew/cmd/--config.rb:61:in `config_s'
/usr/local/Library/Homebrew/cmd/--config.rb:5:in `__config'
/usr/local/bin/brew:82:in `send'
/usr/local/bin/brew:82
Any idea what I did wrong?
configure: error: C compiler cannot create executables
and
Error: undefined method `/' for "/Developer":String
suggest that you do not have Xcode and gnu c++ installed. Install code from your OS disk or register as a developer (free) and get XCode 3 or buy Xcode from AppStore,

Resources