I'm trying to compile a Mex file from within Matlab R2014b using g++4.8 on OSX, with my own mexopts.sh. The relevant options are:
-> CXX = g++
-> CXX flags:
CXXFLAGS = -ansi -D_GNU_SOURCE -std=c++0x -arch x86_64 -mmacosx-version-min=10.10 -fPIC -fno-omit-frame-pointer -pthread
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O2 -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/path/to/MATLAB_R2014b.app/bin/maci64 -L/path/to/MATLAB_R2014b.app/bin/maci64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
The compiling command issued by Mex is:
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
-> g++ -c -I/path/to/MATLAB_R2014b.app/extern/include -I/path/to/MATLAB_R2014b.app/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -std=c++0x -arch x86_64 -mmacosx-version-min=10.10 -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_32 -O2 -DNDEBUG "/path/to/myfile.cpp" -o /path/to/myfile.o
My problem is in the first line Configured with: ..., I would like to change --prefix and --with-gxx-include-dir to the same values as GCC:
sheljohn#computer$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin14/4.8.3/lto-wrapper
Target: x86_64-apple-darwin14
Configured with: /opt/local/var/macports/build/_opt_mports_dports_lang_gcc48/gcc48/work/gcc-4.8.3/configure --prefix=/opt/local --build=x86_64-apple-darwin14 --enable-languages=c,c++,objc,obj-c++,lto,fortran,java --libdir=/opt/local/lib/gcc48 --includedir=/opt/local/include/gcc48 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.8 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.8 --with-gxx-include-dir=/opt/local/include/gcc48/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-isl=/opt/local --disable-isl-version-check --with-cloog=/opt/local --disable-cloog-version-check --enable-stage1-checking --disable-multilib --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --with-pkgversion='MacPorts gcc48 4.8.3_3'
Thread model: posix
gcc version 4.8.3 (MacPorts gcc48 4.8.3_3)
Is there a way to change these options?
Related
im trying to compile c++ code on Mac (Monterey) using cross-compilation (to Raspberry Pi 1) using this CMake and following compiler:
arm-unknown-linux-gnueabihf
from:
https://thinkski.github.io/osx-arm-linux-toolchains/
here is CMake toolchain setup:
SET(CMAKE_SYSTEM_NAME Darwin)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER /Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gcc) #
SET(CMAKE_CXX_COMPILER /Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-g++ )
set(CMAKE_VERBOSE_MAKEFILE TRUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv6zk -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -v -std=c++14 ")
set(CMAKE_AR /Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-ar )
set(CMAKE_RANLIB /Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-ranlib )
SET(CMAKE_OSX_SYSROOT /Users/dro/Development/arm/rpisysroot/rpisysroot/)# /Users/dro/Development/arm/arm-unknown-linux-gnueabihf/arm-unknown-linux-gnueabihf/sysroot/usr/include/")
SET(CMAKE_FIND_ROOT_PATH /Users/dro/Development/arm/rpisysroot/rpisysroot/)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
add_definitions(-Wall)
after i run:
cmake -D CMAKE_TOOLCHAIN_FILE=/Users/dro/Development/arm/code/toolchainpihf.cmake ../
and then
make
i got following error (during linking):
[ 75%] Linking CXX executable CMakeHelloWorld
/Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/CMakeHelloWorld.dir/link.txt --verbose=1
/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-g++ -march=armv6zk -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -v -std=c++14 -isysroot /Users/dro/Development/arm/rpisysroot/rpisysroot/ -Wl,-headerpad_max_install_names --specs=nosys.specs CMakeFiles/CMakeHelloWorld.dir/HelloWorld.cpp.o -o CMakeHelloWorld Hello/libHello.a
Using built-in specs.
Reading specs from nosys.specs
arm-unknown-linux-gnueabihf-g++: error: nosys.specs: No such file or directory
when i manually type what is above, but without flag --specs=nosys.specsevertyhing works smooth:
dro#build build% /Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-g++ -march=armv6zk -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -v -std=c++14 -isysroot /Users/dro/Development/arm/rpisysroot/rpisysroot/ -Wl,-headerpad_max_install_names CMakeFiles/CMakeHelloWorld.dir/HelloWorld.cpp.o -o CMakeHelloWorld Hello/libHello.a
output:
Using built-in specs.
COLLECT_GCC=/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-g++
COLLECT_LTO_WRAPPER=/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../libexec/gcc/arm-unknown-linux-gnueabihf/8.3.0/lto-wrapper
Target: arm-unknown-linux-gnueabihf
Configured with: /Volumes/xtool-build-env/.build/arm-unknown-linux-gnueabihf/src/gcc/configure --build=x86_64-build_apple-darwin18.7.0 --host=x86_64-build_apple-darwin18.7.0 --target=arm-unknown-linux-gnueabihf --prefix=/Volumes/xtool-build-env/arm-unknown-linux-gnueabihf --with-sysroot=/Volumes/xtool-build-env/arm-unknown-linux-gnueabihf/arm-unknown-linux-gnueabihf/sysroot --enable-languages=c,c++ --with-cpu=cortex-a9 --with-fpu=neon-vfpv4 --with-float=hard --with-pkgversion='crosstool-NG 1.24.0' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --disable-libmpx --with-gmp=/Volumes/xtool-build-env/.build/arm-unknown-linux-gnueabihf/buildtools --with-mpfr=/Volumes/xtool-build-env/.build/arm-unknown-linux-gnueabihf/buildtools --with-mpc=/Volumes/xtool-build-env/.build/arm-unknown-linux-gnueabihf/buildtools --with-isl=/Volumes/xtool-build-env/.build/arm-unknown-linux-gnueabihf/buildtools --enable-lto --enable-threads=posix --enable-target-optspace --enable-plugin --enable-gold --disable-nls --disable-multilib --with-local-prefix=/Volumes/xtool-build-env/arm-unknown-linux-gnueabihf/arm-unknown-linux-gnueabihf/sysroot --enable-long-long
Thread model: posix
gcc version 8.3.0 (crosstool-NG 1.24.0)
COMPILER_PATH=/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../libexec/gcc/arm-unknown-linux-gnueabihf/8.3.0/:/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../libexec/gcc/:/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/8.3.0/../../../../arm-unknown-linux-gnueabihf/bin/
LIBRARY_PATH=/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/8.3.0/:/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../lib/gcc/:/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/8.3.0/../../../../arm-unknown-linux-gnueabihf/lib/:/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../arm-unknown-linux-gnueabihf/sysroot/lib/:/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../arm-unknown-linux-gnueabihf/sysroot/usr/lib/
COLLECT_GCC_OPTIONS= '-mcpu=arm1176jzf-s' '-mfpu=vfp' '-mfloat-abi=hard' '-v' '-std=c++14' '-isysroot' '/Users/dro/Development/arm/rpisysroot/rpisysroot/' '-o' 'CMakeHelloWorld' '-shared-libgcc' '-mtls-dialect=gnu' '-marm' '-march=armv6zk+fp'
/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../libexec/gcc/arm-unknown-linux-gnueabihf/8.3.0/collect2 -plugin /Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../libexec/gcc/arm-unknown-linux-gnueabihf/8.3.0/liblto_plugin.so -plugin-opt=/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../libexec/gcc/arm-unknown-linux-gnueabihf/8.3.0/lto-wrapper -plugin-opt=-fresolution=/var/folders/s0/bp0mmft901q26dz9_qq44vdr0000gn/T//cczSMnXT.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../arm-unknown-linux-gnueabihf/sysroot --eh-frame-hdr -dynamic-linker /lib/ld-linux-armhf.so.3 -X -m armelf_linux_eabi -o CMakeHelloWorld /Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../arm-unknown-linux-gnueabihf/sysroot/usr/lib/crt1.o /Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../arm-unknown-linux-gnueabihf/sysroot/usr/lib/crti.o /Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/8.3.0/crtbegin.o -L/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/8.3.0 -L/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../lib/gcc -L/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/8.3.0/../../../../arm-unknown-linux-gnueabihf/lib -L/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../arm-unknown-linux-gnueabihf/sysroot/lib -L/Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../arm-unknown-linux-gnueabihf/sysroot/usr/lib -headerpad_max_install_names CMakeFiles/CMakeHelloWorld.dir/HelloWorld.cpp.o Hello/libHello.a -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/8.3.0/crtend.o /Users/dro/Development/arm/arm-unknown-linux-gnueabihf/bin/../arm-unknown-linux-gnueabihf/sysroot/usr/lib/crtn.o
COLLECT_GCC_OPTIONS= '-mcpu=arm1176jzf-s' '-mfpu=vfp' '-mfloat-abi=hard' '-v' '-std=c++14' '-isysroot' '/Users/dro/Development/arm/rpisysroot/rpisysroot/' '-o' 'CMakeHelloWorld' '-shared-libgcc' '-mtls-dialect=gnu' '-marm' '-march=armv6zk+fp'
and executable is created:
dro#build build% file CMakeHelloWorld
CMakeHelloWorld: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 4.20.8, with debug_info, not stripped
Question: seems that this complier does not support flag --specs, is it possible in CMake to remove this flag from settings? I think it is added by default..
TL;DR
How to build MPICH with gfortran-10, gcc-10 and g++-10?
Background
I want to build MPICH with grortran-10 so as to be able to use up to date MPI bindings, but I haven't managed to do so. Trying to install MPICH via apt on Ubuntu always uses gfortran 7.5.0 (same version with gcc and g++), even if I have latest version of gfortran installed. Just for clarity, here is my current MPICH and gfortran configuration (installed via apt) :
pavel#pavel:~$ mpiexec --version
HYDRA build details:
Version: 3.3a2
Release Date: Sun Nov 13 09:12:11 MST 2016
CC: gcc -Wl,-Bsymbolic-functions -Wl,-z,relro
CXX: g++ -Wl,-Bsymbolic-functions -Wl,-z,relro
F77: gfortran -Wl,-Bsymbolic-functions -Wl,-z,relro
F90: gfortran -Wl,-Bsymbolic-functions -Wl,-z,relro
Configure options: '--disable-option-checking' '--prefix=/usr' '--build=x86_64-linux-gnu' '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--disable-silent-rules' '--libdir=${prefix}/lib/x86_64-linux-gnu' '--libexecdir=${prefix}/lib/x86_64-linux-gnu' '--disable-maintainer-mode' '--disable-dependency-tracking' '--with-libfabric' '--enable-shared' '--enable-fortran=all' '--disable-rpath' '--disable-wrapper-rpath' '--sysconfdir=/etc/mpich' '--libdir=/usr/lib/x86_64-linux-gnu' '--includedir=/usr/include/mpich' '--docdir=/usr/share/doc/mpich' '--with-hwloc-prefix=system' '--enable-checkpointing' '--with-hydra-ckpointlib=blcr' 'CPPFLAGS= -Wdate-time -D_FORTIFY_SOURCE=2 -I/build/mpich-O9at2o/mpich-3.3~a2/src/mpl/include -I/build/mpich-O9at2o/mpich-3.3~a2/src/mpl/include -I/build/mpich-O9at2o/mpich-3.3~a2/src/openpa/src -I/build/mpich-O9at2o/mpich-3.3~a2/src/openpa/src -D_REENTRANT -I/build/mpich-O9at2o/mpich-3.3~a2/src/mpi/romio/include' 'CFLAGS= -g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -Wformat -Werror=format-security -O2' 'CXXFLAGS= -g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -Wformat -Werror=format-security -O2' 'FFLAGS= -g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -O2' 'FCFLAGS= -g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -O2' 'build_alias=x86_64-linux-gnu' 'MPICHLIB_CFLAGS=-g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -Wformat -Werror=format-security' 'MPICHLIB_CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'MPICHLIB_CXXFLAGS=-g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -Wformat -Werror=format-security' 'MPICHLIB_FFLAGS=-g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong' 'MPICHLIB_FCFLAGS=-g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro' 'FC=gfortran' 'F77=gfortran' 'MPILIBNAME=mpich' '--cache-file=/dev/null' '--srcdir=.' 'CC=gcc' 'LIBS=' 'MPLLIBNAME=mpl'
Process Manager: pmi
Launchers available: ssh rsh fork slurm ll lsf sge manual persist
Topology libraries available: hwloc
Resource management kernels available: user slurm ll lsf sge pbs cobalt
Checkpointing libraries available: blcr
Demux engines available: poll select
pavel#pavel:~$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
With gcc and g++, it's the same as with gfortran in all relevant aspects.
I followed advice VladimirF gave me in the comments, and everthing worked out. This site provided all the necessary guidelines. Only a few minor problems had to be dealth with. Before I could create ./configure file, I was prompted to install some missing autotools, which was simply done using apt. Once ./configure file was ready, I passed in the mostly same configuration that apt originally installed MPICH with (see the long list original question), with 'FC = gfortran-10' 'CC = gcc-10' 'CXX = g++-10' replacing 'FC = gfortran' 'CC = gcc' 'CXX = g++'. Several more prompts had to be dealt with (mostly adding something to configuration or installing missing packages, easily done with Synaptic package manager). After doing all the steps, F08 bindings were succesfully built and work properly. Here is my current MPICH configuration :
pavel#pavel:$ mpiexec --version
HYDRA build details:
Version: 3.4b1
Release Date: unreleased development copy
CC: gcc-10 -Wdate-time -D_FORTIFY_SOURCE=2 -I/build/mpich-O9at2o/mpich-3.3~a2/src/mpl/include -I/build/mpich-O9at2o/mpich-3.3~a2/src/mpl/include -I/build/mpich-O9at2o/mpich-3.3~a2/src/openpa/src -I/build/mpich-O9at2o/mpich-3.3~a2/src/openpa/src -D_REENTRANT -I/build/mpich-O9at2o/mpich-3.3~a2/src/mpi/romio/include -g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -Wformat -Werror=format-security -O2 -Wl,-Bsymbolic-functions -Wl,-z,relro
Configure options: '--disable-option-checking' '--prefix=/usr' '--build=x86_64-linux-gnu' '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--disable-silent-rules' '--libdir=${prefix}/lib/x86_64-linux-gnu' '--libexecdir=${prefix}/lib/x86_64-linux-gnu' '--disable-maintainer-mode' '--disable-dependency-tracking' '--with-libfabric' '--enable-shared' '--enable-fortran=all' '--disable-rpath' '--disable-wrapper-rpath' '--sysconfdir=/etc/mpich' '--libdir=/usr/lib/x86_64-linux-gnu' '--includedir=/usr/include/mpich' '--docdir=/usr/share/doc/mpich' '--with-hwloc-prefix=system' '--enable-checkpointing' '--with-hydra-ckpointlib=blcr' 'CPPFLAGS= -Wdate-time -D_FORTIFY_SOURCE=2 -I/build/mpich-O9at2o/mpich-3.3~a2/src/mpl/include -I/build/mpich-O9at2o/mpich-3.3~a2/src/mpl/include -I/build/mpich-O9at2o/mpich-3.3~a2/src/openpa/src -I/build/mpich-O9at2o/mpich-3.3~a2/src/openpa/src -D_REENTRANT -I/build/mpich-O9at2o/mpich-3.3~a2/src/mpi/romio/include -Wdate-time -D_FORTIFY_SOURCE=2 -I/home/pavel/mpich/src/mpl/include -I/home/pavel/mpich/src/mpl/include -I/home/pavel/mpich/modules/json-c -I/home/pavel/mpich/modules/json-c -D_REENTRANT -I/home/pavel/mpich/src/mpi/romio/include' 'CFLAGS= -g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -Wformat -Werror=format-security -O2 -g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -Wformat -Werror=format-security -O2' 'CXXFLAGS= -g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -Wformat -Werror=format-security -O2 -g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -Wformat -Werror=format-security -O2' 'FFLAGS= -g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -fallow-argument-mismatch -O2 -g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -O2' 'FCFLAGS= -g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -O2 -g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -O2' 'build_alias=x86_64-linux-gnu' 'MPICHLIB_CFLAGS=-g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -Wformat -Werror=format-security' 'MPICHLIB_CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'MPICHLIB_CXXFLAGS=-g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -Wformat -Werror=format-security' 'MPICHLIB_FFLAGS=-g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong' 'MPICHLIB_FCFLAGS=-g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro' 'FC=gfortran-10' 'F77=gfortran-10' 'MPILIBNAME=mpich' 'CC=gcc-10' 'LIBS=' 'MPLLIBNAME=mpl' 'CXX=g++-10' '--with-device=ch3' '--cache-file=/dev/null' '--srcdir=.'
Process Manager: pmi
Launchers available: ssh rsh fork slurm ll lsf sge manual persist
Topology libraries available:
Resource management kernels available: user slurm ll lsf sge pbs cobalt
Demux engines available: poll select
Based on several postings in stackoverflow, in OSX 10.15, I can suppress warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] from conftest.c by clang -Wno-nullability-completeness -o conftest -g -O2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include conftest.c or gcc -Wno-nullability-completeness conftest.c. But how can I implement this for compiling a whole R pacakge from the source ? I added -Wno-nullability-completeness in R Makevers like this :
CC=clang -Wno-nullability-completeness
CXX=clang++ -Wno-nullability-completeness
CFLAGS=-Wno-nullability-completeness -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe
CXXFLAGS=-Wno-nullability-completeness -g -O3 -Wall -pedantic -std=c++11 -mtune=native
LDFLAGS=-L/usr/local/opt/gettext/lib -L$(LLVM_LOC)/lib -Wl,-rpath,$(LLVM_LOC)/lib
CPPFLAGS=-I/usr/local/opt/gettext/include -I$(LLVM_LOC)/include
but it did not work. Any suggestions or pointers will be seriously appreciated.
My system;
sw_vers
ProductName: Mac OS X
ProductVersion: 10.15.2
BuildVersion: 19C57
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/9.2.0_2/libexec/gcc/x86_64-apple-darwin19/9.2.0/lto-wrapper
Target: x86_64-apple-darwin19
Configured with: ../configure --build=x86_64-apple-darwin19 --prefix=/usr/local/Cellar/gcc/9.2.0_2 --libdir=/usr/local/Cellar/gcc/9.2.0_2/lib/gcc/9 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-9 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew GCC 9.2.0_2' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
Thread model: posix
gcc version 9.2.0 (Homebrew GCC 9.2.0_2)
clang -v
clang version 9.0.0 (tags/RELEASE_900/final)
Target: x86_64-apple-darwin19.2.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
brew info R
R: stable 3.6.2 (bottled)
Software environment for statistical computing
https://www.r-project.org/
/usr/local/Cellar/R/3.6.2 (2,123 files, 58.5MB)
Poured from bottle on 2019-12-14 at 09:37:12
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/r.rb
==> Dependencies
Build: pkg-config ✔
Required: gcc ✔, gettext ✔, jpeg ✔, libpng ✔, openblas ✔, pcre ✔, readline ✔, xz ✔
Flags:
CPATH=/usr/local/include
LDFLAGS=-L/usr/local/opt/llvm/lib
CPPFLAGS=-I/usr/local/opt/llvm/include
SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
Edit 1
From a suggestion by Ralf Stubner, I looked at an installer output generated by install.package("e1071", keep_outputs=T) ;
All my packages loaded Tue Dec 31 16:23:24 2019* installing *source* package ‘e1071’ ...
** package ‘e1071’ successfully unpacked and MD5 sums checked
** using staged installation
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether clang++ -std=gnu++11 accepts -g... yes
** libs
clang -I"/usr/local/Cellar/r/3.6.2/lib/R/include" -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include **-fPIC -g -O2** -c Rsvm.c -o Rsvm.o
In file included from Rsvm.c:2:
/usr/local/include/stdio.h:67:13: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
extern FILE *__stdinp ........;
and I realized that CXXFLAGs in my Makevars may not be read by clang at all. A following is my current Makevars;
LLVM_LOC = /usr/local/opt/llvm
CC=clang
CXX=clang++
CXX11=clang++
CFLAGS = -g -O3 -Wall -pipe -pedantic -Wno-nonnull -std=gnu99 -mtune=native
CXXFLAGS = -g -O3 -Wall -pipe -Wno-nonnull -pedantic -std=c++11 -mtune=native
CXX11FLAGS = -g -O3 -Wall -pipe -Wno-nonnull -pedantic -std=c++11 -mtune=native
LDFLAGS=-L/usr/local/opt/gettext/lib -L$(LLVM_LOC)/lib -Wl,-rpath,$(LLVM_LOC)/lib
CPPFLAGS=-I/usr/local/opt/gettext/include -I$(LLVM_LOC)/include
Ok I figured this out. Thanks to the help from RalfStubner. I realized that I was not putting Makevars in the right location. A default location of Makevars should be ~/.R/Makevars. Now, CXXFLAGS in the Makevars is read and -Wno-nonnull is applied. My latest Makevars is as follows;
LLVM_LOC = /usr/local/opt/llvm
CC=$(LLVM_LOC)/bin/clang -fopenmp
CXX=$(LLVM_LOC)/bin/clang++ -fopenmp
CC=clang
CXX=clang++
CXX11=clang++
CFLAGS = -g -O3 -Wall -pipe -pedantic -Wno-nonnull -std=gnu99 -mtune=native -pipe
CXXFLAGS = -g -O3 -Wall -pipe -Wno-nonnull -pedantic -std=c++11 -mtune=native
CXX11FLAGS = -g -O3 -Wall -pipe -Wno-nonnull -pedantic -std=c++11 -mtune=native
LDFLAGS=-L/usr/local/opt/gettext/lib -L$(LLVM_LOC)/lib -Wl,-rpath,$(LLVM_LOC)/lib
CPPFLAGS=-I/usr/local/opt/gettext/include -I$(LLVM_LOC)/include
I managed it to get a working blink template with libopencm3 for the STM32F051 (# stmf0discovory). Then I wanted to get a working one for my Maple Mini (with STM32F103 = cortex-m3) so I copied the first one and changed the cpu flag from cortex-m0-plus to cortex-m3, the library from opencm3_stm32f0 to opencm3_stm32f1 and so on...
But as you can guess its not compiling. From the compilation log it seems like the compiler is not invoking the linker and thats why its not finding the gpio_mode_setup function and definistions like GPIO_MODE_OUTPUT. Here are the Eclipse console outputs:
str32f0 - working:
19:07:01 **** Incremental Build of configuration Debug for project Template ****
make all
'Building file: ../Source/main.c'
'Invoking: Cross ARM C Compiler'
arm-none-eabi-gcc -mcpu=cortex-m0plus -mthumb -mlittle-endian -Og -fmessage-length=0 -ffunction-sections -fdata-sections -fno-common -msoft-float -pedantic -Wall -Wextra -Wmissing-declarations -Wshadow -g3 -ggdb -DSTM32F0 -I"C:\ARM-GNU-Toolchain\libopencm3\include" -I"C:/Users/Lenny/Documents/Eclipse/stm32f0-libopencm3/Template/Include" -std=gnu11 -Wmissing-prototypes -Wstrict-prototypes -Wimplicit-function-declaration -Wredundant-decls -Wa,-adhlns="Source/main.o.lst" -v -MMD -MP -MF"Source/main.d" -MT"Source/main.o" -c -o "Source/main.o" "../Source/main.c"
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
Target: arm-none-eabi
Configured with: /home/build/work/GCC-4-9-build/src/gcc/configure --build=i686-linux-gnu --host=i686-w64-mingw32 --target=arm-none-eabi --prefix=/home/build/work/GCC-4-9-build/install-mingw --libexecdir=/home/build/work/GCC-4-9-build/install-mingw/lib --infodir=/home/build/work/GCC-4-9-build/install-mingw/share/doc/gcc-arm-none-eabi/info --mandir=/home/build/work/GCC-4-9-build/install-mingw/share/doc/gcc-arm-none-eabi/man --htmldir=/home/build/work/GCC-4-9-build/install-mingw/share/doc/gcc-arm-none-eabi/html --pdfdir=/home/build/work/GCC-4-9-build/install-mingw/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-headers=yes --with-newlib --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/home/build/work/GCC-4-9-build/install-mingw/arm-none-eabi --with-libiconv-prefix=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-gmp=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-mpfr=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-mpc=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-isl=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-cloog=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-libelf=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Tools for ARM Embedded Processors' --with-multilib-list=armv6-m,armv7-m,armv7e-m,cortex-m7,armv7-r
Thread model: single
gcc version 4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 224288] (GNU Tools for ARM Embedded Processors)
COLLECT_GCC_OPTIONS='-mcpu=cortex-m0plus' '-mthumb' '-mlittle-endian' '-Og' '-fmessage-length=0' '-ffunction-sections' '-fdata-sections' '-fno-common' '-mfloat-abi=soft' '-Wpedantic' '-Wall' '-Wextra' '-Wmissing-declarations' '-Wshadow' '-g3' '-ggdb' '-D' 'STM32F0' '-I' 'C:\ARM-GNU-Toolchain\libopencm3\include' '-I' 'C:/Users/Lenny/Documents/Eclipse/stm32f0-libopencm3/Template/Include' '-std=gnu11' '-Wmissing-prototypes' '-Wstrict-prototypes' '-Wimplicit-function-declaration' '-Wredundant-decls' '-v' '-MMD' '-MP' '-MF' 'Source/main.d' '-MT' 'Source/main.o' '-c' '-o' 'Source/main.o'
c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/cc1.exe -quiet -v -I C:\ARM-GNU-Toolchain\libopencm3\include -I C:/Users/Lenny/Documents/Eclipse/stm32f0-libopencm3/Template/Include -imultilib armv6-m -iprefix c:\arm-gnu-toolchain\gcc-arm-none-eabi-4_9-2015q2-20150609-win32\bin\../lib/gcc/arm-none-eabi/4.9.3/ -isysroot c:\arm-gnu-toolchain\gcc-arm-none-eabi-4_9-2015q2-20150609-win32\bin\../arm-none-eabi -MMD Source/main.d -MF Source/main.d -MP -MT Source/main.o -dD -D__USES_INITFINI__ -D STM32F0 ../Source/main.c -quiet -dumpbase main.c -mcpu=cortex-m0plus -mthumb -mlittle-endian -mfloat-abi=soft -auxbase-strip Source/main.o -g3 -ggdb -Og -Wpedantic -Wall -Wextra -Wmissing-declarations -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wimplicit-function-declaration -Wredundant-decls -std=gnu11 -version -fmessage-length=0 -ffunction-sections -fdata-sections -fno-common -o C:\Users\Lenny\AppData\Local\Temp\ccN3qnLh.s
GNU C (GNU Tools for ARM Embedded Processors) version 4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 224288] (arm-none-eabi)
compiled by GNU C version 4.7.4, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/lib/gcc/../../lib/gcc/arm-none-eabi/4.9.3/include"
ignoring nonexistent directory "c:\arm-gnu-toolchain\gcc-arm-none-eabi-4_9-2015q2-20150609-win32\bin\../arm-none-eabi/home/build/work/GCC-4-9-build/install-mingw/lib/gcc/arm-none-eabi/4.9.3/../../../../include"
ignoring duplicate directory "c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/lib/gcc/../../lib/gcc/arm-none-eabi/4.9.3/include-fixed"
ignoring duplicate directory "c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/lib/gcc/../../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/include"
ignoring nonexistent directory "c:\arm-gnu-toolchain\gcc-arm-none-eabi-4_9-2015q2-20150609-win32\bin\../arm-none-eabi/usr/include"
#include "..." search starts here:
#include <...> search starts here:
C:\ARM-GNU-Toolchain\libopencm3\include
C:/Users/Lenny/Documents/Eclipse/stm32f0-libopencm3/Template/Include
c:\arm-gnu-toolchain\gcc-arm-none-eabi-4_9-2015q2-20150609-win32\bin\../lib/gcc/arm-none-eabi/4.9.3/include
c:\arm-gnu-toolchain\gcc-arm-none-eabi-4_9-2015q2-20150609-win32\bin\../lib/gcc/arm-none-eabi/4.9.3/include-fixed
c:\arm-gnu-toolchain\gcc-arm-none-eabi-4_9-2015q2-20150609-win32\bin\../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/include
End of search list.
GNU C (GNU Tools for ARM Embedded Processors) version 4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 224288] (arm-none-eabi)
compiled by GNU C version 4.7.4, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 9d74dec9c13b63cc54577fa808c91d66
COLLECT_GCC_OPTIONS='-mcpu=cortex-m0plus' '-mthumb' '-mlittle-endian' '-Og' '-fmessage-length=0' '-ffunction-sections' '-fdata-sections' '-fno-common' '-mfloat-abi=soft' '-Wpedantic' '-Wall' '-Wextra' '-Wmissing-declarations' '-Wshadow' '-g3' '-ggdb' '-D' 'STM32F0' '-I' 'C:\ARM-GNU-Toolchain\libopencm3\include' '-I' 'C:/Users/Lenny/Documents/Eclipse/stm32f0-libopencm3/Template/Include' '-std=gnu11' '-Wmissing-prototypes' '-Wstrict-prototypes' '-Wimplicit-function-declaration' '-Wredundant-decls' '-v' '-MMD' '-MP' '-MF' 'Source/main.d' '-MT' 'Source/main.o' '-c' '-o' 'Source/main.o'
c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/as.exe -v -I C:\ARM-GNU-Toolchain\libopencm3\include -I C:/Users/Lenny/Documents/Eclipse/stm32f0-libopencm3/Template/Include -EL -mcpu=cortex-m0plus -mfloat-abi=soft -meabi=5 -adhlns=Source/main.o.lst -o Source/main.o C:\Users\Lenny\AppData\Local\Temp\ccN3qnLh.s
GNU assembler version 2.24.0 (arm-none-eabi) using BFD version (GNU Tools for ARM Embedded Processors) 2.24.0.20150604
COMPILER_PATH=c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/;c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/;c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/
LIBRARY_PATH=c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/armv6-m/;c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv6-m/;c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../arm-none-eabi/lib/armv6-m/;c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/;c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/;c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/;c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-mcpu=cortex-m0plus' '-mthumb' '-mlittle-endian' '-Og' '-fmessage-length=0' '-ffunction-sections' '-fdata-sections' '-fno-common' '-mfloat-abi=soft' '-Wpedantic' '-Wall' '-Wextra' '-Wmissing-declarations' '-Wshadow' '-g3' '-ggdb' '-D' 'STM32F0' '-I' 'C:\ARM-GNU-Toolchain\libopencm3\include' '-I' 'C:/Users/Lenny/Documents/Eclipse/stm32f0-libopencm3/Template/Include' '-std=gnu11' '-Wmissing-prototypes' '-Wstrict-prototypes' '-Wimplicit-function-declaration' '-Wredundant-decls' '-v' '-MMD' '-MP' '-MF' 'Source/main.d' '-MT' 'Source/main.o' '-c' '-o' 'Source/main.o'
'Finished building: ../Source/main.c'
' '
'Building target: Template.elf'
'Invoking: Cross ARM C Linker'
arm-none-eabi-gcc -mcpu=cortex-m0plus -mthumb -mlittle-endian -Og -fmessage-length=0 -ffunction-sections -fdata-sections -fno-common -msoft-float -pedantic -Wall -Wextra -Wmissing-declarations -Wshadow -g3 -ggdb -T "C:/Users/Lenny/Documents/Eclipse/stm32f0-libopencm3/Template\Misc\stm32f0-discovery.ld" -nostartfiles -Xlinker --gc-sections -L"C:\ARM-GNU-Toolchain\libopencm3\lib" -Wl,-Map,"Template.map" -Xlinker --cref --specs=nano.specs -v --static -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group -o "Template.elf" ./Source/main.o -lopencm3_stm32f0 -lc_nano -lnosys
Using built-in specs.
Reading specs from c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/nano.specs
rename spec link to nano_link
rename spec link_gcc_c_sequence to nano_link_gcc_c_sequence
COLLECT_GCC=arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/lto-wrapper.exe
Target: arm-none-eabi
Configured with: /home/build/work/GCC-4-9-build/src/gcc/configure --build=i686-linux-gnu --host=i686-w64-mingw32 --target=arm-none-eabi --prefix=/home/build/work/GCC-4-9-build/install-mingw --libexecdir=/home/build/work/GCC-4-9-build/install-mingw/lib --infodir=/home/build/work/GCC-4-9-build/install-mingw/share/doc/gcc-arm-none-eabi/info --mandir=/home/build/work/GCC-4-9-build/install-mingw/share/doc/gcc-arm-none-eabi/man --htmldir=/home/build/work/GCC-4-9-build/install-mingw/share/doc/gcc-arm-none-eabi/html --pdfdir=/home/build/work/GCC-4-9-build/install-mingw/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-headers=yes --with-newlib --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/home/build/work/GCC-4-9-build/install-mingw/arm-none-eabi --with-libiconv-prefix=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-gmp=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-mpfr=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-mpc=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-isl=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-cloog=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-libelf=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Tools for ARM Embedded Processors' --with-multilib-list=armv6-m,armv7-m,armv7e-m,cortex-m7,armv7-r
Thread model: single
gcc version 4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 224288] (GNU Tools for ARM Embedded Processors)
COMPILER_PATH=c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/;c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/;c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/
LIBRARY_PATH=c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/armv6-m/;c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv6-m/;c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../arm-none-eabi/lib/armv6-m/;c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/;c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/;c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/;c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-mcpu=cortex-m0plus' '-mthumb' '-mlittle-endian' '-Og' '-fmessage-length=0' '-ffunction-sections' '-fdata-sections' '-fno-common' '-mfloat-abi=soft' '-Wpedantic' '-Wall' '-Wextra' '-Wmissing-declarations' '-Wshadow' '-g3' '-ggdb' '-T' 'C:/Users/Lenny/Documents/Eclipse/stm32f0-libopencm3/Template\Misc\stm32f0-discovery.ld' '-nostartfiles' '-LC:\ARM-GNU-Toolchain\libopencm3\lib' '-specs=nano.specs' '-v' '-static' '-o' 'Template.elf'
c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/collect2.exe -plugin c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/liblto_plugin-0.dll -plugin-opt=c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/lto-wrapper.exe -plugin-opt=-fresolution=C:\Users\Lenny\AppData\Local\Temp\ccm3aIUJ.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lg_nano -plugin-opt=-pass-through=-lc_nano -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc_nano --sysroot=c:\arm-gnu-toolchain\gcc-arm-none-eabi-4_9-2015q2-20150609-win32\bin\../arm-none-eabi -EL -Bstatic -X -o Template.elf -LC:\ARM-GNU-Toolchain\libopencm3\lib -Lc:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/armv6-m -Lc:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv6-m -Lc:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../arm-none-eabi/lib/armv6-m -Lc:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3 -Lc:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc -Lc:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib -Lc:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../arm-none-eabi/lib --gc-sections -Map Template.map --cref --start-group -lc_nano -lgcc -lnosys --end-group ./Source/main.o -lopencm3_stm32f0 -lc_nano -lnosys --start-group -lgcc -lg_nano -lc_nano --end-group --start-group -lgcc -lc_nano --end-group -T C:/Users/Lenny/Documents/Eclipse/stm32f0-libopencm3/Template\Misc\stm32f0-discovery.ld
'Finished building target: Template.elf'
' '
make --no-print-directory post-build
'Call post_build.py'
python C:/Users/Lenny/Documents/Eclipse/stm32f0-libopencm3/Template\Misc\post_build.py "C:/Users/Lenny/Documents/Eclipse/stm32f0-libopencm3/Template" "Debug" "Template"
arm-none-eabi-objdump -S "C:\Users\Lenny\Documents\Eclipse\stm32f0-libopencm3\Template\Debug\Template.elf" > "C:\Users\Lenny\Documents\Eclipse\stm32f0-libopencm3\Template\Debug\Template.lst"
' '
'Invoking: Cross ARM GNU Create Flash Image'
arm-none-eabi-objcopy -O ihex "Template.elf" "Template.hex"
'Finished building: Template.hex'
' '
'Invoking: Cross ARM GNU Print Size'
arm-none-eabi-size --format=berkeley "Template.elf"
text data bss dec hex filename
500 0 0 500 1f4 Template.elf
'Finished building: Template.siz'
' '
19:07:04 Build Finished (took 2s.662ms)
stm32f1 - maple, not wortking:
19:43:56 **** Incremental Build of configuration Debug for project Template ****
make all
'Building file: ../Source/main.c'
'Invoking: Cross ARM C Compiler'
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -mlittle-endian -mfix-cortex-m3-ldrd -Og -fmessage-length=0 -ffunction-sections -fdata-sections -msoft-float -pedantic -Wall -Wextra -Wmissing-declarations -Wshadow -g3 -ggdb -DSTM32F1 -I"C:\ARM-GNU-Toolchain\libopencm3\include" -I"C:/Users/Lenny/Documents/Eclipse/maple-mini/Template/Include" -std=gnu11 -Wmissing-prototypes -Wstrict-prototypes -Wimplicit-function-declaration -Wredundant-decls -Wa,-adhlns="Source/main.o.lst" -v -MMD -MP -MF"Source/main.d" -MT"Source/main.o" -c -o "Source/main.o" "../Source/main.c"
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
Target: arm-none-eabi
Configured with: /home/build/work/GCC-4-9-build/src/gcc/configure --build=i686-linux-gnu --host=i686-w64-mingw32 --target=arm-none-eabi --prefix=/home/build/work/GCC-4-9-build/install-mingw --libexecdir=/home/build/work/GCC-4-9-build/install-mingw/lib --infodir=/home/build/work/GCC-4-9-build/install-mingw/share/doc/gcc-arm-none-eabi/info --mandir=/home/build/work/GCC-4-9-build/install-mingw/share/doc/gcc-arm-none-eabi/man --htmldir=/home/build/work/GCC-4-9-build/install-mingw/share/doc/gcc-arm-none-eabi/html --pdfdir=/home/build/work/GCC-4-9-build/install-mingw/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-headers=yes --with-newlib --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/home/build/work/GCC-4-9-build/install-mingw/arm-none-eabi --with-libiconv-prefix=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-gmp=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-mpfr=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-mpc=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-isl=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-cloog=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-libelf=/home/build/work/GCC-4-9-build/build-mingw/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Tools for ARM Embedded Processors' --with-multilib-list=armv6-m,armv7-m,armv7e-m,cortex-m7,armv7-r
Thread model: single
gcc version 4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 224288] (GNU Tools for ARM Embedded Processors)
COLLECT_GCC_OPTIONS='-mcpu=cortex-m3' '-mthumb' '-mlittle-endian' '-mfix-cortex-m3-ldrd' '-Og' '-fmessage-length=0' '-ffunction-sections' '-fdata-sections' '-mfloat-abi=soft' '-Wpedantic' '-Wall' '-Wextra' '-Wmissing-declarations' '-Wshadow' '-g3' '-ggdb' '-D' 'STM32F1' '-I' 'C:\ARM-GNU-Toolchain\libopencm3\include' '-I' 'C:/Users/Lenny/Documents/Eclipse/maple-mini/Template/Include' '-std=gnu11' '-Wmissing-prototypes' '-Wstrict-prototypes' '-Wimplicit-function-declaration' '-Wredundant-decls' '-v' '-MMD' '-MP' '-MF' 'Source/main.d' '-MT' 'Source/main.o' '-c' '-o' 'Source/main.o'
c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/bin/../lib/gcc/arm-none-eabi/4.9.3/cc1.exe -quiet -v -I C:\ARM-GNU-Toolchain\libopencm3\include -I C:/Users/Lenny/Documents/Eclipse/maple-mini/Template/Include -imultilib armv7-m -iprefix c:\arm-gnu-toolchain\gcc-arm-none-eabi-4_9-2015q2-20150609-win32\bin\../lib/gcc/arm-none-eabi/4.9.3/ -isysroot c:\arm-gnu-toolchain\gcc-arm-none-eabi-4_9-2015q2-20150609-win32\bin\../arm-none-eabi -MMD Source/main.d -MF Source/main.d -MP -MT Source/main.o -dD -D__USES_INITFINI__ -D STM32F1 ../Source/main.c -quiet -dumpbase main.c -mcpu=cortex-m3 -mthumb -mlittle-endian -mfix-cortex-m3-ldrd -mfloat-abi=soft -auxbase-strip Source/main.o -g3 -ggdb -Og -Wpedantic -Wall -Wextra -Wmissing-declarations -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wimplicit-function-declaration -Wredundant-decls -std=gnu11 -version -fmessage-length=0 -ffunction-sections -fdata-sections -o C:\Users\Lenny\AppData\Local\Temp\ccd3YTdy.s
GNU C (GNU Tools for ARM Embedded Processors) version 4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 224288] (arm-none-eabi)
compiled by GNU C version 4.7.4, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/lib/gcc/../../lib/gcc/arm-none-eabi/4.9.3/include"
ignoring nonexistent directory "c:\arm-gnu-toolchain\gcc-arm-none-eabi-4_9-2015q2-20150609-win32\bin\../arm-none-eabi/home/build/work/GCC-4-9-build/install-mingw/lib/gcc/arm-none-eabi/4.9.3/../../../../include"
ignoring duplicate directory "c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/lib/gcc/../../lib/gcc/arm-none-eabi/4.9.3/include-fixed"
ignoring duplicate directory "c:/arm-gnu-toolchain/gcc-arm-none-eabi-4_9-2015q2-20150609-win32/lib/gcc/../../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/include"
ignoring nonexistent directory "c:\arm-gnu-toolchain\gcc-arm-none-eabi-4_9-2015q2-20150609-win32\bin\../arm-none-eabi/usr/include"
#include "..." search starts here:
#include <...> search starts here:
C:\ARM-GNU-Toolchain\libopencm3\include
C:/Users/Lenny/Documents/Eclipse/maple-mini/Template/Include
c:\arm-gnu-toolchain\gcc-arm-none-eabi-4_9-2015q2-20150609-win32\bin\../lib/gcc/arm-none-eabi/4.9.3/include
c:\arm-gnu-toolchain\gcc-arm-none-eabi-4_9-2015q2-20150609-win32\bin\../lib/gcc/arm-none-eabi/4.9.3/include-fixed
c:\arm-gnu-toolchain\gcc-arm-none-eabi-4_9-2015q2-20150609-win32\bin\../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/include
End of search list.
GNU C (GNU Tools for ARM Embedded Processors) version 4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 224288] (arm-none-eabi)
compiled by GNU C version 4.7.4, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 9d74dec9c13b63cc54577fa808c91d66
../Source/main.c: In function 'gpio_setup':
../Source/main.c:38:2: warning: implicit declaration of function 'gpio_mode_setup' [-Wimplicit-function-declaration]
gpio_mode_setup(PORT_LED, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, PIN_LED);
^
../Source/main.c:38:28: error: 'GPIO_MODE_OUTPUT' undeclared (first use in this function)
gpio_mode_setup(PORT_LED, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, PIN_LED);
^
../Source/main.c:38:28: note: each undeclared identifier is reported only once for each function it appears in
../Source/main.c:38:46: error: 'GPIO_PUPD_NONE' undeclared (first use in this function)
gpio_mode_setup(PORT_LED, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, PIN_LED);
^
make: *** [Source/main.o] Fehler 1
19:43:57 Build Finished (took 567ms)
I am pretty sure its a stupid mistake, but I cant find it by my own and hope you can give me a hint.
Thank you very much.
The libopencm3 library interfaces for the mentioned architectures are different.
For the f1 the function is gpio_set_mode and not gpio_mode_setup. Also the defines are slightly different.
I have installed and built the BOTAN cryptographic library.
Everything seems correctly installed, since I have the following entries in /usr/local/lib directory:
-rw-r--r-- 1 root root 7676350 2012-06-03 11:01 libbotan-1.10.a
lrwxrwxrwx 1 root root 20 2012-06-03 11:01 libbotan-1.10.so -> libbotan-1.10.so.0.1
lrwxrwxrwx 1 root root 20 2012-06-03 11:01 libbotan-1.10.so.0 -> libbotan-1.10.so.0.1
-rwxr-xr-x 1 root root 3396354 2012-06-03 11:01 libbotan-1.10.so.0.1
and in the /usr/local/include one too:
drwxr-xr-x 3 root root 4096 2012-06-03 11:01 botan-1.10
And eventually I managed to include the libraries in the main of my program, and write code without error.
However when building my project (on Eclipse Indigo) I get the following output on console, with the red stderr fashion:
error while loading shared libraries: libbotan-1.10.so.0: cannot open shared object file: No such file or directory
The code I'm trying to execute is the following:
try
{
cout << "In try" << endl;
Botan::LibraryInitializer init;
}catch(std::exception& e)
{
cout << "In catch" << endl;
cerr << e.what() << endl;
}
I have the following doubts:
Is it a problem of the Linker? (And if yes, why isn't the linker throwing the error, but the stderr?)
If not, how can I figure out to let my program find the libbotan-1.10.so.0 file which is actually there? (in /usr/local/lib).
Note that my environment variable $LD_LIBRARY_PATH is currently set, and has the following value:
$> echo $LD_LIBRARY_PATH
$> /usr/local/lib/
Compiler Command Line:
Invoking: GCC C++ Compiler
g++ -I/usr/include/c++/4.5.2 -I/usr/local/include/botan-1.10 -O3 -g3 -Wall -c -fmessage-length=0 -std=c++0x -v -MMD -MP -MF"mainOobClient.d" -MT"mainOobClient.d" -o "mainOobClient.o" "../mainOobClient.cpp"
g++ -I/usr/include/c++/4.5.2 -I/usr/local/include/botan-1.10 -O3 -g3 -Wall -c -fmessage-length=0 -std=c++0x -v -MMD -MP -MF"oobClientClass.d" -MT"oobClientClass.d" -o "oobClientClass.o" "../oobClientClass.cpp"
Invoking: GCC C++ Linker
g++ -L/usr/local/lib -o "MTVS_oobClient" ./mainOobClient.o ./oobClientClass.o -lbotan-1.10
Complete Build Output:
Build of configuration Debug for project MTVS_oobClient
make all
Building file: ../mainOobClient.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/include/c++/4.5.2 -I/usr/local/include/botan-1.10 -O3 -g3 -Wall -c -fmessage-length=0 -std=c++0x -v -MMD -MP -MF"mainOobClient.d" -MT"mainOobClient.d" -o "mainOobClient.o" "../mainOobClient.cpp"
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.5 --enable-shared --enable-multiarch --with-multiarch-defaults=i386-linux-gnu --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib/i386-linux-gnu --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/i386-linux-gnu --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default --with-plugin-ld=ld.gold --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)
Finished building: ../mainOobClient.cpp
Building file: ../oobClientClass.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/include/c++/4.5.2 -I/usr/local/include/botan-1.10 -O3 -g3 -Wall -c -fmessage-length=0 -std=c++0x -v -MMD -MP -MF"oobClientClass.d" -MT"oobClientClass.d" -o "oobClientClass.o" "../oobClientClass.cpp"
COLLECT_GCC_OPTIONS='-I/usr/include/c++/4.5.2' '-I/usr/local/include/botan-1.10' '-O3' '-g3' '-Wall' '-c' '-fmessage-length=0' '-std=c++0x' '-v' '-MMD' '-MP' '-MFmainOobClient.d' '-MTmainOobClient.d' '-o' 'mainOobClient.o' '-shared-libgcc' '-mtune=generic' '-march=i686'
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/cc1plus -quiet -v -I/usr/include/c++/4.5.2 -I/usr/local/include/botan-1.10 -MMD mainOobClient.d -MFmainOobClient.d -MP -MTmainOobClient.d -MQ mainOobClient.o -dD -D_GNU_SOURCE ../mainOobClient.cpp -D_FORTIFY_SOURCE=2 -quiet -dumpbase mainOobClient.cpp -mtune=generic -march=i686 -auxbase-strip mainOobClient.o -g3 -O3 -Wall -std=c++0x -version -fmessage-length=0 -fstack-protector -o /tmp/ccLIYQkV.s
Finished building: ../oobClientClass.cpp
GNU C++ (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (i686-linux-gnu)
Building target: MTVS_oobClient
Invoking: GCC C++ Linker
g++ ./mainOobClient.o ./oobClientClass.o -lbotan-1.10 -L/usr/local/lib -o "MTVS_oobClient"
compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/i386-linux-gnu"
ignoring nonexistent directory "/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../../../i686-linux-gnu/include"
ignoring duplicate directory "/usr/include/c++/4.5.2"
as it is a non-system directory that duplicates a system directory
Finished building target: MTVS_oobClient
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include/botan-1.10
/usr/include/c++/4.5
/usr/include/c++/4.5/i686-linux-gnu
/usr/include/c++/4.5/backward
/usr/local/include
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/include
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/include-fixed
/usr/include/i386-linux-gnu
/usr/include
End of search list.
GNU C++ (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (i686-linux-gnu)
compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 0c5cb630517b5952f4898dfa56d7e8e5
COLLECT_GCC_OPTIONS='-I/usr/include/c++/4.5.2' '-I/usr/local/include/botan-1.10' '-O3' '-g3' '-Wall' '-c' '-fmessage-length=0' '-std=c++0x' '-v' '-MMD' '-MP' '-MFmainOobClient.d' '-MTmainOobClient.d' '-o' 'mainOobClient.o' '-shared-libgcc' '-mtune=generic' '-march=i686'
as -V -Qy --32 -o mainOobClient.o /tmp/ccLIYQkV.s
GNU assembler version 2.21.0 (i686-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.21.0.20110327
COMPILER_PATH=/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/:/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/:/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/:/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/:/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/
LIBRARY_PATH=/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/:/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../:/lib/:/usr/lib/:/usr/lib/i386-linux-gnu/
COLLECT_GCC_OPTIONS='-I/usr/include/c++/4.5.2' '-I/usr/local/include/botan-1.10' '-O3' '-g3' '-Wall' '-c' '-fmessage-length=0' '-std=c++0x' '-v' '-MMD' '-MP' '-MFmainOobClient.d' '-MTmainOobClient.d' '-o' 'mainOobClient.o' '-shared-libgcc' '-mtune=generic' '-march=i686'
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.5 --enable-shared --enable-multiarch --with-multiarch-defaults=i386-linux-gnu --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib/i386-linux-gnu --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/i386-linux-gnu --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default --with-plugin-ld=ld.gold --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)
COLLECT_GCC_OPTIONS='-I/usr/include/c++/4.5.2' '-I/usr/local/include/botan-1.10' '-O3' '-g3' '-Wall' '-c' '-fmessage-length=0' '-std=c++0x' '-v' '-MMD' '-MP' '-MFoobClientClass.d' '-MToobClientClass.d' '-o' 'oobClientClass.o' '-shared-libgcc' '-mtune=generic' '-march=i686'
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/cc1plus -quiet -v -I/usr/include/c++/4.5.2 -I/usr/local/include/botan-1.10 -MMD oobClientClass.d -MFoobClientClass.d -MP -MToobClientClass.d -MQ oobClientClass.o -dD -D_GNU_SOURCE ../oobClientClass.cpp -D_FORTIFY_SOURCE=2 -quiet -dumpbase oobClientClass.cpp -mtune=generic -march=i686 -auxbase-strip oobClientClass.o -g3 -O3 -Wall -std=c++0x -version -fmessage-length=0 -fstack-protector -o /tmp/ccTuqeWw.s
GNU C++ (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (i686-linux-gnu)
compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/i386-linux-gnu"
ignoring nonexistent directory "/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../../../i686-linux-gnu/include"
ignoring duplicate directory "/usr/include/c++/4.5.2"
as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include/botan-1.10
/usr/include/c++/4.5
/usr/include/c++/4.5/i686-linux-gnu
/usr/include/c++/4.5/backward
/usr/local/include
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/include
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/include-fixed
/usr/include/i386-linux-gnu
/usr/include
End of search list.
GNU C++ (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (i686-linux-gnu)
compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 0c5cb630517b5952f4898dfa56d7e8e5
../oobClientClass.cpp: In member function ‘void oobClientClass::authenticateTransaction()’:
../oobClientClass.cpp:126:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
../oobClientClass.cpp:164:63: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result
../oobClientClass.cpp:59:6: warning: ‘confirmationChoice’ may be used uninitialized in this function
COLLECT_GCC_OPTIONS='-I/usr/include/c++/4.5.2' '-I/usr/local/include/botan-1.10' '-O3' '-g3' '-Wall' '-c' '-fmessage-length=0' '-std=c++0x' '-v' '-MMD' '-MP' '-MFoobClientClass.d' '-MToobClientClass.d' '-o' 'oobClientClass.o' '-shared-libgcc' '-mtune=generic' '-march=i686'
as -V -Qy --32 -o oobClientClass.o /tmp/ccTuqeWw.s
GNU assembler version 2.21.0 (i686-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.21.0.20110327
COMPILER_PATH=/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/:/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/:/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/:/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/:/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/
LIBRARY_PATH=/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/:/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../:/lib/:/usr/lib/:/usr/lib/i386-linux-gnu/
COLLECT_GCC_OPTIONS='-I/usr/include/c++/4.5.2' '-I/usr/local/include/botan-1.10' '-O3' '-g3' '-Wall' '-c' '-fmessage-length=0' '-std=c++0x' '-v' '-MMD' '-MP' '-MFoobClientClass.d' '-MToobClientClass.d' '-o' 'oobClientClass.o' '-shared-libgcc' '-mtune=generic' '-march=i686'
**** Build Finished ****
The error is coming at run-time. You need to specify the rpath for the binary at build time - Where you have the:
-L/usr/local/lib
You also need:
-Wl,-rpath=/usr/local/lib
This instructs ld to use this path when trying to find the library at run-time. Your LD_LIBRARY_PATH is probably being overridden by the launcher of eclipse, which is why the variable is not being used.
Alternatives:
Make sure that /usr/local/lib is in the /etc/ld.so.conf, and that ldconfig has been run after installing the library.
Link to the .a, using the command line:
g++ -o "MTVS_oobClient" ./mainOobClient.o ./oobClientClass.o -L/usr/local/lib -Wl,-Bstatic -lbotan-1.10 -Wl,-Bdynamic
or using:
g++ -o "MTVS_oobClient" ./mainOobClient.o ./oobClientClass.o /usr/local/lib/libbotan-1.10.a
... both should have the same effect
Since the program build ends correctly, it is clear that it's a run-time problem due to the fact that the program can't find the Shared Library.
I looked for other people with same run-time issue and found out the solution (that I'll briefly sum up) thanks to another SO question.
What I did was to build the dynamically-linked executable, that wishes to be linked against libbotan-1.10.so.0 at execution time. The linking during the build phase was done with command line option -L/usr/local/lib.
There are a few options to make botan (or any other library) available at run-time:
Create a symlink to botan in a directory listed in /etc/ld.so.conf (or /lib or /usr/lib)
Copy botan to a directory listed in /etc/ld.so.conf (or /lib or /usr/lib) (defaults)
Add the directory containing botan to /etc/ld.so.conf
Set LD_LIBRARY_PATH=/usr/local/lib before running your executable.
Recompile the program statically. (It will work, but don't bother.)
After any of the first 3, rerun ldconfig so the linker cache is updated. (You can then run ldconfig -v to verify it's resolvable.)
Note those aren't steps, they're options. You only need to do 1 of them.
Updating the linker cache with ldconfig made it work for me.