Cannot read Video File OpenCV3 - opencv3.0

I am trying to use OpenCV3 for video file reading.
string packageRootPath = ros::package::getPath("visensor_dgem");
string videoFullPath = packageRootPath + "/dump/Video.avi";
cout << videoFullPath << endl;
cv::VideoCapture cap;
bool flag = cap.open( videoFullPath );
if( flag )
cout << "flag true\n";
else
cout << "flag false\n";
The path to the video file is correct. I am guessing my issue has to do with the video codecs. The program compiles file, however when I run the code I get flag false. I have tried to open the file with fstream and it opens successfully, so I am sure of the path and permissions etc.
I am on ubuntu 14.04. I have installed opencv3 from source code. Here is the config of my opencv:
(even more details of my installation here : https://kusemanohar.wordpress.com/2015/10/23/opencv-pro-built/)
-- General configuration for OpenCV 3.0.0 =====================================
-- Version control: unknown
--
-- Platform:
-- Host: Linux 3.19.0-25-generic x86_64
-- CMake: 2.8.12.2
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: RELEASE
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ Compiler: /usr/bin/c++ (ver 4.8.4)
-- C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /usr/bin/cc
-- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fopenmp -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fopenmp -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release):
-- Linker flags (Debug):
-- Precompiled headers: YES
-- Extra dependencies: Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Test Qt5::Concurrent /usr/lib/x86_64-linux-gnu/libwebp.so /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libtiff.so /usr/lib/x86_64-linux-gnu/libjasper.so /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so dc1394 avcodec avformat avutil swscale /usr/lib/x86_64-linux-gnu/libbz2.so vtkCharts vtkCommon vtkFiltering vtkGenericFiltering vtkGeovis vtkGraphics vtkHybrid vtkIO vtkImaging vtkInfovis vtkParallel vtkRendering vtkViews vtkVolumeRendering vtkWidgets dl m pthread rt tbb cudart nppc nppi npps cufft
-- 3rdparty dependencies: ippicv
--
-- OpenCV modules:
-- To be built: hal cudev core cudaarithm flann imgproc ml video viz cudabgsegm cudafilters cudaimgproc cudawarping imgcodecs photo shape videoio cudacodec highgui objdetect ts features2d calib3d cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo stitching superres videostab
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: java python2 python3
--
-- GUI:
-- QT 5.x: YES (ver 5.2.1)
-- QT OpenGL support: NO
-- OpenGL support: NO
-- VTK support: YES (ver 5.8.0)
--
-- Media I/O:
-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8)
-- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
-- WEBP: /usr/lib/x86_64-linux-gnu/libwebp.so (ver encoder: 0x0202)
-- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.50)
-- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 4.0.3)
-- JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
-- OpenEXR: /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so (ver 1.6.1)
-- GDAL: NO
--
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: YES (ver 2.2.1)
-- FFMPEG: YES
-- codec: YES (ver 54.35.0)
-- format: YES (ver 54.20.4)
-- util: YES (ver 52.3.0)
-- swscale: YES (ver 2.1.1)
-- resample: NO
-- gentoo-style: YES
-- GStreamer: NO
-- OpenNI: NO
-- OpenNI PrimeSensor Modules: NO
-- OpenNI2: NO
-- PvAPI: NO
-- GigEVisionSDK: NO
-- UniCap: NO
-- UniCap ucil: NO
-- V4L/V4L2: NO/YES
-- XIMEA: NO
-- Xine: NO
-- gPhoto2: NO
--
-- Other third-party libraries:
-- Use IPP: 8.2.1 [8.2.1]
-- at: /home/mpkusex/Downloads/opencv-3.0.0/3rdparty/ippicv/unpack/ippicv_lnx
-- Use IPP Async: NO
-- Use Eigen: YES (ver 3.2.6)
-- Use TBB: YES (ver 4.2 interface 7000)
-- Use OpenMP: YES
-- Use GCD NO
-- Use Concurrency NO
-- Use C=: NO
-- Use pthreads for parallel for:
-- NO
-- Use Cuda: YES (ver 7.5)
-- Use OpenCL: YES
--
-- NVIDIA CUDA
-- Use CUFFT: YES
-- Use CUBLAS: NO
-- USE NVCUVID: NO
-- NVIDIA GPU arch: 20 21 30 35
-- NVIDIA PTX archs: 30
-- Use fast math: NO
--
-- OpenCL:
-- Version: dynamic
-- Include path: /home/mpkusex/Downloads/opencv-3.0.0/3rdparty/include/opencl/1.2
-- Use AMDFFT: NO
-- Use AMDBLAS: NO
--
-- Python 2:
-- Interpreter: /usr/bin/python2.7 (ver 2.7.6)
--
-- Python 3:
-- Interpreter: /usr/bin/python3.4 (ver 3.4)
--
-- Python (for build): /usr/bin/python2.7
--
-- Java:
-- ant: NO
-- JNI: NO
-- Java wrappers: NO
-- Java tests: NO
--
-- Matlab:
-- mex: NO
--
-- Documentation:
-- Doxygen: /usr/bin/doxygen (ver 1.8.6)
-- PlantUML: NO
--
-- Tests and samples:
-- Tests: YES
-- Performance tests: YES
-- C/C++ Examples: YES
--
-- Install path: /usr/local
--
-- cvconfig.h is in: /home/mpkusex/Downloads/opencv-3.0.0/build
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mpkusex/Downloads/opencv-3.0.0/buil
Relevant section of my CMakeLists.txt. I am using opencv with catkin (ros - ros.org) which is essentially same as cmake. I can run my other opencv stuff like edge detection, image reading etc.
cmake_minimum_required(VERSION 2.8.3)
project(visensor_dgem)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
cv_bridge
image_transport
roscpp
tf
message_generation
)
find_package( message_generation )
find_package( OpenCV 3.0 REQUIRED COMPONENTS core highgui flann calib3d video )
add_executable( videoReader
src/videoReader.cpp
)
target_link_libraries( videoReader
${Boost_THREAD_LIBRARY}
${catkin_LIBRARIES}
)
How can I resolve this?

Related

How to setup CLion IDE with custom libc++ and clang?

CLion website says they support "libc++" but there is no information on how to set up CLlion to use libc++. I'm using Ubuntu 16 and downloaded libc++ source and built it. So I want to use this specific version.
Here's what I've tried so far:
So I have now libc++ binaries. Then I created simple hello world project and changed its CMakeLists.txt to use my custom libc++. However when I try to run the project, I get error:
/home/shitals/CLionProjects/JsonTest/cmake-build-debug/JsonTest: error while loading shared libraries: libc++.so.1: cannot open shared object file: No such file or directory
Here's my project cmake to force using my custom libc++.
cmake_minimum_required(VERSION 3.8)
project(JsonTest)
set(CMAKE_CXX_STANDARD 14)
#libcxx which we will use with specific version of clang
SET(LIBCXX_INC_PATH /home/shitals/mylibc++/include/c++/v1)
SET(LIBCXX_LIB_PATH /home/shitals/mylibc++/lib)
set(CMAKE_C_COMPILER clang-3.9)
set(CMAKE_CXX_COMPILER clang++-3.9)
set(CMAKE_CXX_FLAGS "\
-std=c++14 -ggdb -Wall -Wextra -Wstrict-aliasing -Wunreachable-code -Wcast-qual -Wctor-dtor-privacy \
-Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-include-dirs -Wswitch-default \
-Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wstrict-overflow=5 -Wswitch-default -Wundef \
-Wno-variadic-macros -Wno-parentheses -Wno-unused-function -Wno-unused -Wno-documentation -fdiagnostics-show-option -ferror-limit=10 \
-pthread ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "\
-nostdinc++ -isystem ${LIBCXX_INC_PATH} \
-D__CLANG__ ${CMAKE_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "\
${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++ -lc++abi -lm -lc -lgcc_s -lgcc -ldl \
-L ${LIBCXX_LIB_PATH}")
set(SOURCE_FILES main.cpp)
add_executable(JsonTest ${SOURCE_FILES})
My compiled libc++ binaries does have libc++.so.1 file.
Ok... so below CMakeLists.txt in project root does seem to work:
cmake_minimum_required(VERSION 3.8)
project(JsonTest)
set(CMAKE_CXX_STANDARD 14)
#libcxx which we will use with specific version of clang
SET(LIBCXX_INC_PATH /home/shitals/GitHubSrc/AirSim/llvm-build/output/include/c++/v1)
SET(LIBCXX_LIB_PATH /home/shitals/GitHubSrc/AirSim/llvm-build/output/lib)
set(CMAKE_C_COMPILER clang-3.9)
set(CMAKE_CXX_COMPILER clang++-3.9)
set(CMAKE_CXX_FLAGS "\
-std=c++14 -ggdb -Wall -Wextra -Wstrict-aliasing -Wunreachable-code -Wcast-qual -Wctor-dtor-privacy \
-Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-include-dirs -Wswitch-default \
-Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wstrict-overflow=5 -Wswitch-default -Wundef \
-Wno-variadic-macros -Wno-parentheses -Wno-unused-function -Wno-unused -Wno-documentation -fdiagnostics-show-option -ferror-limit=10 \
-pthread ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "\
-nostdinc++ -isystem ${LIBCXX_INC_PATH} \
-D__CLANG__ ${CMAKE_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "\
${CMAKE_EXE_LINKER_FLAGS} -v -nodefaultlibs -lc++ -lc++abi -lm -lc -lgcc_s -lgcc -ldl \
-L ${LIBCXX_LIB_PATH}")
LINK_DIRECTORIES(${LIBCXX_LIB_PATH})
set(SOURCE_FILES main.cpp)
add_executable(JsonTest ${SOURCE_FILES})
TARGET_LINK_LIBRARIES(JsonTest c++ c++abi)

linux kernel 4.4 build error: garbage following instruction

I am trying to build a custom linux kernel 4.4 running for AT91 with mostly default configuration that I set up from menuconfig. The build fails with the following error. The gcc version is 4.6.3 and the binutils version is 2.22. There is nothing obvious in main.c which is where the compilation is at the time of failure. Dont understand what to look for as I have run out of ideas.
arm-none-linux-gnueabi-gcc -Wp,-MD,init/.main.o.d -nostdinc -isystem /opt/arm-2009q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/include -I./arch/arm/include -Iarch/arm/include/generated/uapi -Iarch/arm/include/generated -Iinclude -I./arch/arm/include/uapi -Iarch/arm/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mabi=apcs-gnu -mno-thumb-interwork -marm -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -fno-delete-null-pointer-checks -O2 -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -gdwarf-2 -pg -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -Werror=implicit-int -Werror=strict-prototypes -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(main)" -D"KBUILD_MODNAME=KBUILD_STR(main)" -c -o init/.tmp_main.o init/main.c
/tmp/ccbj4Zgm.s: Assembler messages:
/tmp/ccbj4Zgm.s:852: Error: garbage following instruction -- `dmb ishst'
/tmp/ccbj4Zgm.s:874: Error: garbage following instruction -- `dmb ishst'
/tmp/ccbj4Zgm.s:909: Error: garbage following instruction -- `dmb ish'
/tmp/ccbj4Zgm.s:921: Error: garbage following instruction -- `dsb ishst'
make[2]: *** [init/main.o] Error 1
make[1]: *** [init] Error 2

Conflicting declaration while compiling 6.3.0 gcc

Ubuntu Xenial, x86_64
Compiling 6.3.0 gcc
nativ gcc version is 5.4.0
Error Source:
g++ -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -DGENERATOR_FILE -fno-PIE -I. -Ibuild -I../../gcc-6.3.0/gcc -I../../gcc-6.3.0/gcc/build -I../../gcc-6.3.0/gcc/../include -I../../gcc-6.3.0/gcc/../libcpp/include \
-o build/genmddeps.o ../../gcc-6.3.0/gcc/genmddeps.c
Error:
In file included from ./bconfig.h:3:0,
from ../../gcc-6.3.0/gcc/genmddeps.c:18:
./auto-host.h:2321:16: error: declaration does not declare anything [-fpermissive]
#define rlim_t long
^
In file included from ../../gcc-6.3.0/gcc/genmddeps.c:19:0:
../../gcc-6.3.0/gcc/system.h:488:23: error: conflicting declaration of C function ‘void* sbrk(int)’
extern void *sbrk (int);
^
I am trying to compile gcc from scratch. My config options are
../gcc-6.3.0/configure --target=arm-eabi --prefix=/local/development/arm-project/tools/ --enable-languages=c --with-newlib --without-headers
Can anyone please help with debugging?
Try (and edit accordingly):
tar xzf gcc-6.3.0.tar.gz
cd gcc-6.3.0
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-6.3.0/configure --prefix=$HOME/GCC-6.3.0 --enable-languages=c,c++
make
make install
Source: Installing GCC
I could resolve this issue, by installing gmp-devel, mpfr-devel and libmpc-devel. See GCC docs for details.
There are some additional requirements for GCC 9.1.0 such as DejaGnu 1.6.2 and GDB 8.3 (solved my libiberty make target error).
If you have more than one compiler installed, use the GCC compiler:
export CC=gcc
export CXX=g++

Xcode 4.3 : Clang LLVM 1.0 Error

I would like to use SDL in a project, so I create a Cocoa Project and I add all Framework needed, but XCode tells me this :
ProcessPCH /Users/aurelien/Library/Developer/Xcode/DerivedData/projetCS2-gdnozsjskcozmxcvmlmmpsmmkcvk/Build/Intermediates/PrecompiledHeaders/projetCS2-Prefix-auneaovyjutgotajcmkllwxdblci/projetCS2-Prefix.pch.pth projetCS2/projetCS2-Prefix.pch normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/aurelien/Documents/Programmation/projetC-S2/projetCS2
setenv LANG en_US.US-ASCII
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c-header -arch i386 -fmessage-length=0 -std=gnu99 -fobjc-arc -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wno-implicit-atomic-properties -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-sign-compare -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -fasm-blocks -Wprotocol -Wdeprecated-declarations -mmacosx-version-min=10.7 -g -Wno-conversion -Wno-sign-conversion "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -I/Users/aurelien/Library/Developer/Xcode/DerivedData/projetCS2-gdnozsjskcozmxcvmlmmpsmmkcvk/Build/Intermediates/projetCS2.build/Debug/projetCS2.build/projetCS2.hmap -I/Users/aurelien/Library/Developer/Xcode/DerivedData/projetCS2-gdnozsjskcozmxcvmlmmpsmmkcvk/Build/Products/Debug/include -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_ttf.framework/Headers -I/Users/aurelien/Library/Developer/Xcode/DerivedData/projetCS2-gdnozsjskcozmxcvmlmmpsmmkcvk/Build/Intermediates/projetCS2.build/Debug/projetCS2.build/DerivedSources/i386 -I/Users/aurelien/Library/Developer/Xcode/DerivedData/projetCS2-gdnozsjskcozmxcvmlmmpsmmkcvk/Build/Intermediates/projetCS2.build/Debug/projetCS2.build/DerivedSources -F/Users/aurelien/Library/Developer/Xcode/DerivedData/projetCS2-gdnozsjskcozmxcvmlmmpsmmkcvk/Build/Products/Debug -F/Library/Frameworks --serialize-diagnostics /Users/aurelien/Library/Developer/Xcode/DerivedData/projetCS2-gdnozsjskcozmxcvmlmmpsmmkcvk/Build/Intermediates/PrecompiledHeaders/projetCS2-Prefix-auneaovyjutgotajcmkllwxdblci/projetCS2-Prefix.pch.dia -c /Users/aurelien/Documents/Programmation/projetC-S2/projetCS2/projetCS2/projetCS2-Prefix.pch -o /Users/aurelien/Library/Developer/Xcode/DerivedData/projetCS2-gdnozsjskcozmxcvmlmmpsmmkcvk/Build/Intermediates/PrecompiledHeaders/projetCS2-Prefix-auneaovyjutgotajcmkllwxdblci/projetCS2-Prefix.pch.pth -MMD -MT dependencies -MF /Users/aurelien/Library/Developer/Xcode/DerivedData/projetCS2-gdnozsjskcozmxcvmlmmpsmmkcvk/Build/Intermediates/PrecompiledHeaders/projetCS2-Prefix-auneaovyjutgotajcmkllwxdblci/projetCS2-Prefix.pch.d
error: -fobjc-arc is not supported with fragile abi
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
The error says you are using ARC (automatic reference counting) on your project, and that it's not supported using the fragile ABI (simulator).
You are surely building your app for 32-bits.
ARC is 64-bits only.
Try to update your projects settings, and build for 64-bits instead of 32 or universal.

problems on installing link-parser gem on snow leopard

I cannot make link-parser gem working on my snow leopard.
When I tried to do 'sudo gem install linkparser' and I get:
Building native extensions. This could take a while...
ERROR: Error installing linkparser:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for pkg-config... no
*** 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/1.8/usr/bin/ruby
--with-link-grammar
--without-link-grammar
--with-pkg-config
--without-pkg-config
extconf.rb:18: Couldn't find your pkg-config binary (RuntimeError)
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/linkparser-1.1.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/linkparser-1.1.0/ext/gem_make.out
When I compiled link-grammar 4.3.5 from source (it went well) and then tried to do 'rake':
Task library 'rake/manual.rb' failed to load: NameError: uninitialized constant MANUALDIR. Some tasks may not be available.
No DarkFish: LoadError: no such file to load -- darkfish-rdoc
Task library 'rake/rdoc.rb' failed to load: NameError: uninitialized constant RDOCDIR. Some tasks may not be available.
Task library 'rake/testing.rb' failed to load: NameError: uninitialized constant Spec. Some tasks may not be available.
rm -r coverage
rake clean
(in /Users/alan/linkparser/ext)
rm -r dictionary.o
rm -r linkage.o
rm -r linkparser.o
rm -r parseoptions.o
rm -r sentence.o
rake
(in /Users/alan/linkparser/ext)
gcc -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -Wall -DDEBUG -DHAVE_LINK_GRAMMAR_LINK_INCLUDES_H -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I/Library/Ruby/Site/1.8 -I. -c dictionary.c
gcc -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -Wall -DDEBUG -DHAVE_LINK_GRAMMAR_LINK_INCLUDES_H -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I/Library/Ruby/Site/1.8 -I. -c linkage.c
gcc -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -Wall -DDEBUG -DHAVE_LINK_GRAMMAR_LINK_INCLUDES_H -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I/Library/Ruby/Site/1.8 -I. -c linkparser.c
gcc -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -Wall -DDEBUG -DHAVE_LINK_GRAMMAR_LINK_INCLUDES_H -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I/Library/Ruby/Site/1.8 -I. -c parseoptions.c
gcc -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -Wall -DDEBUG -DHAVE_LINK_GRAMMAR_LINK_INCLUDES_H -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I/Library/Ruby/Site/1.8 -I. -c sentence.c
cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -o linkparser_ext.bundle dictionary.o linkage.o linkparser.o parseoptions.o sentence.o -lpthread -ldl -llink-grammar -lruby
ld: warning: in /usr/local/lib/liblink-grammar.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
Specification tasks not defined: no such file to load -- spec/rake/spectask
rake aborted!
Don't know how to build task 'rdoc'
How to fix this? Is there any special compiling options I need to specify when I compile link-grammar?
It looks like you need to install pkg-config.
I'd recommend installing it by first installing XCode (if you haven't already), then Homebrew (a package manager for OS X), and then running brew install pkg-config in the terminal.
If you already have MacPorts or Fink installed I'm sure you can find the appropriate package in their repositories as well.

Resources