Protobuf build fail in Yocto - protocol-buffers

I'm using bitbake 1.32.0, Yocto 2.2.2 (Poky) trying to add protobuf-c to my build. I keep getting a build failure on protobuf_2.6.1 (protobuf-c depends on protobuf).
I can manually download the Protobuf source code and cross-compile it without any problems. But for some reason Yocto can't build it.
During the Yocto build process, libprotobuf-lite.so links okay, but libprotobuf.so fails linking due to these errors:
| /home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
| /usr/src/debug/glibc/2.24-r0/git/csu/elf-init.c:87: undefined reference to `__init_array_end'
| /usr/src/debug/glibc/2.24-r0/git/csu/elf-init.c:87: undefined reference to `__init_array_start'
| /home/cjholmes/gen4/build/tmp/sysroots/x86_64-linux/usr/libexec/arm-agl-linux-gnueabi/gcc/arm-agl-linux-gnueabi/6.2.0/ld: .libs/libprotobuf.so.9.0.1: hidden symbol `__init_array_end' isn't defined
| /home/cjholmes/gen4/build/tmp/sysroots/x86_64-linux/usr/libexec/arm-agl-linux-gnueabi/gcc/arm-agl-linux-gnueabi/6.2.0/ld: final link failed: Bad value
I have tried looking through the .o files that are part of libprotobuf.so but are not included in libprotobuf-lite.so, to see if anything directly references the missing symbols, but I haven't found anything useful yet.
For a while I thought the culprit was -nostdlib. But then I saw libprotobuf-lite compiles just fine with that flag, and the -lc and -lgcc flags are included in the link command.
The recipe is a very straightforward autotools setup.
SUMMARY = "Protocol Buffers - structured data serialisation mechanism"
DESCRIPTION = "Protocol Buffers are a way of encoding structured data in an \
efficient yet extensible format. Google uses Protocol Buffers for almost \
all of its internal RPC protocols and file formats."
HOMEPAGE = "https://github.com/google/protobuf"
SECTION = "console/tools"
LICENSE = "BSD-3-Clause"
PACKAGE_BEFORE_PN = "${PN}-compiler"
DEPENDS = "zlib"
RDEPENDS_${PN}-compiler = "${PN}"
RDEPENDS_${PN}-dev += "${PN}-compiler"
LIC_FILES_CHKSUM =
"file://LICENSE;md5=af6809583bfde9a31595a58bb4a24514"
SRCREV = "bba83652e1be610bdb7ee1566ad18346d98b843c"
PV = "2.6.1+git${SRCPV}"
SRC_URI = "git://github.com/google/protobuf.git"
EXTRA_OECONF += " --with-protoc=echo"
inherit autotools
S = "${WORKDIR}/git"
FILES_${PN}-compiler = "${bindir} ${libdir}/libprotoc${SOLIBS}"
BBCLASSEXTEND = "native nativesdk"
Here is the more complete error statement:
| arm-agl-linux-gnueabi-libtool: link: arm-agl-linux-gnueabi-g++ -march=armv7-a -marm -mfpu=neon -mfloat-abi=softfp -mcpu=cortex-a9 --sysroot=/home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4 -fPIC -DPIC -shared -nostdlib /home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/Scrt1.o /home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/crti.o /home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/arm-agl-linux-gnueabi/6.2.0/crtbeginS.o google/protobuf/stubs/.libs/atomicops_internals_x86_gcc.o google/protobuf/stubs/.libs/atomicops_internals_x86_msvc.o google/protobuf/stubs/.libs/common.o google/protobuf/stubs/.libs/once.o google/protobuf/stubs/.libs/stringprintf.o google/protobuf/.libs/extension_set.o google/protobuf/.libs/generated_message_util.o google/protobuf/.libs/message_lite.o google/protobuf/.libs/repeated_field.o google/protobuf/.libs/wire_format_lite.o google/protobuf/io/.libs/coded_stream.o google/protobuf/io/.libs/zero_copy_stream.o google/protobuf/io/.libs/zero_copy_stream_impl_lite.o google/protobuf/stubs/.libs/strutil.o google/protobuf/stubs/.libs/substitute.o google/protobuf/stubs/.libs/structurally_valid.o google/protobuf/.libs/descriptor.o google/protobuf/.libs/descriptor.pb.o google/protobuf/.libs/descriptor_database.o google/protobuf/.libs/dynamic_message.o google/protobuf/.libs/extension_set_heavy.o google/protobuf/.libs/generated_message_reflection.o google/protobuf/.libs/message.o google/protobuf/.libs/reflection_ops.o google/protobuf/.libs/service.o google/protobuf/.libs/text_format.o google/protobuf/.libs/unknown_field_set.o google/protobuf/.libs/wire_format.o google/protobuf/io/.libs/gzip_stream.o google/protobuf/io/.libs/printer.o google/protobuf/io/.libs/strtod.o google/protobuf/io/.libs/tokenizer.o google/protobuf/io/.libs/zero_copy_stream_impl.o google/protobuf/compiler/.libs/importer.o google/protobuf/compiler/.libs/parser.o -lpthread -lz -L/home/cjholmes/gen4/build/tmp/sysroots/x86_64-linux/usr/lib/arm-agl-linux-gnueabi/gcc/arm-agl-linux-gnueabi/6.2.0 -L/home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/lib -L/home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/arm-agl-linux-gnueabi/6.2.0 -L/home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib /home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/libstdc++.so -lm /home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/libssp_nonshared.a -lc -lgcc_s -lgcc /home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/arm-agl-linux-gnueabi/6.2.0/crtendS.o /home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/crtn.o -march=armv7-a -marm -mfpu=neon -mfloat-abi=softfp -mcpu=cortex-a9 --sysroot=/home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4 -pthread -O2 -g -fstack-protector-strong -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z -Wl,relro -Wl,-z -Wl,now -pthread -Wl,-soname -Wl,libprotobuf.so.9 -o .libs/libprotobuf.so.9.0.1
| arm-agl-linux-gnueabi-libtool: link: arm-agl-linux-gnueabi-g++ -march=armv7-a -marm -mfpu=neon -mfloat-abi=softfp -mcpu=cortex-a9 --sysroot=/home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4 -fPIC -DPIC -shared -nostdlib /home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/Scrt1.o /home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/crti.o /home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/arm-agl-linux-gnueabi/6.2.0/crtbeginS.o google/protobuf/stubs/.libs/atomicops_internals_x86_gcc.o google/protobuf/stubs/.libs/atomicops_internals_x86_msvc.o google/protobuf/stubs/.libs/common.o google/protobuf/stubs/.libs/once.o google/protobuf/stubs/.libs/stringprintf.o google/protobuf/.libs/extension_set.o google/protobuf/.libs/generated_message_util.o google/protobuf/.libs/message_lite.o google/protobuf/.libs/repeated_field.o google/protobuf/.libs/wire_format_lite.o google/protobuf/io/.libs/coded_stream.o google/protobuf/io/.libs/zero_copy_stream.o google/protobuf/io/.libs/zero_copy_stream_impl_lite.o -lpthread -lz -L/home/cjholmes/gen4/build/tmp/sysroots/x86_64-linux/usr/lib/arm-agl-linux-gnueabi/gcc/arm-agl-linux-gnueabi/6.2.0 -L/home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/lib -L/home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/arm-agl-linux-gnueabi/6.2.0 -L/home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib /home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/libstdc++.so -lm /home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/libssp_nonshared.a -lc -lgcc_s -lgcc /home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/arm-agl-linux-gnueabi/6.2.0/crtendS.o /home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/crtn.o -march=armv7-a -marm -mfpu=neon -mfloat-abi=softfp -mcpu=cortex-a9 --sysroot=/home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4 -pthread -O2 -g -fstack-protector-strong -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z -Wl,relro -Wl,-z -Wl,now -pthread -Wl,-soname -Wl,libprotobuf-lite.so.9 -o .libs/libprotobuf-lite.so.9.0.1
| ERROR: oe_runmake failed
| /home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
| /usr/src/debug/glibc/2.24-r0/git/csu/elf-init.c:87: undefined reference to `__init_array_end'
| /usr/src/debug/glibc/2.24-r0/git/csu/elf-init.c:87: undefined reference to `__init_array_start'
| /home/cjholmes/gen4/build/tmp/sysroots/x86_64-linux/usr/libexec/arm-agl-linux-gnueabi/gcc/arm-agl-linux-gnueabi/6.2.0/ld: .libs/libprotobuf-lite.so.9.0.1: hidden symbol `__init_array_end' isn't defined
| /home/cjholmes/gen4/build/tmp/sysroots/x86_64-linux/usr/libexec/arm-agl-linux-gnueabi/gcc/arm-agl-linux-gnueabi/6.2.0/ld: final link failed: Bad value
| collect2: error: ld returned 1 exit status
| make[3]: *** [libprotobuf-lite.la] Error 1
| make[3]: *** Waiting for unfinished jobs....
| /home/cjholmes/gen4/build/tmp/sysroots/imx6dlleargen4/usr/lib/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
| /usr/src/debug/glibc/2.24-r0/git/csu/elf-init.c:87: undefined reference to `__init_array_end'
| /usr/src/debug/glibc/2.24-r0/git/csu/elf-init.c:87: undefined reference to `__init_array_start'
| /home/cjholmes/gen4/build/tmp/sysroots/x86_64-linux/usr/libexec/arm-agl-linux-gnueabi/gcc/arm-agl-linux-gnueabi/6.2.0/ld: .libs/libprotobuf.so.9.0.1: hidden symbol `__init_array_end' isn't defined
| /home/cjholmes/gen4/build/tmp/sysroots/x86_64-linux/usr/libexec/arm-agl-linux-gnueabi/gcc/arm-agl-linux-gnueabi/6.2.0/ld: final link failed: Bad value
| collect2: error: ld returned 1 exit status
| make[3]: *** [libprotobuf.la] Error 1
| make[3]: Leaving directory `/home/cjholmes/gen4/build/tmp/work/cortexa9-neon-agl-linux-gnueabi/protobuf/2.6.1+gitAUTOINC+bba83652e1-r0/build/src'
| make[2]: *** [all] Error 2
| make[2]: Leaving directory `/home/cjholmes/gen4/build/tmp/work/cortexa9-neon-agl-linux-gnueabi/protobuf/2.6.1+gitAUTOINC+bba83652e1-r0/build/src'
| make[1]: *** [all-recursive] Error 1
| make[1]: Leaving directory `/home/cjholmes/gen4/build/tmp/work/cortexa9-neon-agl-linux-gnueabi/protobuf/2.6.1+gitAUTOINC+bba83652e1-r0/build'
| make: *** [all] Error 2
| WARNING: /home/cjholmes/gen4/build/tmp/work/cortexa9-neon-agl-linux-gnueabi/protobuf/2.6.1+gitAUTOINC+bba83652e1-r0/temp/run.do_compile.121250:1 exit 1 from 'exit 1'
| ERROR: Function failed: do_compile (log file is located at /home/cjholmes/gen4/build/tmp/work/cortexa9-neon-agl-linux-gnueabi/protobuf/2.6.1+gitAUTOINC+bba83652e1-r0/temp/log.do_compile.121250)
I could really use some pointers on what to look at next. This has eaten a lot of hours already.

Related

Linux kernel: can't build module with non-retpoline compiler

OS - RedHat 8.5, kernel 4.18.0-348.20.1.el8_5.x86_64, gcc-8.5.0
I have installed kernel-devel and kernel-headers, and tried to build a very simple kernel module (just a pair of printk()).
Makefile:
obj-m += test_mod.o
MSRC ?= $(PWD)
KDIR ?= /lib/modules/`uname -r`/build/
all:
make -C $(KDIR) M=$(MSRC) modules
clean:
make -C $(KDIR) M=$(MSRC) clean
However I'm getting error:
% make V=1
make -C /lib/modules/`uname -r`/build M= modules
make[1]: Entering directory '/usr/src/kernels/4.18.0-348.20.1.el8_5.x86_64'
arch/x86/Makefile:249: *** You are building kernel with non-retpoline compiler, please update your compiler.. Stop.
make[1]: Leaving directory '/usr/src/kernels/4.18.0-348.20.1.el8_5.x86_64'
make: *** [Makefile:4: all] Error 2
%
Do I have to upgrade to a new compiler, if so which compiler version is needed? man gcc on my machine (RHEL8.5) says that -mindirect-branch= option is supported, and I believe this is the one enabling retpoline.
Should it be possible to disable retpoline support in the kernel? (however I would not like to rebuild the kernel if possible).
Thanks!
EDIT
I disabled retpoline as suggested by 0andriy via grub configuration file, (cat /proc/cmdline shows spectre_v2=off):
% grub2-editenv - set kernelopts=root=/dev/mapper/rhel_ps3cat5505k1-root ro crashkernel=auto resume=/dev/mapper/rhel_ps3cat5505k1-swap rd.lvm.lv=rhel_ps3cat5505k1/root rd.lvm.lv=rhel_ps3cat5505k1/swap rhgb quiet spectre_v2=off
% reboot
However the build still fails:
% make V=1
make -C /lib/modules/`uname -r`/build/ M=/home/mrv/tmp modules
make[1]: Entering directory '/usr/src/kernels/4.18.0-348.20.1.el8_5.x86_64'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo >&2; \
echo >&2 " ERROR: Kernel configuration is invalid."; \
echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo >&2 ; \
/bin/false)
mkdir -p /home/mrv/tmp/.tmp_versions ; rm -f /home/mrv/tmp/.tmp_versions/*
make -f ./scripts/Makefile.build obj=/home/mrv/tmp
(cat /dev/null; echo kernel//home/mrv/tmp/test_mod.ko;) > /home/mrv/tmp/modules.order
gcc -Wp,-MD,/home/mrv/tmp/.test_mod.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/8/include -I./arch/x86/include -I./arch/x86/include/generated -I./include/drm-backport -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-PIE -DCC_HAVE_ASM_GOTO -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -DCONFIG_TPAUSE=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-int-in-bool-context -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wno-unused-const-variable -g -gdwarf-4 -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=./= -Wno-packed-not-aligned -DMODULE -DKBUILD_BASENAME='"test_mod"' -DKBUILD_MODNAME='"test_mod"' -c -o /home/mrv/tmp/.tmp_test_mod.o /home/mrv/tmp/test_mod.c
In file included from ./include/linux/module.h:18,
from /home/mrv/tmp/test_mod.c:1:
./include/linux/moduleparam.h:22:1: error: expected ‘,’ or ‘;’ before ‘static’
static const char __UNIQUE_ID(name)[] \
^~~~~~
./include/linux/module.h:158:32: note: in expansion of macro ‘__MODULE_INFO’
#define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
^~~~~~~~~~~~~
./include/linux/module.h:196:34: note: in expansion of macro ‘MODULE_INFO’
#define MODULE_LICENSE(_license) MODULE_INFO(license, _license)
^~~~~~~~~~~
/home/mrv/tmp/test_mod.c:19:1: note: in expansion of macro ‘MODULE_LICENSE’
MODULE_LICENSE("GPL")
^~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:322: /home/mrv/tmp/test_mod.o] Error 1
make[1]: *** [Makefile:1571: _module_/home/mrv/tmp] Error 2
make[1]: Leaving directory '/usr/src/kernels/4.18.0-348.20.1.el8_5.x86_64'
make: *** [Makefile:6: all] Error 2
%
So, running 'make oldconfig && make prepare' in kernel sources directory /usr/src/kernels/4.18.0-348.20.1.el8_5.x86_64 results in failure to locate tools/build/Build.include.
Not sure if RedHat allows to build kernel modules in RHEL8 at all.
EDIT2
Simple kernel module:
#include <linux/module.h>
#include <linux/kernel.h>
static __init int test_init(void)
{
printk("Init module\n");
return 0;
}
static __exit void test_exit(void)
{
printk("Cleanup module\n");
}
module_init(test_init)
module_exit(test_exit)
MODULE_DESCRIPTION("Test module");
MODULE_LICENSE("GPL");

Vasp 6.2.1 not compiling

I am trying to compile vasp 6.2.1 in my ubuntu 19.10 on VirtualBox. I have intel openApi (which has ifortran compiler) and fftw3 installed. I am trying to compile the serial version using ifort. But it's giving me an error as follows.
if [ ! -d build ] ; then mkdir build ; fi
if [ ! -d build/std ] ; then mkdir build/std ; fi
cp src/makefile src/.objects src/makedeps.awk makefile.include build/std
make -C build/std VERSION=std cleandependencies -j1
make[1]: Entering directory '/home/mdazharul/vasp/vasp6.2.1/vasp6.2.1/vasp6.2.1/vasp.6.2.1/build/std'
rm -f .depend
make[1]: Leaving directory '/home/mdazharul/vasp/vasp6.2.1/vasp6.2.1/vasp6.2.1/vasp.6.2.1/build/std'
make -C build/std VERSION=std all
make[1]: Entering directory '/home/mdazharul/vasp/vasp6.2.1/vasp6.2.1/vasp6.2.1/vasp.6.2.1/build/std'
rsync -ru ../../src/lib .
cp makefile.include lib
make -C lib -j1
make[2]: Entering directory '/home/mdazharul/vasp/vasp6.2.1/vasp6.2.1/vasp6.2.1/vasp.6.2.1/build/std/lib'
make libdmy.a
make[3]: Entering directory '/home/mdazharul/vasp/vasp6.2.1/vasp6.2.1/vasp6.2.1/vasp.6.2.1/build/std/lib'
make[3]: 'libdmy.a' is up to date.
make[3]: Leaving directory '/home/mdazharul/vasp/vasp6.2.1/vasp6.2.1/vasp6.2.1/vasp.6.2.1/build/std/lib'
make[2]: Leaving directory '/home/mdazharul/vasp/vasp6.2.1/vasp6.2.1/vasp6.2.1/vasp.6.2.1/build/std/lib'
rsync -ru ../../src/parser .
cp makefile.include parser
make -C parser -j1
make[2]: Entering directory '/home/mdazharul/vasp/vasp6.2.1/vasp6.2.1/vasp6.2.1/vasp.6.2.1/build/std/parser'
make libparser.a
make[3]: Entering directory '/home/mdazharul/vasp/vasp6.2.1/vasp6.2.1/vasp6.2.1/vasp.6.2.1/build/std/parser'
make[3]: 'libparser.a' is up to date.
make[3]: Leaving directory '/home/mdazharul/vasp/vasp6.2.1/vasp6.2.1/vasp6.2.1/vasp.6.2.1/build/std/parser'
make[2]: Leaving directory '/home/mdazharul/vasp/vasp6.2.1/vasp6.2.1/vasp6.2.1/vasp.6.2.1/build/std/parser'
rsync -u ../../src/*.F ../../src/*.inc .
rm -f vasp ; make vasp ; cp vasp ../../bin/vasp_std
make[2]: Entering directory '/home/mdazharul/vasp/vasp6.2.1/vasp6.2.1/vasp6.2.1/vasp.6.2.1/build/std'
mpiifort -qmkl=cluster -lstdc++ -o vasp c2f_interface.o nccl2for.o simd.o base.o profiling.o string.o tutor.o version.o vhdf5_base.o incar_reader.o reader_base.o openmp.o openacc_struct.o mpi.o mpi_shmem.o mathtools.o hamil_struct.o radial_struct.o pseudo_struct.o mgrid_struct.o wave_struct.o nl_struct.o mkpoints_struct.o poscar_struct.o afqmc_struct.o phonon_struct.o fock_glb.o chi_glb.o smart_allocate.o xml.o extpot_glb.o constant.o vdwforcefield_glb.o jacobi.o main_mpi.o openacc.o scala.o asa.o lattice.o poscar.o ini.o mgrid.o setex_struct.o xclib.o vdw_nl.o xclib_grad.o setex.o radial.o pseudo.o gridq.o ebs.o symlib.o mkpoints.o random.o wave.o wave_mpi.o wave_high.o bext.o spinsym.o symmetry.o lattlib.o nonl.o nonlr.o nonl_high.o dfast.o choleski2.o mix.o hamil.o xcgrad.o xcspin.o potex1.o potex2.o constrmag.o cl_shift.o relativistic.o LDApU.o paw_base.o metagga.o egrad.o pawsym.o pawfock.o pawlhf.o diis.o rhfatm.o hyperfine.o fock_ace.o paw.o mkpoints_full.o charge.o Lebedev-Laikov.o stockholder.o dipol.o solvation.o scpc.o pot.o tet.o dos.o elf.o hamil_rot.o chain.o dyna.o fileio.o vhdf5.o sphpro.o us.o core_rel.o aedens.o wavpre.o wavpre_noio.o broyden.o dynbr.o reader.o writer.o xml_writer.o brent.o stufak.o opergrid.o stepver.o chgloc.o fast_aug.o fock_multipole.o fock.o fock_dbl.o fock_frc.o mkpoints_change.o subrot_cluster.o sym_grad.o mymath.o npt_dynamics.o subdftd3.o subdftd4.o internals.o dynconstr.o dimer_heyden.o dvvtrajectory.o vdwforcefield.o nmr.o pead.o k-proj.o subrot.o subrot_scf.o paircorrection.o rpa_force.o ml_interface.o force.o pwlhf.o gw_model.o optreal.o steep.o rmm-diis.o davidson.o david_inner.o root_find.o lcao_bare.o locproj.o electron_common.o electron.o rot.o electron_all.o shm.o pardens.o optics.o constr_cell_relax.o stm.o finite_diff.o elpol.o hamil_lr.o rmm-diis_lr.o subrot_lr.o lr_helper.o hamil_lrf.o elinear_response.o ilinear_response.o linear_optics.o setlocalpp.o wannier.o electron_OEP.o electron_lhf.o twoelectron4o.o gauss_quad.o m_unirnk.o minimax_ini.o minimax_dependence.o minimax_functions1D.o minimax_functions2D.o minimax_struct.o minimax_varpro.o minimax.o mlwf.o ratpol.o pade_fit.o screened_2e.o wave_cacher.o crpa.o chi_base.o wpot.o local_field.o ump2.o ump2kpar.o fcidump.o ump2no.o bse_te.o bse.o time_propagation.o acfdt.o afqmc.o rpax.o chi.o acfdt_GG.o dmft.o GG_base.o greens_orbital.o lt_mp2.o rnd_orb_mp2.o greens_real_space.o chi_GG.o chi_super.o sydmat.o rmm-diis_mlr.o linear_response_NMR.o wannier_interpol.o wave_interpolate.o linear_response.o auger.o dmatrix.o phonon.o wannier_mats.o elphon.o core_con_mat.o embed.o extpot.o fft3dfurth.o fft3dlib.o main.o -Llib -ldmy -Lparser -lparser -Lparser -lparser -lstdc++
ipo: warning #11021: unresolved fftext_mu_
Referenced in /tmp/ipo_ifortQlEAwA.o
ipo: warning #11021: unresolved fftext_useinv_mu_
Referenced in /tmp/ipo_ifortQlEAwA.o
ipo: warning #11021: unresolved fftwav_mu_
Referenced in /tmp/ipo_ifortQlEAwA.o
ipo: warning #11021: unresolved fftwav_useinv_mu_
Referenced in /tmp/ipo_ifortQlEAwA.o
ld: /tmp/ipo_ifortQlEAwA2.o: in function `wave_high_mp_fftext_wa_':
ipo_out2.f:(.text.hot00012+0x2d442): undefined reference to `fftext_useinv_mu_'
ld: ipo_out2.f:(.text.hot00012+0x2d597): undefined reference to `fftext_mu_'
ld: /tmp/ipo_ifortQlEAwA2.o: in function `wave_high_mp_fftwav_wa_':
ipo_out2.f:(.text.hot00012+0x2d865): undefined reference to `fftwav_useinv_mu_'
ld: ipo_out2.f:(.text.hot00012+0x2d99f): undefined reference to `fftwav_mu_'
make[2]: *** [makefile:149: vasp] Error 1
make[2]: Leaving directory '/home/mdazharul/vasp/vasp6.2.1/vasp6.2.1/vasp6.2.1/vasp.6.2.1/build/std'
cp: cannot stat 'vasp': No such file or directory
make[1]: *** [makefile:146: all] Error 1
make[1]: Leaving directory '/home/mdazharul/vasp/vasp6.2.1/vasp6.2.1/vasp6.2.1/vasp.6.2.1/build/std'
make: *** [makefile:17: std] Error 2
I am Also including the makefile.include.
>
# Precompiler options
CPP_OPTIONS= -DHOST=\"LinuxIFC\"\
-DCACHE_SIZE=16000 \
-Davoidalloc \
-Duse_bse_te \
-Dtbdyn \
-Dfock_dblbuf
CPP = fpp -f_com=no -free -w0 $*$(FUFFIX) $*$(SUFFIX) $(CPP_OPTIONS)
FC = mpiifort
FCL = mpiifort -qmkl=cluster -lstdc++
FREE = -free -names lowercase
FFLAGS = -assume byterecl -w -xHOST
OFLAG = -O2
OFLAG_IN = $(OFLAG)
DEBUG = -O0
MKL_PATH = $(MKLROOT)/lib/intel64
BLAS =
LAPACK =
BLACS =
SCALAPACK =
OBJECTS = fft3dfurth.o fft3dlib.o
INCS =-I$(MKLROOT)/include/fftw
LLIBS = $(SCALAPACK) $(LAPACK) $(BLAS)
OBJECTS_O1 += fft3dfurth.o fftw3d.o fftmpi.o fftmpiw.o
OBJECTS_O2 += fft3dlib.o
# For what used to be vasp.5.lib
CPP_LIB = $(CPP)
FC_LIB = $(FC)
CC_LIB = icc
CFLAGS_LIB = -O
FFLAGS_LIB = -O1
FREE_LIB = $(FREE)
OBJECTS_LIB= linpack_double.o
# For the parser library
CXX_PARS = icpc
LLIBS += -Lparser -lparser -lstdc++
# Normally no need to change this
SRCDIR = ../../src
BINDIR = ../../bin
I can not seem to locate the problem. Please help me regarding this matter. Thank you.
`
You can try compiling your application using mpiifort instead of doing it with ifort compiler. You are getting the undefined reference to `MPI_Comm_rank errors because your application did not get linked with the MPI libraries. mpiifort compiler uses intel ifort compiler along with MPI wrappers.

Undeclared variable error during gcc 4.9.1 compilation

I've an OpenSUSE OS and want to compile GCC from scratch. I want to compile 4.9.1 version because of the c++11 support. I am following this guide here. I am using gcc version 4.8.3 for compilation. After executing make, I get following errors;
libtool: compile: /mnt/disk2/gccWork-Ozgur/4.9.1-objdir/./gcc/xgcc -shared-libgcc -B/mnt/disk2/gccWork-Ozgur/4.9.1-objdir/./gcc -nostdinc++ -L/mnt/disk2/gccWork-Ozgur/4.9.1-objdir/x86_64-unknown-linux-gnu/libstdc++-v3/src -L/mnt/disk2/gccWork-Ozgur/4.9.1-objdir/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/mnt/disk2/gccWork-Ozgur/4.9.1-objdir/x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs -B/mnt/disk2/gccWork-Ozgur/4.9.1-install/x86_64-unknown-linux-gnu/bin/ -B/mnt/disk2/gccWork-Ozgur/4.9.1-install/x86_64-unknown-linux-gnu/lib/ -isystem /mnt/disk2/gccWork-Ozgur/4.9.1-install/x86_64-unknown-linux-gnu/include -isystem /mnt/disk2/gccWork-Ozgur/4.9.1-install/x86_64-unknown-linux-gnu/sys-include -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I. -I../../../../gcc-4.9.1/libsanitizer/sanitizer_common -I.. -I ../../../../gcc-4.9.1/libsanitizer/include -isystem ../../../../gcc-4.9.1/libsanitizer/include/system -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/x86_64-unknown-linux-gnu -I../../../../gcc-4.9.1/libsanitizer/../libstdc++-v3/libsupc++ -DSANITIZER_LIBBACKTRACE -DSANITIZER_CP_DEMANGLE -I ../../../../gcc-4.9.1/libsanitizer/../libbacktrace -I ../libbacktrace -I ../../../../gcc-4.9.1/libsanitizer/../include -include ../../../../gcc-4.9.1/libsanitizer/libbacktrace/backtrace-rename.h -g -O2 -D_GNU_SOURCE -MT sanitizer_platform_limits_posix.lo -MD -MP -MF .deps/sanitizer_platform_limits_posix.Tpo -c ../../../../gcc-4.9.1/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc -fPIC -DPIC -o .libs/sanitizer_platform_limits_posix.o
../../../../gcc-4.9.1/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:232:27: error: ‘PTRACE_GETSIGINFO’ was not declared in this scope
int ptrace_getsiginfo = PTRACE_GETSIGINFO;
^
../../../../gcc-4.9.1/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:233:27: error: ‘PTRACE_SETSIGINFO’ was not declared in this scope
int ptrace_setsiginfo = PTRACE_SETSIGINFO;
^
../../../../gcc-4.9.1/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:390:30: error: ‘EVIOCGREP’ was not declared in this scope
unsigned IOCTL_EVIOCGREP = EVIOCGREP;
^
../../../../gcc-4.9.1/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:399:30: error: ‘EVIOCSREP’ was not declared in this scope
unsigned IOCTL_EVIOCSREP = EVIOCSREP;
^
../../../../gcc-4.9.1/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:682:36: error: ‘FS_IOC_GETFLAGS’ was not declared in this scope
unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS;
^
../../../../gcc-4.9.1/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:683:38: error: ‘FS_IOC_GETVERSION’ was not declared in this scope
unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION;
^
../../../../gcc-4.9.1/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:684:36: error: ‘FS_IOC_SETFLAGS’ was not declared in this scope
unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS;
^
../../../../gcc-4.9.1/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:685:38: error: ‘FS_IOC_SETVERSION’ was not declared in this scope
unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION;
^
make[4]: *** [sanitizer_platform_limits_posix.lo] Error 1
make[4]: Leaving directory `/mnt/disk2/gccWork-Ozgur/4.9.1-objdir/x86_64-unknown-linux-gnu/libsanitizer/sanitizer_common'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/mnt/disk2/gccWork-Ozgur/4.9.1-objdir/x86_64-unknown-linux-gnu/libsanitizer'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/mnt/disk2/gccWork-Ozgur/4.9.1-objdir/x86_64-unknown-linux-gnu/libsanitizer'
make[1]: *** [all-target-libsanitizer] Error 2
make[1]: Leaving directory `/mnt/disk2/gccWork-Ozgur/4.9.1-objdir'
make: *** [all] Error 2
Any help is appreciated. Thank you

OpenCV 2.4.7 build on MacOS (Maverick + Xcode 5.01 + CUDA 5.5)

I couldn't build opencv with cuda support on Mavericks:
When using cmake -G "Unix Makefiles" -DWITH_CUDA=ON ..
i got error:
-- Configuring incomplete, errors occurred!
Any workaround on this?
(Similar error when using macport too)
CMakeError.log
Determining size of off64_t failed with the following output:
Change Dir: /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp
Run Build Command:/opt/local/bin/gmake "cmTryCompileExec3929617441/fast"
/opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec3929617441.dir/build.make CMakeFiles/cmTryCompileExec3929617441.dir/build
gmake[1]: Entering directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
/opt/local/bin/cmake -E cmake_progress_report /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec3929617441.dir/OFF64_T.c.o
/usr/bin/cc -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG -o CMakeFiles/cmTryCompileExec3929617441.dir/OFF64_T.c.o -c /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:19:12: error: use of undeclared identifier 'off64_t'; did you mean 'off_t'?
('0' + ((SIZE / 10000)%10)),
^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:17:22: note: expanded from macro 'SIZE'
#define SIZE (sizeof(off64_t))
^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:20:12: error: use of undeclared identifier 'off64_t'; did you mean 'off_t'?
('0' + ((SIZE / 1000)%10)),
^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:17:22: note: expanded from macro 'SIZE'
#define SIZE (sizeof(off64_t))
^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:21:12: error: use of undeclared identifier 'off64_t'; did you mean 'off_t'?
('0' + ((SIZE / 100)%10)),
^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:17:22: note: expanded from macro 'SIZE'
#define SIZE (sizeof(off64_t))
^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:22:12: error: use of undeclared identifier 'off64_t'; did you mean 'off_t'?
('0' + ((SIZE / 10)%10)),
^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:17:22: note: expanded from macro 'SIZE'
#define SIZE (sizeof(off64_t))
^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:23:12: error: use of undeclared identifier 'off64_t'; did you mean 'off_t'?
('0' + (SIZE % 10)),
^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:17:22: note: expanded from macro 'SIZE'
#define SIZE (sizeof(off64_t))
^
5 errors generated.
gmake[1]: *** [CMakeFiles/cmTryCompileExec3929617441.dir/OFF64_T.c.o] Error 1
gmake[1]: Leaving directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec3929617441/fast] Error 2
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#endif
#define SIZE (sizeof(off64_t))
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
('0' + ((SIZE / 10000)%10)),
('0' + ((SIZE / 1000)%10)),
('0' + ((SIZE / 100)%10)),
('0' + ((SIZE / 10)%10)),
('0' + (SIZE % 10)),
']',
#ifdef KEY
' ','k','e','y','[', KEY, ']',
#endif
'\0'};
#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
int require = 0;
require += info_size[argc];
(void)argv;
return require;
}
Determining if the include file io.h exists failed with the following output:
Change Dir: /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp
Run Build Command:/opt/local/bin/gmake "cmTryCompileExec647810530/fast"
/opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec647810530.dir/build.make CMakeFiles/cmTryCompileExec647810530.dir/build
gmake[1]: Entering directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
/opt/local/bin/cmake -E cmake_progress_report /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec647810530.dir/CheckIncludeFile.c.o
/usr/bin/cc -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG -o CMakeFiles/cmTryCompileExec647810530.dir/CheckIncludeFile.c.o -c /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'io.h' file not found
#include <io.h>
^
1 error generated.
gmake[1]: *** [CMakeFiles/cmTryCompileExec647810530.dir/CheckIncludeFile.c.o] Error 1
gmake[1]: Leaving directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec647810530/fast] Error 2
Determining if the function jbg_newlen exists failed with the following output:
Change Dir: /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp
Run Build Command:/opt/local/bin/gmake "cmTryCompileExec4172827471/fast"
/opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec4172827471.dir/build.make CMakeFiles/cmTryCompileExec4172827471.dir/build
gmake[1]: Entering directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
/opt/local/bin/cmake -E cmake_progress_report /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec4172827471.dir/CheckFunctionExists.c.o
/usr/bin/cc -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3 -DCHECK_FUNCTION_EXISTS=jbg_newlen -O3 -DNDEBUG -o CMakeFiles/cmTryCompileExec4172827471.dir/CheckFunctionExists.c.o -c /opt/local/share/cmake-2.8/Modules/CheckFunctionExists.c
Linking C executable cmTryCompileExec4172827471
/opt/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec4172827471.dir/link.txt --verbose=1
/usr/bin/cc -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3 -DCHECK_FUNCTION_EXISTS=jbg_newlen -O3 -DNDEBUG -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTryCompileExec4172827471.dir/CheckFunctionExists.c.o -o cmTryCompileExec4172827471
Undefined symbols for architecture x86_64:
"_jbg_newlen", referenced from:
_main in CheckFunctionExists.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[1]: *** [cmTryCompileExec4172827471] Error 1
gmake[1]: Leaving directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec4172827471/fast] Error 2
Determining if the include file linux/videodev.h exists failed with the following output:
Change Dir: /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp
Run Build Command:/opt/local/bin/gmake "cmTryCompileExec70111243/fast"
/opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec70111243.dir/build.make CMakeFiles/cmTryCompileExec70111243.dir/build
gmake[1]: Entering directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
/opt/local/bin/cmake -E cmake_progress_report /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec70111243.dir/CheckIncludeFile.c.o
/usr/bin/cc -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG -o CMakeFiles/cmTryCompileExec70111243.dir/CheckIncludeFile.c.o -c /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'linux/videodev.h' file not found
#include <linux/videodev.h>
^
1 error generated.
gmake[1]: *** [CMakeFiles/cmTryCompileExec70111243.dir/CheckIncludeFile.c.o] Error 1
gmake[1]: Leaving directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec70111243/fast] Error 2
Determining if the include file linux/videodev2.h exists failed with the following output:
Change Dir: /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp
Run Build Command:/opt/local/bin/gmake "cmTryCompileExec661389614/fast"
/opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec661389614.dir/build.make CMakeFiles/cmTryCompileExec661389614.dir/build
gmake[1]: Entering directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
/opt/local/bin/cmake -E cmake_progress_report /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec661389614.dir/CheckIncludeFile.c.o
/usr/bin/cc -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG -o CMakeFiles/cmTryCompileExec661389614.dir/CheckIncludeFile.c.o -c /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'linux/videodev2.h' file not found
#include <linux/videodev2.h>
^
1 error generated.
gmake[1]: *** [CMakeFiles/cmTryCompileExec661389614.dir/CheckIncludeFile.c.o] Error 1
gmake[1]: Leaving directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec661389614/fast] Error 2
Determining if the include file sys/videoio.h exists failed with the following output:
Change Dir: /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp
Run Build Command:/opt/local/bin/gmake "cmTryCompileExec741892054/fast"
/opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec741892054.dir/build.make CMakeFiles/cmTryCompileExec741892054.dir/build
gmake[1]: Entering directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
/opt/local/bin/cmake -E cmake_progress_report /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec741892054.dir/CheckIncludeFile.c.o
/usr/bin/cc -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG -o CMakeFiles/cmTryCompileExec741892054.dir/CheckIncludeFile.c.o -c /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'sys/videoio.h' file not found
#include <sys/videoio.h>
^
1 error generated.
gmake[1]: *** [CMakeFiles/cmTryCompileExec741892054.dir/CheckIncludeFile.c.o] Error 1
gmake[1]: Leaving directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec741892054/fast] Error 2
Determining if the include file libavformat/avformat.h exists failed with the following output:
Change Dir: /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp
Run Build Command:/opt/local/bin/gmake "cmTryCompileExec2161613468/fast"
/opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec2161613468.dir/build.make CMakeFiles/cmTryCompileExec2161613468.dir/build
gmake[1]: Entering directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
/opt/local/bin/cmake -E cmake_progress_report /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec2161613468.dir/CheckIncludeFile.c.o
/usr/bin/cc -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG -o CMakeFiles/cmTryCompileExec2161613468.dir/CheckIncludeFile.c.o -c /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'libavformat/avformat.h' file not found
#include <libavformat/avformat.h>
^
1 error generated.
gmake[1]: *** [CMakeFiles/cmTryCompileExec2161613468.dir/CheckIncludeFile.c.o] Error 1
gmake[1]: Leaving directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec2161613468/fast] Error 2
Determining if the include file ffmpeg/avformat.h exists failed with the following output:
Change Dir: /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp
Run Build Command:/opt/local/bin/gmake "cmTryCompileExec188285781/fast"
/opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec188285781.dir/build.make CMakeFiles/cmTryCompileExec188285781.dir/build
gmake[1]: Entering directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
/opt/local/bin/cmake -E cmake_progress_report /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec188285781.dir/CheckIncludeFile.c.o
/usr/bin/cc -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG -o CMakeFiles/cmTryCompileExec188285781.dir/CheckIncludeFile.c.o -c /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'ffmpeg/avformat.h' file not found
#include <ffmpeg/avformat.h>
^
1 error generated.
gmake[1]: *** [CMakeFiles/cmTryCompileExec188285781.dir/CheckIncludeFile.c.o] Error 1
gmake[1]: Leaving directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec188285781/fast] Error 2
Here's how I compiled OpenCV 2.4.8 on OSX Mavericks 10.9.1 using Xcode 5.0.2 and CUDA 5.5:
open CMake to set the project, and to the basic configuration
in latest Xcode (I think >= 5) there's no more the gcc compiler, deprecated in favor of clang, so go to the CUDA options of the CMAKE project and change CUDA_HOST_COMPILER to use "/usr/bin/clang". Luckily CUDA 5.5 supports clang and not only gcc
Apparently CUDA 5.5 supports only the older libstdc++ library and not the more modern libc++, so update CUDA_NVCC_FLAGS to tell mvcc to pass tell the nativa compilar to use this older library. Add "-Xcompiler -stdlib=libstdc++; -Xlinker -stdlib=libstdc++"
Tell also the C++ compiler that compiles the rest of the library to use libstdc++: show the advanced options of CMAKE and go to CMAKE to add "-stdlib=libstdc++" to both CMAKE_CXX_FLAGS and CMAKE_EXE_LINKER_FLAGS
For anyone coming here later who may be trying to install from this tutorial. I ran into this problem because my OPENCV_EXTRA_MODULES_PATH was pointing to the wrong directory. I had mine in ~/src/, and not just ~/

Undefined reference when compiling OpenSSL

I'm not sure what to do here, I ran make and got this:
make[2]: Entering directory `/tmp/openssl-1.0.1/test'
( :; LIBDEPS="${LIBDEPS:--L.. -lssl -L.. -lcrypto -ldl}"; LDCMD="${LDCMD:-gcc}"; LDFLAGS="${LDFLAGS:--DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -fno-exceptions -Wa,--noexecstack -m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM}"; LIBPATH=`for x in $LIBDEPS; do echo $x; done | sed -e 's/^ *-L//;t' -e d | uniq`; LIBPATH=`echo $LIBPATH | sed -e 's/ /:/g'`; LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH ${LDCMD} ${LDFLAGS} -o ${APPNAME:=rc4test} rc4test.o ${LIBDEPS} )
rc4test.o: In function `main':
rc4test.c:(.text+0x30): undefined reference to `OPENSSL_cpuid_setup'
collect2: ld returned 1 exit status
make[2]: *** [link_app.] Error 1
make[2]: Leaving directory `/tmp/openssl-1.0.1/test'
make[1]: *** [rc4test] Error 2
make[1]: Leaving directory `/tmp/openssl-1.0.1/test'
make: *** [build_tests] Error 1
I think this is a gcc thing, but I am not sure how to approach this. Should I be compiling this manually?
I ran into the same problem, and was able to solve it by passing adding -DOPENSSL_PIC to the config call:
./config -fPIC -DOPENSSL_PIC

Resources