Unable to install rrdtool-1.7.2 over MIPS due to unmet dependencies - glib

I am trying to install rrdtool-1.7.2 on a debian over a MIPS based setup and keep getting error for missing libraries, some of which are actually already installed in the system.
e.g.
# ldd --version
**ldd (Debian EGLIBC 2.11.3-4) 2.11.3**
Copyright (C) 2009 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.
Written by Roland McGrath and Ulrich Drepper.
The following errors are displayed.
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no glib-2.0.pc file around.
You may want to set the PKG_CONFIG_PATH variable to point to its
location.
----------------------------------------------------------------------------
configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of glib-2.0. Check config.log for hints on why
this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
so that compiler and the linker can find libglib-2.0 and its header files. If
you have not installed glib-2.0, you can get it either from its original home on
ftp://ftp.gtk.org/pub/glib/2.28/
You can find also find an archive copy on
https://oss.oetiker.ch/rrdtool/pub/libs
The last tested version of glib-2.0 is 2.28.7.
LIBS=-lm
LDFLAGS=
CPPFLAGS=
----------------------------------------------------------------------------
checking whether we need to include gthreads for g_thread_init... checking for g_thread_init in -lgthread-2.0... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no gthread-2.0.pc file around.
You may want to set the PKG_CONFIG_PATH variable to point to its
location.
----------------------------------------------------------------------------
configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of gthread-2.0. Check config.log for hints on why
this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
so that compiler and the linker can find libgthread-2.0 and its header files. If
you have not installed gthread-2.0, you can get it either from its original home on
""
You can find also find an archive copy on
https://oss.oetiker.ch/rrdtool/pub/libs
The last tested version of gthread-2.0 is x.x.x.
LIBS=-lm
LDFLAGS=
CPPFLAGS=
----------------------------------------------------------------------------
yes
checking for g_regex_new... no
checking if pcre is available to supply the missing regex support in glib... checking now ...
checking for pcre_compile in -lpcre... yes
checking pcre.h usability... yes
checking pcre.h presence... yes
checking for pcre.h... yes
checking for pcre_compile... yes
checking for png_access_version_number in -lpng... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no libpng.pc file around.
You may want to set the PKG_CONFIG_PATH variable to point to its
location.
----------------------------------------------------------------------------
configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of libpng. Check config.log for hints on why
this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
so that compiler and the linker can find libpng and its header files. If
you have not installed libpng, you can get it either from its original home on
ftp://ftp.simplesystems.org/pub/libpng/png/src/
You can find also find an archive copy on
https://oss.oetiker.ch/rrdtool/pub/libs
The last tested version of libpng is 1.4.8.
LIBS=-lpcre -lm
LDFLAGS=
CPPFLAGS=
----------------------------------------------------------------------------
checking for pango_cairo_context_set_font_options in -lpangocairo-1.0... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no pangocairo.pc file around.
You may want to set the PKG_CONFIG_PATH variable to point to its
location.
----------------------------------------------------------------------------
configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of pangocairo. Check config.log for hints on why
this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
so that compiler and the linker can find libpangocairo-1.0 and its header files. If
you have not installed pangocairo, you can get it either from its original home on
http://ftp.gnome.org/pub/GNOME/sources/pango/1.28
You can find also find an archive copy on
https://oss.oetiker.ch/rrdtool/pub/libs
The last tested version of pangocairo is 1.28.4.
LIBS=-lpcre -lm
LDFLAGS=
CPPFLAGS=
----------------------------------------------------------------------------
checking for g_object_unref in -lgobject-2.0... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no gobject-2.0.pc file around.
You may want to set the PKG_CONFIG_PATH variable to point to its
location.
----------------------------------------------------------------------------
configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of gobject-2.0. Check config.log for hints on why
this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
so that compiler and the linker can find libgobject-2.0 and its header files. If
you have not installed gobject-2.0, you can get it either from its original home on
https://download.gnome.org/sources/glib/2.58/
You can find also find an archive copy on
https://oss.oetiker.ch/rrdtool/pub/libs
The last tested version of gobject-2.0 is 2.58.1.
LIBS=-lpcre -lm
LDFLAGS=
CPPFLAGS=
----------------------------------------------------------------------------
checking for pango_font_map_create_context... no
checking for xmlParseFile in -lxml2... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no libxml-2.0.pc file around.
You may want to set the PKG_CONFIG_PATH variable to point to its
location.
----------------------------------------------------------------------------
configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of libxml-2.0. Check config.log for hints on why
this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
so that compiler and the linker can find libxml2 and its header files. If
you have not installed libxml-2.0, you can get it either from its original home on
http://xmlsoft.org/downloads.html
You can find also find an archive copy on
https://oss.oetiker.ch/rrdtool/pub/libs
The last tested version of libxml-2.0 is 2.7.8.
LIBS=-lpcre -lm
LDFLAGS=
CPPFLAGS=
----------------------------------------------------------------------------
configure: error: Please fix the library issues listed above and try again.
I have already checked the following thread but the problem still persists. I am unable to locate any .pc file for glibc-2.0
PKG_CONFIG_PATH variable, how to set LDFLAGS and CPPFLAGS when compiling RRDtool

You need to install a lot more libraries.
Use :
sudo apt-get install libglib2.0-0 libglib2.0-bin libpng-dev libpangocairo-1.0-0 libxml2 libxml2-dev
This should install the necessary library packages for you under debian/ubuntu.

Related

rvm install ruby-3.0.0 fails with gcc-8 specific error

rvm install ruby-3.0.0 fails with gcc-8 specific error
[2021-03-01 17:27:54] ./configure
current path: /Users/user/.rvm/src/ruby-3.0.0
GEM_HOME=/Users/user/.rvm/gems/ruby-2.6.4
PATH=/usr/local/opt/coreutils/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/Users/user/.rvm/gems/ruby-2.6.4/bin:/Users/user/.rvm/gems/ruby-2.6.4#global/bin:/Users/user/.rvm/rubies/ruby-2.6.4/bin:/Users/user/work/software/google-cloud-sdk/bin:/Applications/SnowSQL.app/Contents/MacOS:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS:/Users/user/.rvm/bin
GEM_PATH=/Users/user/.rvm/gems/ruby-2.6.4:/Users/user/.rvm/gems/ruby-2.6.4#global
command(7): env CFLAGS=-O3 -I/usr/local/opt/libyaml/include -I/usr/local/opt/libksba/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl#1.1/include LDFLAGS=-L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl#1.1/lib ./configure --prefix=/Users/user/.rvm/rubies/ruby-3.0.0 --disable-install-doc --enable-shared
checking for ruby... /Users/user/.rvm/rubies/ruby-2.6.4/bin/ruby
tool/config.guess already exists
tool/config.sub already exists
checking build system type... i386-apple-darwin17.7.0
checking host system type... i386-apple-darwin17.7.0
checking target system type... i386-apple-darwin17.7.0
checking for /usr/local/opt/ld/bin/gcc-8... no
checking for /usr/local/opt/gcc-ar/bin/gcc-8... no
checking for /usr/local/opt/g++/bin/gcc-8... no
checking for /usr/local/opt/gcc-nm/bin/gcc-8... no
checking for /usr/local/opt/gcc-ranlib/bin/gcc-8... no
checking for gcc... /usr/local/opt/gcc/bin/gcc-8
checking whether the C compiler works... no
configure: error: in `/Users/user/.rvm/src/ruby-3.0.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
Other observations
/usr/local/opt/gcc#8 exists
/usr/local/opt/gcc/bin/gcc-8 doesn't
gcc#8 8.4.0_1 is already installed and up-to-date
I am stuck building a project because of this issue, any pointers would be helpful
This may be because gcc path is different.
please check it with gcc --version
it will show you the path and please make sure to install from different source.

How to compile C into a universal library that works with iOS architectures

I'm trying to compile a very small amount of C source into a library that I can use in XCode for an iOS application.
The files are a single .c file and three header files. I'm very new to C, and no matter what I try I can't seem to get them to compile into a library that supports iOS architectures.
The files depend on the openssl library, and I've got that installed and working fine.
I just need to know the process of compiling these four files into a single library. I've found a plethora of information on the subject online, but I can't decipher which parts are necessary for what I'm trying to do.
I've tried the following:
gcc -fPIC -c main.c
gcc -shared -o mylib.so main.o -lcrypto -lssl
which seems to compile it for x86_64, (I've not tested the resulting file, just checked it's arch).
I've also tried
./configure --disable-shared --enable-utf8 --host=arm-apple-darwin CFLAGS="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk" CXXFLAGS="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk" LDFLAGS="-L." CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc" CXX="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++"
which only gives me errors
checking for arm-apple-darwin-gcc... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/nathanf/compilec':
configure: error: C compiler cannot create executables
I've been scouring the internet for the last few days trying to figure this out, but it's so convoluted to cross compile just a few files and I'm frustrated so I came here for some input.
Any help would be greatly appreciated.

Compiling error of VLC project in iOS

I am trying to compile the VLC project for iOS, following the instruction step by step.
git clone git://git.videolan.org/vlc-ports/ios.git
sh buildAspenProject.sh -s -k 7.0
And I get this compiling error:
cd builds/unix; /bin/sh ./configure '--without-png' '--prefix=/Users/change/Desktop/VLC_Library/ios/ImportedSources/vlc/contrib/i686-apple-darwin11-i386' '--build=i686-apple-darwin10' '--host=i686-apple-darwin11' '--target=i686-apple-darwin11' '--program-prefix=' '--enable-static' '--disable-shared' '--disable-dependency-tracking' '--with-pic'
configure: WARNING: unrecognized options: --disable-dependency-tracking
checking build system type... i686-apple-darwin10
checking host system type... i686-apple-darwin11
checking for i686-apple-darwin11-gcc... xcrun clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether xcrun clang accepts -g... yes
checking for xcrun clang option to accept ISO C89... none needed
checking how to run the C preprocessor... xcrun cc -E
checking for i686-apple-darwin10-gcc... no
checking for gcc... gcc
checking for gcc... (cached) gcc
checking for suffix of native executables... rm: conftest.dSYM: is a directory
ld: building for MacOSX, but linking against dylib built for iOS Simulator file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/usr/lib/libSystem.dylib' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure: error: native C compiler is not working
make[1]: *** [setup] Error 1
make: *** [.freetype2] Error 2
The environment:
XCode 5.0
MountainLion 10.8.4
iPhoneSimulator SDK 7.0
The invocation
$ ld -v
#(#)PROGRAM:ld PROJECT:ld64-224.1
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 armv6m armv7m armv7em
LTO support using: LLVM version 3.3svn, from Apple Clang 5.0 (build 500.2.75)
How do I fix this problem?
Appreciate if any suggestion or idea.
That got me further but got stumped by missing download URL for modplug-xmms.
VLC is insisting on downloading a copy of the source from
MODPLUG_GIT_HASH := 9b08cc646c3dc94dd446ab0671e3427dae8a83fc
MODPLUG_URL := http://sourceforge.net/code-snapshots/git/m/mo/modplug-xmms/git.git/modplug-xmms-git-$(MODPLUG_GIT_HASH).zip
which does not exist as of this time. (Server down?)
I did find of the copy of the source under
http://sourceforge.net/projects/modplug-xmms/files/latest/download/libmodplug-0.8.8.4.tar.gz
I downloaded it and installed it manually:
../ios/ImportedSources/vlc/contrib/iPhoneSimulator-i386/libmodplug
This is a known problem with Xcode 5 for which I don't have a fix yet.
To workaround, go to ImportedSources/vlc/contrib/iPhoneSimulator-i386 and run "make .freetype2". Afterwards, go back to the top directory and run the buildAspen script again.
Note that you'll need to do the same thing (with "iPhoneOS-armv7" and "iPhoneOS-armv7s" respectively) if you decide to compile for iOS devices at a later point.
I hope to fix this shortly. Enjoy hacking VLC for iOS!

Failed to build gem native extension

End result is I'm trying to get Ruby on Rails installed on my OS 10.7.3, but having various issues.
Also, I have a freshly installed XCode 4.3 from the App Store.
When I fire up the terminal, and enter:
sudo gem install rails
and it writes out:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.6.5 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.6.5/ext/json/ext/parser/gem_make.out
In all of the fixes I'm finding says to install XCode, which I have and runs just fine. However, I did uninstall a previous version of XCode to install the latest version, so I'm wondering if there is any relation there.
EDIT 1:
I've followed Jasdeep suggestion and installed RVM. But once i run:
sudo rvm install 1.9.3
I get the following:
Fetching yaml-0.1.4.tar.gz to /Users/xxx/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/xxx/.rvm/src
Configuring yaml in /Users/xxx/.rvm/src/yaml-0.1.4.
Error running ' ./configure --prefix="/Users/xxx/.rvm/usr" ', please read /Users/xxx/.rvm/log/ruby-1.9.3-p0/yaml/configure.log
Compiling yaml in /Users/xxx/.rvm/src/yaml-0.1.4.
Error running 'make ', please read /Users/xxx/.rvm/log/ruby-1.9.3-p0/yaml/make.log
Database file /Users/xxx/.rvm/config/packages does not exist.
gcc-4.2: error trying to exec '/usr/bin/i686-apple-darwin11-gcc-4.2.1': execvp: No such file or directory
Installing Ruby from source to: /Users/xxx/.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 - #downloading ruby-1.9.3-p0, 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 9330k 100 9330k 0 0 645k 0 0:00:14 0:00:14 --:--:-- 1260k
ruby-1.9.3-p0 - #extracting ruby-1.9.3-p0 to /Users/xxx/.rvm/src/ruby-1.9.3-p0
ruby-1.9.3-p0 - #extracted to /Users/xxx/.rvm/src/ruby-1.9.3-p0
ruby-1.9.3-p0 - #configuring
Error running ' ./configure --prefix=/Users/xxx/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml --with-opt-dir=/Users/xxx/.rvm/usr ', please read /Users/xxx/.rvm/log/ruby-1.9.3-p0/configure.log
There has been an error while running configure. Halting the installation.
So then I looked up what was in the log file, ..ruby-1.9.3-p0/yaml/configure.log:
[2012-03-03 22:49:50] ./configure --prefix="/Users/xxx/.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)... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/xxx/.rvm/src/yaml-0.1.4':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
So now it appears the error is:
no acceptable C compiler found in $PATH
Edit 2:
I've followed matt's instructions and was able to get further once I got the command-line tools installed (since I have Xcode 4.3 now). However, I'm still getting an error:
Fetching yaml-0.1.4.tar.gz to /Users/xxx/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/xxx/.rvm/src
Configuring yaml in /Users/xxx/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/xxx/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/xxx/.rvm/usr
gcc-4.2: error trying to exec '/usr/bin/i686-apple-darwin11-gcc-4.2.1': execvp: No such file or directory
Installing Ruby from source to: /Users/xxx/.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/xxx/.rvm/src/ruby-1.9.3-p0 (already extracted)
ruby-1.9.3-p0 - #configuring
Error running ' ./configure --prefix=/Users/xxx/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml --with-opt-dir=/Users/xxx/.rvm/usr ', please read /Users/xxx/.rvm/log/ruby-1.9.3-p0/configure.log
There has been an error while running configure. Halting the installation.
Below is the configure.log (sorry this post is getting so long, but hopefully it can help others too):
[2012-03-04 09:29:35] ./configure --prefix="/Users/xxx/.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... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking build system type... x86_64-apple-darwin11.3.0
checking host system type... x86_64-apple-darwin11.3.0
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld
checking if the linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm output from gcc object... ok
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin11.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for doxygen... false
checking for ANSI C header files... (cached) yes
checking for stdlib.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
configure: creating ./config.status
config.status: creating yaml-0.1.pc
config.status: creating include/Makefile
config.status: creating src/Makefile
config.status: creating Makefile
config.status: creating tests/Makefile
config.status: creating win32/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
The problem is that in Lion Xcode 4.3 doesn't by default install (or even include) the command-line tools such as gcc - and those are what are needed here. In the Downloads pane of Xcode's prefs, under Components, ask for the command-line tools. (See the readme: https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/WhatsNewXcode/Chapters/xcode_4_0.html#//apple_ref/doc/uid/TP40016147-SW35)
Actually I believe you didn't need to install Xcode at all, since in fact the command-line tool can now be downloaded and installed separately.
I already had Command-line tools installed (xCode as well)... and still had this (initial) error.
The problem was that xCode and the command line tools are no longer installing the gcc compiler. I don't know when they stopped shipping it, but I run mountain lion, and it's not here.
So what eventually solved my problem was installing gcc from scratch (https://github.com/kennethreitz/osx-gcc-installer).
Keep Smiling :)
If someone has the same problem for Ubuntu Linux, the solution was:
sudo apt-get install build-essential
sudo apt-get install libsqlite3-dev

Strange linker error while compiling OpenCV2.3.1 on Ubuntu 11.10

I'm trying to compile OpenCV version 2.3.1 on an Ubuntu 11.10 following instructions described here. I'm getting following error. Can't understand what is happening... /usr/local/lib/libavcodec.a exists but linker can't link against it, or something else?
error:
[ 20%] Built target pch_Generate_opencv_highgui
Linking CXX shared library ../../lib/libopencv_highgui.so
/usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32S against `av_destruct_packet'
can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
The problem is that you are attempting to link libopencv_highgui.so with libavcodec.a. The latter is built from code compiled without -fPIC (which is quite usual), and such code can not be linked into shared libraries on x86_64.
Your choices are:
Obtain libavcodec.so and arrange to link against it, or
Remove libavcodec or -lavcodec from the link line completely.
For the first, you most likely just need to install libavcodec-dev package.
If you do the second, you will still have to arrange for symbols that libopencv_highgui.so needs from libavcodec to be available at runtime. You can achieve that by linking the main executable with libavcodec (either archive or shared variant).
my take would be that, first run sudo apt-get remove libavcodec , then re-install with sudo apt-get install libopencv-dev
I once had similar issue, and the above resolved it
Running a 64-bit version of Ubuntu you have to configure and build ffmpeg with
./configure --enable-shared --enable-pic
as it is described in step 7b and 8b

Resources