Gcc not working - Xcode 3.2.6 - Snow Leopard

I'm starting to talk a little with my environment, and it looks like I broke it. Thanks so much in advance for any help you can offer.

The main symptom is that when I try to run rvm install 1.9.3 I get the following trace:

 Installing Ruby from source to: /Users/duncanstuart/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)... ruby-1.9.3-p0 - #fetching ruby-1.9.3-p0 - #extracted to /Users/duncanstuart/.rvm/src/ruby-1.9.3-p0 (already extracted) Fetching yaml-0.1.4.tar.gz to /Users/duncanstuart/.rvm/archives Extracting yaml-0.1.4.tar.gz to /Users/duncanstuart/.rvm/src Configuring yaml in /Users/duncanstuart/.rvm/src/yaml-0.1.4. ERROR: Error running ' ./configure --prefix="/Users/duncanstuart/.rvm/usr" ', please read /Users/duncanstuart/.rvm/log/ruby-1.9.3-p0/yaml/configure.log Compiling yaml in /Users/duncanstuart/.rvm/src/yaml-0.1.4. ERROR: Error running 'make ', please read /Users/duncanstuart/.rvm/log/ruby-1.9.3-p0/yaml/make.log Installing yaml to /Users/duncanstuart/.rvm/usr ERROR: Error running 'make install', please read /Users/duncanstuart/.rvm/log/ruby-1.9.3-p0/yaml/make.install.log ruby-1.9.3-p0 - #configuring ERROR: Error running ' ./configure --prefix=/Users/duncanstuart/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml-dir=/Users/duncanstuart/.rvm/usr ', please read /Users/duncanstuart/.rvm/log/ruby-1.9.3-p0/configure.log ERROR: There has been an error while running configure. Halting the installation. 

The contents of yaml/configure.log are as follows:

 [2012-01-04 02:06:11] ./configure --prefix="/Users/duncanstuart/.rvm/usr" checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... config/install-sh -c -d checking for gawk... no checking for mawk... no checking for nawk... no checking for awk... awk checking whether make sets $(MAKE)... yes checking for gcc... /usr/bin/gcc-4.2 checking whether the C compiler works... no configure: error: in `/Users/duncanstuart/.rvm/src/yaml-0.1.4': configure: error: C compiler cannot create executables See `config.log' for more details 

I suspect the key lines are:

 checking for gcc... /usr/bin/gcc-4.2 checking whether the C compiler works... no 

The contents of yaml/make.log and yaml/make.install.log same (except, of course, the first two lines)

The contents of the config.log file are included at the end of this question (because it is very long!). The significant line is as follows:

 `ld: library not found for -lcrt1.10.6.o` 

I get the same errors when running rvm install ... with any other version of ruby ​​or when trying to install something using Homebrew, for example. brew install wget

My theory

I suspect this is due to incorrect uninstallation and reinstallation of Xcode 3.2.6 - see the "History" below for full details of what I did.

I looked at a ton of stackoverflow messages, but no one answered this:

My setting

  • I am running Snow Leopard 10.6.8
  • I tried installing Xcode 3.2.6 on January 3rd, and I think it succeeded
  • I have rvm 1.10.0 (latest version at time of writing)
  • The following lines are in /usr/local/bin :

     lrwxr-xr-x 1 root 7 3 Jan 02:42 /usr/bin/gcc -> gcc-4.0 -rwxr-xr-x 1 root 93072 23 Sep 2007 /usr/bin/gcc-4.0 -rwxr-xr-x 1 root 166128 24 Oct 2010 /usr/bin/gcc-4.2 

If your advice is β€œupgrade to Leo and install the latest Xcode,” let it be.

History

Here are the steps that I followed: I'm not sure which is appropriate, so I have listed all of this.

  • I had a working rvm instance that was able to successfully install everything before ruby ​​1.9.2. I believe that I used Xcode 3.2.6
  • I have macports installed - I can't remember why.
  • I recently installed Homebrew for one reason or another.
  • When trying to run rvm install 1.9.3 , I got an error that, it seems to me, is similar to this:

     openssl_missing.h:173: error: conflicting types for 'BN_rand_range' /usr/local/Cellar/openssl/0.9.8r/include/openssl/bn.h:411: error: previous declaration of 'BN_rand_range' was here openssl_missing.h:177: error: conflicting types for 'BN_pseudo_rand_range' /usr/local/Cellar/openssl/0.9.8r/include/openssl/bn.h:412: error: previous declaration of 'BN_pseudo_rand_range' was here openssl_missing.c:270: error: conflicting types for 'BN_rand_range' /usr/local/Cellar/openssl/0.9.8r/include/openssl/bn.h:411: error: previous declaration of 'BN_rand_range' was here openssl_missing.c:278: error: conflicting types for 'BN_pseudo_rand_range' /usr/local/Cellar/openssl/0.9.8r/include/openssl/bn.h:412: error: previous declaration of 'BN_pseudo_rand_range' was here 
  • The inclusion in Google suggested that it was a kind of conflict in which there were two openssl definitions on the machine (as far as I could understand).

  • Keeping in mind that there was a warning from Homebrew about conflicts with MacPorts, I tried to uninstall MacPorts using the instructions in the Macports Wiki . I also removed loading MacPorts related strings from my .bash_profile

  • This did not work and because I did not understand what I was doing, I uninstalled Xcode using sudo <Xcode>/Library/uninstall-devtools --mode=all .

  • This, of course, worsened the situation and led to the errors shown above. So I reinstalled Xcode from the original CD - it turned out to be Xcode 3.0 .

  • This did not fix these errors, so I tried to uninstall this version of Xcode . Unfortunately, this requires manually changing the system versions in uninstall scripts, as described here

  • Finally, I downloaded and installed Xcode 3.2.6 (the latest Xcode available for Snow Leopard?) And ran out of ideas.

config.log

This is the contents of the config.log file - found in /Users/duncanstuart/.rvm/src/yaml-0.1.4/

 This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by yaml configure 0.1.4, which was generated by GNU Autoconf 2.67. Invocation command line was $ ./configure --prefix=/Users/duncanstuart/.rvm/usr CC=/usr/bin/gcc-4.2 --no-create --no-recursion ## --------- ## ## Platform. ## ## --------- ## hostname = duncan-stuarts-macbook.local uname -m = i386 uname -r = 10.8.0 uname -s = Darwin uname -v = Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 /usr/bin/uname -p = i386 /bin/uname -X = unknown /bin/arch = unknown /usr/bin/arch -k = unknown /usr/convex/getsysinfo = unknown /usr/bin/hostinfo = Mach kernel version: Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 Kernel configured for up to 2 processors. 2 processors are physically available. 2 processors are logically available. Processor type: i486 (Intel 80486) Processors active: 0 1 Primary memory available: 3.00 gigabytes Default processor set: 95 tasks, 425 threads, 2 processors Load average: 0.87, Mach factor: 1.12 /bin/machine = unknown /usr/bin/oslevel = unknown /bin/universe = unknown PATH: /Users/duncanstuart/.rvm/usr/bin PATH: /usr/local/bin PATH: /usr/local/sbin PATH: /usr/local/mysql/bin PATH: /bin PATH: /usr/sbin PATH: /sbin PATH: /usr/local/git/bin PATH: /usr/X11/bin PATH: /Users/duncanstuart/.rvm/bin PATH: /usr/bin ## ----------- ## ## Core tests. ## ## ----------- ## configure:2409: checking for a BSD-compatible install configure:2477: result: /usr/bin/install -c configure:2488: checking whether build environment is sane configure:2538: result: yes configure:2679: checking for a thread-safe mkdir -p configure:2718: result: config/install-sh -c -d configure:2731: checking for gawk configure:2761: result: no configure:2731: checking for mawk configure:2761: result: no configure:2731: checking for nawk configure:2761: result: no configure:2731: checking for awk configure:2747: found /usr/bin/awk configure:2758: result: awk configure:2769: checking whether make sets $(MAKE) configure:2791: result: yes configure:2947: checking for gcc configure:2974: result: /usr/bin/gcc-4.2 configure:3203: checking for C compiler version configure:3212: /usr/bin/gcc-4.2 --version >&5 i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) Copyright (C) 2007 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. configure:3223: $? = 0 configure:3212: /usr/bin/gcc-4.2 -v >&5 Using built-in specs. Target: i686-apple-darwin10 Configured with: /var/tmp/gcc/gcc-5666.3~6/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Apple Inc. build 5666) (dot 3) configure:3223: $? = 0 configure:3212: /usr/bin/gcc-4.2 -V >&5 gcc-4.2: argument to `-V' is missing configure:3223: $? = 1 configure:3212: /usr/bin/gcc-4.2 -qversion >&5 i686-apple-darwin10-gcc-4.2.1: no input files configure:3223: $? = 1 configure:3243: checking whether the C compiler works configure:3265: /usr/bin/gcc-4.2 conftest.c >&5 ld: library not found for -lcrt1.10.6.o collect2: ld returned 1 exit status configure:3269: $? = 1 configure:3307: result: no configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "yaml" | #define PACKAGE_TARNAME "yaml" | #define PACKAGE_VERSION "0.1.4" | #define PACKAGE_STRING "yaml 0.1.4" | #define PACKAGE_BUGREPORT "http://pyyaml.org/newticket?component=libyaml" | #define PACKAGE_URL "" | #define PACKAGE "yaml" | #define VERSION "0.1.4" | #define YAML_VERSION_MAJOR 0 | #define YAML_VERSION_MINOR 1 | #define YAML_VERSION_PATCH 4 | #define YAML_VERSION_STRING "0.1.4" | /* end confdefs.h. */ | | int | main () | { | | ; | return 0; | } configure:3312: error: in `/Users/duncanstuart/.rvm/src/yaml-0.1.4': configure:3314: error: C compiler cannot create executables See `config.log' for more details ## ---------------- ## ## Cache variables. ## ## ---------------- ## ac_cv_env_CC_set=set ac_cv_env_CC_value=/usr/bin/gcc-4.2 ac_cv_env_CFLAGS_set= ac_cv_env_CFLAGS_value= ac_cv_env_CPPFLAGS_set= ac_cv_env_CPPFLAGS_value= ac_cv_env_CPP_set= ac_cv_env_CPP_value= ac_cv_env_LDFLAGS_set= ac_cv_env_LDFLAGS_value= ac_cv_env_LIBS_set= ac_cv_env_LIBS_value= ac_cv_env_build_alias_set= ac_cv_env_build_alias_value= ac_cv_env_host_alias_set= ac_cv_env_host_alias_value= ac_cv_env_target_alias_set= ac_cv_env_target_alias_value= ac_cv_path_install='/usr/bin/install -c' ac_cv_prog_AWK=awk ac_cv_prog_ac_ct_CC=/usr/bin/gcc-4.2 ac_cv_prog_make_make_set=yes ## ----------------- ## ## Output variables. ## ## ----------------- ## ACLOCAL='${SHELL} /Users/duncanstuart/.rvm/src/yaml-0.1.4/config/missing --run aclocal-1.11' AMDEPBACKSLASH='' AMDEP_FALSE='' AMDEP_TRUE='' AMTAR='${SHELL} /Users/duncanstuart/.rvm/src/yaml-0.1.4/config/missing --run tar' AR='' AUTOCONF='${SHELL} /Users/duncanstuart/.rvm/src/yaml-0.1.4/config/missing --run autoconf' AUTOHEADER='${SHELL} /Users/duncanstuart/.rvm/src/yaml-0.1.4/config/missing --run autoheader' AUTOMAKE='${SHELL} /Users/duncanstuart/.rvm/src/yaml-0.1.4/config/missing --run automake-1.11' AWK='awk' CC='/usr/bin/gcc-4.2' CCDEPMODE='' CFLAGS='' CPP='' CPPFLAGS='' CYGPATH_W='echo' DEFS='' DEPDIR='' DOXYGEN='' DOXYGEN_FALSE='' DOXYGEN_TRUE='' DSYMUTIL='' DUMPBIN='' ECHO_C='\c' ECHO_N='' ECHO_T='' EGREP='' EXEEXT='' FGREP='' GREP='' INSTALL_DATA='${INSTALL} -m 644' INSTALL_PROGRAM='${INSTALL}' INSTALL_SCRIPT='${INSTALL}' INSTALL_STRIP_PROGRAM='$(install_sh) -c -s' LD='' LDFLAGS='' LIBOBJS='' LIBS='' LIBTOOL='' LIPO='' LN_S='' LTLIBOBJS='' MAKEINFO='${SHELL} /Users/duncanstuart/.rvm/src/yaml-0.1.4/config/missing --run makeinfo' MKDIR_P='config/install-sh -c -d' NM='' NMEDIT='' OBJDUMP='' OBJEXT='' OTOOL64='' OTOOL='' PACKAGE='yaml' PACKAGE_BUGREPORT='http://pyyaml.org/newticket?component=libyaml' PACKAGE_NAME='yaml' PACKAGE_STRING='yaml 0.1.4' PACKAGE_TARNAME='yaml' PACKAGE_URL='' PACKAGE_VERSION='0.1.4' PATH_SEPARATOR=':' RANLIB='' SED='' SET_MAKE='' SHELL='/bin/sh' STRIP='' VERSION='0.1.4' YAML_LT_AGE='0' YAML_LT_CURRENT='2' YAML_LT_RELEASE='0' YAML_LT_REVISION='2' ac_ct_CC='/usr/bin/gcc-4.2' ac_ct_DUMPBIN='' am__EXEEXT_FALSE='' am__EXEEXT_TRUE='' am__fastdepCC_FALSE='' am__fastdepCC_TRUE='' am__include='' am__isrc='' am__leading_dot='.' am__quote='' am__tar='${AMTAR} chof - "$$tardir"' am__untar='${AMTAR} xf -' bindir='${exec_prefix}/bin' build='' build_alias='' build_cpu='' build_os='' build_vendor='' datadir='${datarootdir}' datarootdir='${prefix}/share' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' dvidir='${docdir}' exec_prefix='NONE' host='' host_alias='' host_cpu='' host_os='' host_vendor='' htmldir='${docdir}' includedir='${prefix}/include' infodir='${datarootdir}/info' install_sh='${SHELL} /Users/duncanstuart/.rvm/src/yaml-0.1.4/config/install-sh' libdir='${exec_prefix}/lib' libexecdir='${exec_prefix}/libexec' localedir='${datarootdir}/locale' localstatedir='${prefix}/var' lt_ECHO='/bin/echo' mandir='${datarootdir}/man' mkdir_p='$(top_builddir)/config/install-sh -c -d' oldincludedir='/usr/include' pdfdir='${docdir}' prefix='/Users/duncanstuart/.rvm/usr' program_transform_name='s,x,x,' psdir='${docdir}' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' sysconfdir='${prefix}/etc' target_alias='' ## ----------- ## ## confdefs.h. ## ## ----------- ## /* confdefs.h */ #define PACKAGE_NAME "yaml" #define PACKAGE_TARNAME "yaml" #define PACKAGE_VERSION "0.1.4" #define PACKAGE_STRING "yaml 0.1.4" #define PACKAGE_BUGREPORT "http://pyyaml.org/newticket?component=libyaml" #define PACKAGE_URL "" #define PACKAGE "yaml" #define VERSION "0.1.4" #define YAML_VERSION_MAJOR 0 #define YAML_VERSION_MINOR 1 #define YAML_VERSION_PATCH 4 #define YAML_VERSION_STRING "0.1.4" configure: exit 77 
+6
source share
1 answer

In the end, it turned out to be quite simple - many thanks to everyone in the comments that helped him figure it out.

There were two questions:

Problem 1: gcc compiler did not work

Symptoms

Functions that depend on gcc failure follow in the configuration log (e.g. /Users/<user>/.rvm/log/ruby-1.9.3-p0/yaml/configure.log ):

 checking for gcc... /usr/bin/gcc-4.2 checking whether the C compiler works... no 

... and in the configuration log (e.g. /Users/<user>/.rvm/src/yaml-0.1.4/config.log ):

 ld: library not found for -lcrt1.10.6.o 

The problem with the root:

Xcode is not installed correctly. In particular, the file /Developer/SDKs/MacOSX10.6.sdk/usr/lib/crt1.10.6.o does not exist.

Decision:

http://trac.macports.org/ticket/21784 : "Try reinstalling Xcode, make sure you select the" unix development support "option.

Problem 2: RVM will not install ruby ​​1.9.3

Symptoms

rvm install ruby 1.9.3 crashes with ERROR: Error running 'make '

The corresponding /Users/<user>/.rvm/log/ruby-1.9.3-p0/make.log contains the following segment:

 compiling openssl_missing.c In file included from openssl_missing.c:22: openssl_missing.h:173: error: conflicting types for 'BN_rand_range' /usr/include/openssl/bn.h:411: error: previous declaration of 'BN_rand_range' was here openssl_missing.h:177: error: conflicting types for 'BN_pseudo_rand_range' /usr/include/openssl/bn.h:412: error: previous declaration of 'BN_pseudo_rand_range' was here openssl_missing.c:270: error: conflicting types for 'BN_rand_range' /usr/include/openssl/bn.h:411: error: previous declaration of 'BN_rand_range' was here openssl_missing.c:278: error: conflicting types for 'BN_pseudo_rand_range' /usr/include/openssl/bn.h:412: error: previous declaration of 'BN_pseudo_rand_range' was here 

The problem with the root:

Conflict with previous installation launches (not quite sure about this).

Decision

https://rvm.beginrescueend.com/packages/openssl/ : clean the ruby ​​you are trying to install and reinstall:

 rvm remove 1.9.3 rvm install 1.9.3 

I also removed two more rubies - ruby-1.9.2-p290 and ruby-1.9.2-p136, which could do something about it ...:

+6
source

Source: https://habr.com/ru/post/905039/


All Articles