checking whether the C compiler works... no; configure: error: C compiler cannot create executables - macos

I am using OSx, attempting to install a haskell package 'SDL-mixer' via 'cabal install SDL-mixer'. I get the following error:
$ cabal install SDL-mixerResolving dependencies...
Configuring SDL-mixer-0.6.2.0...
Failed to install SDL-mixer-0.6.2.0
Build log ( /Users/matthewherzl/.cabal/logs/SDL-mixer-0.6.2.0.log ):
cabal: Entering directory '/var/folders/v7/gzwp_4j12gd_3d2pt2cl52yr0000gn/T/cabal-tmp-7633/SDL-mixer-0.6.2.0'
[1 of 1] Compiling Main ( /var/folders/v7/gzwp_4j12gd_3d2pt2cl52yr0000gn/T/cabal-tmp-7633/SDL-mixer-0.6.2.0/dist/setup/setup.hs, /var/folders/v7/gzwp_4j12gd_3d2pt2cl52yr0000gn/T/cabal-tmp-7633/SDL-mixer-0.6.2.0/dist/setup/Main.o )
Linking /var/folders/v7/gzwp_4j12gd_3d2pt2cl52yr0000gn/T/cabal-tmp-7633/SDL-mixer-0.6.2.0/dist/setup/setup ...
Configuring SDL-mixer-0.6.2.0...
configure: WARNING: unrecognized options: --with-compiler
checking for sdl-config... /usr/local/bin/sdl-config
checking for gcc... /usr/bin/clang
checking whether the C compiler works... no
configure: error: in `/private/var/folders/v7/gzwp_4j12gd_3d2pt2cl52yr0000gn/T/cabal-tmp-7633/SDL-mixer-0.6.2.0':
configure: error: C compiler cannot create executables
See `config.log' for more details.
cabal: Leaving directory '/var/folders/v7/gzwp_4j12gd_3d2pt2cl52yr0000gn/T/cabal-tmp-7633/SDL-mixer-0.6.2.0'
cabal: Error: some packages failed to install:
SDL-mixer-0.6.2.0 failed during the configure step. The exception was:
ExitFailure 77
Other questions pose similar errors, but I have not found a solution that works for my case.
Some things I've tried:
validated that gcc is present on my machine, and works to successfully compile a c program.
restarted my machine
removed and reinstalled xcode
uninstalled and reinstalled gcc
installed clang
attempted to install in sandbox
I get the same error in each case.
It seems there is something I need to change in my OS setup; any ideas on how to fix?

Related

haskell stack can't find sdl_config? windows 10

I'm trying to install sdl model into haskell. I have this problem and I don't know where to put the sdl_config and how to set it up.
I have tried mutiple ways to get sdl_config working, such as building it with Code::blocks but I never seem to get it to work.
[1 of 2] Compiling Main ( C:\Users\name\AppData\Local\Temp\stack14648\SDL-0.6.7.0\Setup.lhs, C:\Users\name\AppData\Local\Temp\stack14648\SDL-0.6.7.0\.stack-work\dist\e626a42b\setup\Main.o )
[2 of 2] Compiling StackSetupShim ( C:\sr\setup-exe-src\setup-shim-Z6RU0evB.hs, C:\Users\name\AppData\Local\Temp\stack14648\SDL-0.6.7.0\.stack-work\dist\e626a42b\setup\StackSetupShim.o )
Linking C:\Users\name\AppData\Local\Temp\stack14648\SDL-0.6.7.0\.stack-work\dist\e626a42b\setup\setup.exe ...
Configuring SDL-0.6.7.0...
configure: WARNING: unrecognized options: --with-compiler
configure: loading site script /usr/local/etc/config.site
checking for sdl-config... no
checking for sdl11-config... no
configure: error: *** SDL not found! Get SDL from www.libsdl.org.
If you already installed it, check it's in the path. If problem remains,
please send a mail to the address that appears in ./configure --version
indicating your platform, the version of configure script and the problem.
I want haskell stack to be able to install SDL model into haskell without error.

weird error when installing mechainze gem on mac os

I'm trying to install the mechainze gem on my mac os, however when I typed gem install mechanize, after a few seconds, it poped out:
Building native extensions. This could take a while...
ERROR: Error installing mechanize:
ERROR: Failed to build gem native extension.
/Users/Tim/.rvm/rubies/ruby-1.9.3-p545/bin/ruby extconf.rb
checking for main() in -lstdc++... yes
checking for ruby/encoding.h... yes
creating Makefile
make clean
make
compiling unf.cc
g++: error: unrecognized command line option '-Wshorten-64-to-32'
make: *** [unf.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/Tim/.rvm/gems/ruby-1.9.3-p545#global/gems/unf_ext-0.0.6 for inspection.
Results logged to /Users/Tim/.rvm/gems/ruby-1.9.3-p545#global/extensions/x86_64-darwin-12/1.9.1/unf_ext-0.0.6/gem_make.out
I have no idea why this happened and is there anyone willing to help?
Thanks!
PS: I found out that actually a long time ago I set the default compiler to g++ instead of clang. Does this matter?
Actually this is indeed caused by my switching the default compiler to gcc4.7. After I switched back(command: sudo port select --set gcc llvm-gcc42), it went well smoothly.

Trying to install Ruby 1.9.3-p547 exits with WARNING: unrecognized options: --with-libyaml-dir, --with-readline-dir

I've been trying to install Ruby 1.9.3-p547 for the past 2 days on OS X 10.9.3 with rbenv:
CC="/usr/local/Cellar/gcc/4.8.3/bin/gcc" rbenv install 1.9.3-p547
but it keeps reporting an error:
Installing ruby-1.9.3-p547...
BUILD FAILED
Inspect or clean up the working tree at /var/folders/6t/33jmvscd6vg_tlqk40c4vsg80000gp/T/ruby-build.20140528111136.82977
Results logged to /var/folders/6t/33jmvscd6vg_tlqk40c4vsg80000gp/T/ruby-build.20140528111136.82977.log
Last 10 log lines:
x ruby-1.9.3-p547/golf_prelude.c
/var/folders/6t/33jmvscd6vg_tlqk40c4vsg80000gp/T/ruby-build.20140528111136.82977/ruby-1.9.3-p547 /var/folders/6t/33jmvscd6vg_tlqk40c4vsg80000gp/T/ruby-build.20140528111136.82977 ~/code/dpplus
configure: WARNING: unrecognized options: --with-libyaml-dir, --with-readline-dir
checking build system type... x86_64-apple-darwin13.2.0
checking host system type... x86_64-apple-darwin13.2.0
checking target system type... x86_64-apple-darwin13.2.0
checking whether the C compiler works... no
configure: error: in `/var/folders/6t/33jmvscd6vg_tlqk40c4vsg80000gp/T/ruby- build.20140528111136.82977/ruby-1.9.3-p547':
configure: error: C compiler cannot create executables
See `config.log' for more details
BUILD FAILED
Inspect or clean up the working tree at /var/folders/6t/33jmvscd6vg_tlqk40c4vsg80000gp/T/ruby-build.20140528111136.82977
Results logged to /var/folders/6t/33jmvscd6vg_tlqk40c4vsg80000gp/T/ruby-build.20140528111136.82977.log
Last 10 log lines:
/var/folders/6t/33jmvscd6vg_tlqk40c4vsg80000gp/T/ruby-build.20140528111136.82977/ruby-1.9.3-p547 /var/folders/6t/33jmvscd6vg_tlqk40c4vsg80000gp/T/ruby-build.20140528111136.82977 ~/code/dpplus
configure: WARNING: unrecognized options: --with-libyaml-dir, --with-readline-dir
checking build system type... x86_64-apple-darwin13.2.0
checking host system type... x86_64-apple-darwin13.2.0
checking target system type... x86_64-apple-darwin13.2.0
checking whether the C compiler works... no
configure: error: in `/var/folders/6t/33jmvscd6vg_tlqk40c4vsg80000gp/T/ruby- build.20140528111136.82977/ruby-1.9.3-p547':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** No targets specified and no makefile found. Stop.
I've been trying with gcc 4.8.3, gcc 4.6, readline and libyaml (all from Homebrew). It works with apple-gcc42 (from Homebrew as well), but this gives a problem with the Spring-gem.
I had the same problem and I was missing Xcode command line tools. I've installed it with the following command:
xcode-select --install
Hope this helps you.

What is the issue with Ubuntu (12.10) and GCC 4.7/4.8?

Since several versions of GCC and Ubuntu I am experiencing annoying issues with paths and naming of several header and object files that are necessary for the installation of GCC.
Description: After installing ubuntu (e.g. in my case 12.04) and installing all prerequisites of the gcc, I run the following commands:
sudo mkdir /usr/local/stow/gcc-4.8.0
./configure --prefix /usr/local/stow/gcc-4.8.0
make
sudo make install
For the sake of completeness, the rest of the installation procedure:
cd /usr/local/stow
sudo stow -t /usr/local/ gcc-4.8.0
gcc -v
However, this simple and proper way of installing gcc has some issues during the 'make' step with the following error messages:
1.) The problem with 'stubs.h'
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
which can be fixed with the following commands added to ~/.bashrc:
if [ -z "$CPATH"]; then
export CPATH="/usr/include/i386-linux-gnu"
else
export CPATH=$CPATH:"/usr/include/i386-linux-gnu"
fi
2.) The problem with 'crti.o', 'crtn.o', and 'crt1.o'
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find crtn.o: No such file or directory
/usr/bin/ld: cannot find crt1.o: No such file or directory
which can be fixed with the very ugly solution:
sudo ln -s /usr/lib/i386-linux-gnu/crti.o /usr/lib/i386-linux-gnu/crtn.o /usr/lib/i386-linux-gnu/crt1.o /usr/lib
since - and I don't know why - the following commands do not solve the problem during linking steps of 'sudo make install'
if [ -z "$LIBRARY_PATH"]; then
export LIBRARY_PATH="/usr/lib/${multiarch}"
else
export LIBRARY_PATH=$LIBRARY_PATH:"/usr/lib/${multiarch}"
fi
if [ -z "$LD_LIBRARY_PATH"]; then
export LD_LIBRARY_PATH="/usr/lib/${multiarch}"
else
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/usr/lib/${multiarch}"
fi
(With these solutions I could compile GCC-4.7.2 on Ubuntu 12.04. - I have still issues compiling GCC-4.8.0 on Ubuntu 12.04, but that's different topic.)
My questions are: Does anybody know the reason/background that we have these issues? Does anybody know a proper solution? (With "proper solution" I mean a solution that does not require setting environment variables or symbolic linking libraries to different directories. To me these kind of changes are ugly, since they require changes to the system that one may not be able to trace back or redo.)
In the root folder of your GCC source execute ./contrib/download_prerequisites script.
These are the issues i encountered while compiling GCC 4.8.0 on Ubuntu 12.04 with solutions.
This might help you.
Compilation guide for compiling GCC 4.8 on ubuntu 12.04
ERROR 1
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also
http://gcc.gnu.org/install/prerequisites.html for additional info. If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files. They may be located in separate packages.
SOLUTION
Download and install gmp version >=4.3.2 package because mpc needs higher version
download the source code from gmplib.org
compile the source code and install
while compiling gmp see ERROR 2 for help
Installed gmp version 5.1.1
Download and install mpfr package
Installed mpfr version 3.1.2
Download and install mpc package
Installed mpc version 1.0
Download the packages from
http://ftp.gnu.org
ERROR 2
Error while compiling gmp library
checking for suitable m4... configure: error: No usable m4 in $PATH or /usr/5bin
SOLUTION
sudo apt-get install m4
http://ubuntuforums.org/showthread.php?t=850491
ERROR 3
Cannot find g++ compiler
I got this error because I installed the OS recently and had not installed the compilers.
SOLUTION
sudo apt-get install build-essential
This installs all the standard build essential software
ERROR 4
checking for i686-pc-linux-gnu-gcc... /home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc/xgcc -B/home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include
checking for suffix of object files... configure: error: in `/home/suhastheju/projects/gcc/gcc-4.8.0/i686-pc-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0'
make: *** [all] Error 2
SOLUTION
Though gcc documentation specify , that , we can provide the path of gmp
and mpfr installtion through –with-gmp and –with-mpfr flag ,
but unfortunately , i tried to give the path but it didnt work.
I am not in position to say final word about , this , whether it is a bug
in build script or something else , but bellow is the solution of the problem.
while building , add gmp and mpfr installation path in LD_LIBRARY_PATH environment
variable. Do as follows
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
If you have the libraries in different path, add the path where libraries are present
ERROR 5
libbackend.a(tree-vect-data-refs.o):tree-vect-data-refs.c:(.text+0x87da): more undefined references to `vector_type_mode(tree_node const*)' follow
collect2: error: ld returned 1 exit status
make[3]: *** [cc1] Error 1
make[3]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc'
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0'
make: *** [all] Error 2
SOLUTION
recompiled the source code from begining, It worked magically
make clean all
ERROR 6
/home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc/../.././gcc/gcov.c:416: undefined reference to `gcc_init_libintl()'
collect2: ld returned 1 exit status
make[3]: *** [gcov] Error 1
make[3]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc'
SOLUTION
Added -I/usr/include

cygwin linking error

I want to make network simulator shawn.exe with cygwin and that simulator need to boost library
when i call make for it in the linking step procedure break.
please help me,
this is all result of make command:
{.
.
[100%] Built target shawnlib
Scanning dependencies of target shawn
[100%] Building CXX object CMakeFiles/shawn.dir/frontend/console/con_main.o
[100%] Building CXX object CMakeFiles/shawn.dir/apps/apps_init.o
Linking CXX executable shawn.exe
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lboost_regex-gcc-mt
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lboost_date_time-gcc-mt
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lboost_thread-gcc-mt
collect2: ld returned 1 exit status
CMakeFiles/shawn.dir/build.make:111: recipe for target `shawn.exe' failed
make[2]: *** [shawn.exe] Error 1
CMakeFiles/Makefile2:60: recipe for target `CMakeFiles/shawn.dir/all' failed
make[1]: *** [CMakeFiles/shawn.dir/all] Error 2
Makefile:72: recipe for target `all' failed
make: *** [all] Error 2
}
Make sure you have the libboost-devel Cygwin package installed. Re-run Cygwin's setup.exe and install that package (as well as its dependencies, which should automatically get installed if you don't explicitly exclude them).
no need to reinstall cygwin. just run:
apt-cyg install libboost-devel.
if you don't have "apt-cyg" installed, run these steps first:
lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin

Resources