BeagleBoneBlack Cross Compile on Mac Error - c++

I use gcc-linaro-arm-linux-gnueabihf-2014.05 for cross-compling BeagleBoneBlack (Rev c) on my mac using eclipse.
I used this weblog instructions: http://www.welzels.de/blog/en/arm-cross-compiling-with-mac-os-x/
when I compile the hello world sample it works "ok" on BBB, but the problem is when I compile my full program using pthread and stdio and etc... it fails to run on BBB with the following error:
./NewDCU.elf: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./NewDCU.elf)
for more details about my BBB:
root#arm:/home/ubuntu# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.8/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.8.2 (Ubuntu/Linaro 4.8.2-19ubuntu1)

It seems that the problem is related to missmatch of toolchain complier version and my corresponding libraries on BBB.
I downgraded my Linaro toolchain to 4.8 from this link:
http://www.welzels.de/blog/projekte/arm-cross-toolchain/

Related

Installing g++ = 7.5.0 with support for Cilk Plus

I want to use https://github.com/yushangdi/parChain however I can't fullfil requirement:
Compiler:
g++ = 7.5.0 with support for Cilk Plus
I have a problem with installing GCC with Cilk. I try to follow some tutorials from the websites but any of them doesn't work correctly. Unfortunately, the Cilk project was transformed into Intel's project many documentation URLs don't work anymore. I got following error after run $./pc_exp.sh
In file included from sequence.h:27:0,
from framework.C:1:
parallel.h:25:10: fatal error: cilk/cilk.h: Not found
#include <cilk/cilk.h>
^~~~~~~~~~~~~
compilation terminated.
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
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-6ubuntu2' --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-6ubuntu2)
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
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-6ubuntu2' --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-6ubuntu2)
I need to run this on both: Ubuntu 20.04 and Centos 7. I'm not Linux/c++ experienced user. Can you help me with some tutorials?
I recommend you consider OpenCilk, an active open source project that picks up where Cilk Plus left off. OpenCilk 2.0 was released just a couple weeks ago, and it definitely supports Ubuntu 20.04. (Not sure about Centos.) Please see https://www.opencilk.org for tutorials on programming with Cilk (which is based on LLVM btw).

C++11 used by default? [duplicate]

This question already has answers here:
How do I check for C++11 support?
(9 answers)
Closed 4 years ago.
How can I know whether c++11 is used by default in my g++ compiler? My OS is ubuntu 18.04.1.
zell#ubuntu:~$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
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.3.0-27ubuntu1~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 --with-sysroot=/ --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.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04)
It is--one resource out there is gcc/g++ web page on C++ status and standards:
g++ 4.8.1 and above support C++11 and I recall g++-7 having it as default
and I had seen that stated on that page before but I am not seeing it now...
g++ 6.1 and above default to C++14 as per the page
You can of course switch and make explicit choices with the usual -std=... flag.
My way (no compiler dependand): compile and run the following program
#include <iostream>
int main()
{ std::cout << __cplusplus << std::endl; }
You'll get (supposing a standard compliant compiler)
"199711", for C++98
"201103", for C++11
"201402", for C++14
"201703", for C++17

Cannot Build Boost 1.47.0 IOStreams on Ubuntu

I am working on a legacy project for my company that requires me to use a specific version of boost and that version is 1.47.0. I have downloaded and run:
./b2 --toolset=gcc variant=debug
and it compiled the majority of the static libraries I needed with the exception of a few. One being libboost_iostreams. I did some research and found that it appeared i was missing some dependencies.
whereis bzip2
bzip2: /bin/bzip2 /usr/share/man/man1/bzip2.1.gz
whereis zlib
zlib: /usr/include/zlib.h /usr/share/man/man3/zlib.3.gz
However when I attempt to run:
./b2 --with-iostreams -s BZIP2_SOURCE=/bin -s ZLIB_SOURCE=/usr/include
I am getting the following error:
Building the Boost C++ Libraries.
error: Unable to find file or target named
error: '/bin/libbz2.def'
error: referred from project at
error: 'libs/iostreams/build'
Update:
Linux Version: 16.04
Gcc Version Info:
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-
6ubuntu1~16.04.9' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --
enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --
program-suffix=-5 --enable-shared --enable-linker-build-id --
libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --
libdir=/usr/lib --enable-nls --with-sysroot=/ --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 --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --
enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --
enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --
with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-
directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-
objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-
abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-
tune=generic --enable-checking=release --build=x86_64-linux-gnu --
host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)

Ubuntu 17.04 C++ project compilation output wrong type

I upgraded yesterday Ubuntu 16.04 to 17.04 and made a new compliation of my C++ projects. But it ouputs me a shared object file and it supposed to output an executable file of course.
I can execute it from command line but I can't launch the soft from the UI. It worked well in version 16.04.
Here is the end of the compilation:
echo Linking wxFlasher...
mkdir -p /home/barnaud/dev/wxFlasher/wxFlasher/out_gcc/releaseu/
rm -f /home/barnaud/dev/wxFlasher/wxFlasher/out_gcc/releaseu/wxFlasher
g++ -s -o /home/barnaud/dev/wxFlasher/wxFlasher/out_gcc/releaseu/wxFlasher /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Main/Application.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Main/ResourceManager.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Main/Event.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Main/Thread.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Main/Utils.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/HMI/MainFrame.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/HMI/PnlFlasher.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/HMI/DlgAbout.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/HMI/PnlUpdater.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/HMI/PnlDump.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/HMI/PnlRegen.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Protocol/PlfManagement.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Protocol/UpdaterThread.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Protocol/UpdaterFactory.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Protocol/UartUpdaterProtocol.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Protocol/UartBootloaderProtocol.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Protocol/UsbUpdaterProtocol.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Protocol/UsbBootloaderProtocol.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Protocol/UsbOmap3630Protocol.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Protocol/TestProtocolThread.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Protocol/RegenProtocolThread.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Protocol/posix_crc.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Communication/libusb.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Communication/Uart.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Config/ProductCfg.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Config/ProductXml.o /home/barnaud/dev/wxFlasher/wxFlasher/build_gcc/releaseu/Config/UpdaterCfg.o -L/usr/lib/x86_64-linux-gnu -pthread -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0
Any ideas ?
EDIT :
Here is the output of file command:
wxFlasher: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=3c57f7ee667e4ba8be74a0392d9574a91918fa0e, not stripped
And here is the output of g++ -v command:
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 6.3.0-12ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --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 --with-sysroot=/ --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 --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --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-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 6.3.0 20170406 (Ubuntu 6.3.0-12ubuntu2)

128 bit MVBITS in gfortran

EDIT :: I reported the bug to the GCC bugzilla. It has now been fixed.
The following example does not compile with gfortran 4.8.4:
PROGRAM test
USE ISO_C_BINDING
INTEGER(C_INT128_T) :: CINT128T
INTEGER, PARAMETER :: I16B = KIND(CINT128T)
INTEGER(I16B) :: a, b
a = 127
b = 0
b = IBSET(b,0)
a = IBCLR(a,0)
CALL MVBITS(a,0,3,b,0)
END PROGRAM test
Here's what I get:
$ gfortran test.f90
/tmp/cc2CEkwu.o: In function `MAIN__':
test.f90:(.text+0x89): undefined reference to `_gfortran_mvbits_i16'
collect2: error: ld returned 1 exit status
Here's how gfortran is compiled (i.e., it's the version that comes with Ubuntu 14.04):
$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)
I've been doing other bit operations on 128-bit integers (IBSET, IBCLR, BTEST, IBITS) and they all work fine. Any ideas?
The runtime library does not have the 16 byte version of that intrinsic. You are out of luck, get a different compiler, which can do it (I don't know any), or use smaller integers.
You could also write the function yourself in C, if you feel like doing such a thing.