Running C++ units failed when building turicreate from source - c++

I am experiencing problem while building turicreate from source on Ubuntu 20.04. while running make to build C++ unit tests, it failed with the following error.
[ 79%] Building CXX object test/util/CMakeFiles/SpanTests.cxxtest.dir/SpanTests.cxx.o
In file included from /usr/include/c++/9/vector:67,
from /home/oem/Desktop/turicreate/src/core/util/Span.hpp:12,
from /home/oem/Desktop/turicreate/test/util/SpanTests.cxx:9:
/usr/include/c++/9/bits/stl_vector.h: In instantiation of ‘class std::vector<const int, std::allocator<const int> >’:
/home/oem/Desktop/turicreate/test/util/SpanTests.cxx:66:41: required from here
/usr/include/c++/9/bits/stl_vector.h:398:66: error: static assertion failed: std::vector must have a non-const, non-volatile value_type
398 | static_assert(is_same<typename remove_cv<_Tp>::type, _Tp>::value,
| ^~~~~
cc1plus: error: unrecognized command line option ‘-Wno-unknown-warning-option’ [-Werror]
cc1plus: error: unrecognized command line option ‘-Wno-parentheses-equality’ [-Werror]
cc1plus: error: unrecognized command line option ‘-Wno-constant-logical-operand’ [-Werror]
cc1plus: error: unrecognized command line option ‘-Wno-mismatched-tags’ [-Werror]
cc1plus: error: unrecognized command line option ‘-Wno-deprecated-register’ [-Werror]
cc1plus: error: unrecognized command line option ‘-Wno-unused-command-line-argument’ [-Werror]
cc1plus: all warnings being treated as errors
make[2]: *** [test/util/CMakeFiles/SpanTests.cxxtest.dir/build.make:63: test/util/CMakeFiles/SpanTests.cxxtest.dir/SpanTests.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:8206: test/util/CMakeFiles/SpanTests.cxxtest.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

Related

error: ‘shared_mutex’ is not a member of ‘std’ using ReaderLock = std::shared_lock<std::shared_mutex>;

i'm trying to use microsoft SEAL library for homomorphic encryption and following the steps from the below link https://github.com/cyberweapons/SEAL/blob/master/INSTALL.txt
when i use command cmake .
terminal shows below result
-- SEAL detected (version 2.3.1)
-- SEAL build type: Release
-- SEAL debug mode: OFF
-- SEAL using Microsoft GSL: OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ravindra/Desktop/../../MiSEAL/SEAL/SEALExamples
after that when i give make command it should generate a file main.cpp.o instead it is giving the following errors.
[ 50%] Building CXX object CMakeFiles/sealexamples.dir/main.cpp.o
In file included from /usr/local/include/seal/util/mempool.h:12:0,
from /usr/local/include/seal/memorypoolhandle.h:6,
from /usr/local/include/seal/biguint.h:6,
from /usr/local/include/seal/bigpoly.h:9,
from /usr/local/include/seal/seal.h:3,
from /home/ravindra/Desktop/SakhaProjects/S20_AI/MiSEAL/SEAL/SEALExamples/main.cpp:12:
/usr/local/include/seal/util/locks.h:12:45: error: ‘shared_mutex’ is not a member of ‘std’
using ReaderLock = std::shared_lock<std::shared_mutex>;
^~~
/usr/local/include/seal/util/locks.h:12:45: error: ‘shared_mutex’ is not a member of ‘std’
/usr/local/include/seal/util/locks.h:12:62: error: template argument 1 is invalid
using ReaderLock = std::shared_lock<std::shared_mutex>;
^
/usr/local/include/seal/util/locks.h:14:45: error: ‘shared_mutex’ is not a member of ‘std’
using WriterLock = std::unique_lock<std::shared_mutex>;
^~~
/usr/local/include/seal/util/locks.h:14:45: error: ‘shared_mutex’ is not a member of ‘std’
/usr/local/include/seal/util/locks.h:14:62: error: template argument 1 is invalid
using WriterLock = std::unique_lock<std::shared_mutex>;
^
/usr/local/include/seal/util/locks.h:21:20: error: ‘ReaderLock’ does not name a type
inline ReaderLock acquire_read()
^~~~~~~~~~
/usr/local/include/seal/util/locks.h:26:20: error: ‘WriterLock’ does not name a type
inline WriterLock acquire_write()
^~~~~~~~~~
/usr/local/include/seal/util/locks.h:31:20: error: ‘ReaderLock’ does not name a type
inline ReaderLock try_acquire_read()
^~~~~~~~~~
/usr/local/include/seal/util/locks.h:36:20: error: ‘WriterLock’ does not name a type
inline WriterLock try_acquire_write()
^~~~~~~~~~
/usr/local/include/seal/util/locks.h:46:18: error: ‘shared_mutex’ in namespace ‘std’ does not name a type
std::shared_mutex rw_lock_mutex_;
^~~~~~~~~~~~
In file included from /usr/local/include/seal/memorypoolhandle.h:6:0,
from /usr/local/include/seal/biguint.h:6,
from /usr/local/include/seal/bigpoly.h:9,
from /usr/local/include/seal/seal.h:3,
from /home/ravindra/Desktop/SakhaProjects/S20_AI/MiSEAL/SEAL/SEALExamples/main.cpp:12:
/usr/local/include/seal/util/mempool.h: In member function ‘virtual int64_t seal::util::MemoryPoolMT::pool_count() const’:
/usr/local/include/seal/util/mempool.h:561:17: error: ‘ReaderLock’ was not declared in this scope
ReaderLock lock(pools_locker_.acquire_read());
^~~~~~~~~~
CMakeFiles/sealexamples.dir/build.make:62: recipe for target 'CMakeFiles/sealexamples.dir/main.cpp.o' failed
make[2]: *** [CMakeFiles/sealexamples.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/sealexamples.dir/all' failed
make[1]: *** [CMakeFiles/sealexamples.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
i am new to SEAL library also i am a beginner to c++ programming, please someone help me to fix this issues.
Hi i found the solution,
i have included following commands in CMakeLists.txt file continued with the steps
`
# Below is TFHE START
export TFHE_PREFIX=/usr/local
export CPLUS_INCLUDE_PATH=${TFHE_PREFIX}/include:${CPLUS_INCLUDE_PATH}
export C_INCLUDE_PATH=${TFHE_PREFIX}/include:${C_INCLUDE_PATH}
export LIBRARY_PATH=${TFHE_PREFIX}/lib:${LIBRARY_PATH}
export LD_LIBRARY_PATH=${TFHE_PREFIX}/lib:${LD_LIBRARY_PATH}
# Below is TFHE END
`

dlib example, test builds fail

Running ubuntu 12.04, I downloaded the source and compiled it as instructed (see https://github.com/davisking/dlib). Below is the error message displayed.
cmake --build . --config Release
[ 1%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bsp/bsp.cpp.o
In file included from /home/andreif/downlib/dlib-19.2/dlib/bsp/../sockets/../threads/parallel_for_extension.h:9:0,
from /home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads.h:24,
from /home/my_path/dlib-19.2/dlib/bsp/../sockets/sockets_kernel_2.h:33,
from /home/my_path/dlib-19.2/dlib/bsp/../sockets/posix.h:4,
from /home/my_path/dlib-19.2/dlib/bsp/../sockets.h:14,
from /home/my_path/dlib-19.2/dlib/bsp/bsp.h:7,
from /home/my_path/dlib-19.2/dlib/bsp/bsp.cpp:6:
/home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads/async.h: In function ‘std::future<typename std::result_of<_Functor(_ArgTypes="" ...)="">::type> dlib::async(dlib::thread_pool&, Function&&, Args&& ...)’:
/home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads/async.h:63:15: error: expected nested-name-specifier before ‘bind_t’
/home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads/async.h:63:15: error: ‘bind_t’ has not been declared
/home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads/async.h:63:22: error: expected ‘;’ before ‘=’ token
/home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads/async.h:63:22: error: expected primary-expression before ‘=’ token
/home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads/async.h:63:24: error: expected primary-expression before ‘decltype’
/home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads/async.h:63:24: error: expected ‘;’ before ‘decltype’
/home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads/async.h:64:37: error: ‘bind_t’ was not declared in this scope
make[2]: [dlib_build/CMakeFiles/dlib.dir/bsp/bsp.cpp.o] Error 1
make[1]: [dlib_build/CMakeFiles/dlib.dir/all] Error 2
make: *** [all] Error 2
The problem was my c++ compiler: the default gcc 4.6 in ubuntu 12.04 has c++11 support, but it has to be enabled at the command line when calling it. I tried editing /.bashrc to automatically do this, but it didn't work. The solution for me was to install gcc/g++ 4.8 (and use update-alternatives to keep the old installation usable), as described here
http://mortenvp.com/installing-a-newer-gccg-on-ubuntu-12-04-lts/

Vikit_common - Installation failed - Raspberry Pi 2 B

I'm working an a project of drone and I'm having an issue with my Raspberry Pi 2 B. When I'm trying to install vikit_common, I've this on screen :
pi#raspberrypi ~/workspace/rpg_vikit/vikit_common/build $ cmake ..
-- Eigen found (include: /usr/include/eigen3)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/workspace/rpg_vikit/vikit_common/build
pi#raspberrypi ~/workspace/rpg_vikit/vikit_common/build $ make
[ 7%] Building CXX object CMakeFiles/vikit_common.dir/src/atan_camera.cpp.o
cc1plus: error: bad value (native) for -march switch
cc1plus: error: unrecognized command line option ‘-mmmx’
cc1plus: error: unrecognized command line option ‘-msse’
cc1plus: error: unrecognized command line option ‘-msse’
cc1plus: error: unrecognized command line option ‘-msse2’
cc1plus: error: unrecognized command line option ‘-msse3’
cc1plus: error: unrecognized command line option ‘-mssse3’
cc1plus: error: bad value (native) for -march switch
cc1plus: error: unrecognized command line option ‘-mmmx’
cc1plus: error: unrecognized command line option ‘-msse’
cc1plus: error: unrecognized command line option ‘-msse’
cc1plus: error: unrecognized command line option ‘-msse2’
cc1plus: error: unrecognized command line option ‘-msse3’
cc1plus: error: unrecognized command line option ‘-mssse3’
CMakeFiles/vikit_common.dir/build.make:57: recipe for target 'CMakeFiles/vikit_common.dir/src/atan_camera.cpp.o' failed
make[2]: *** [CMakeFiles/vikit_common.dir/src/atan_camera.cpp.o] Error 1
CMakeFiles/Makefile2:168: recipe for target 'CMakeFiles/vikit_common.dir/all' failed
make[1]: *** [CMakeFiles/vikit_common.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: *** [all] Error 2
I have Cmake installed (sudo apt-get cmake), Gcc (4.6.3) and OpenCV.
How can I solve the problem ?
Apparently you have an incorrect cmake configuration
A quick gcc 4.6.3 man says
-march=
This specifies the name of the target ARM architecture. GCC uses this name to determine what kind of instructions it can use when
generating assembly code. This option can be used in conjunction with
or instead of the `-mcpu=' option. Permissable names are: ‘armv2’, ‘armv2a’, ‘armv3’, ‘armv3m’, ‘armv4’,‘armv4t’, ‘armv5’, ‘armv5t’, ‘armv5e’, ‘armv5te’, ‘armv6’, ‘armv6j’, ‘armv6t2’,‘armv6z’, ‘armv6zk’, ‘armv6-m’, ‘armv7’, ‘armv7-a’, ‘armv7-r’, ‘armv7-m’,‘iwmmxt’, ‘iwmmxt2’, ‘ep9312’
Firstly looks like you have a wrong value for -march.
So check your cmake configuration

How can I understand these dreadful errors when building gcc-4.8.2?

I am trying to install the gcc-4.8.2 compiler on a remote Debian 7 system, to which I have no root privileges, but only a ssh access. I figured out that the simplest way would be to compile the compiler from source.
I am following this short installation manual from the GCC webpage.
Basically I did the most simple installation, which is summarized at the bottom of the page:
tar xzf gcc-4.8.2.tar.gz
cd gcc-4.8.2
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.8.2/configure --prefix=$HOME/gcc-4.8.2 --enable-languages=c++
make
with the small exception that I did not run the ./contrib/download_prerequisites script on the remote machine because of firewall restrictions. Instead I ran it on my local machine, then compressed the entire folder back into gcc-4.8.2.tar.gz and scp'd it to the remote machine. There I re-created the symbolic links to the prerequisite libraries (gmp,...) and ran make. After several seconds I receive incredible errors:
In file included from ./tm.h:19:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:24:
./options.h:4078:2: error: #error too many masks for ix86_isa_flags
In file included from ../../gcc-4.8.2/gcc/tree.h:26:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:25:
../../gcc-4.8.2/gcc/statistics.h:25:2: error: #error GATHER_STATISTICS must be defined
In file included from ../../gcc-4.8.2/gcc/system.h:268:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:22:
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
In file included from ../../gcc-4.8.2/gcc/tree.h:29:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:25:
../../gcc-4.8.2/gcc/real.h:103:9: error: #error "REAL_WIDTH > 6 not supported"
In file included from ../../gcc-4.8.2/gcc/c-family/c-common.h:24:0,
from ../../gcc-4.8.2/gcc/c/c-tree.h:23,
from ../../gcc-4.8.2/gcc/c/c-lang.c:26:
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:265:3: error: #error "Cannot find a least-32-bit signed integer type"
In file included from ../../gcc-4.8.2/gcc/c/c-lang.c:22:0:
../../gcc-4.8.2/gcc/system.h:500:34: error: declaration of C function ‘const char* strsignal(int)’ conflicts with
In file included from /usr/include/c++/4.7/cstring:44:0,
from ../../gcc-4.8.2/gcc/system.h:205,
from ../../gcc-4.8.2/gcc/c/c-lang.c:22:
/usr/include/string.h:566:14: error: previous declaration ‘char* strsignal(int)’ here
In file included from ../../gcc-4.8.2/gcc/system.h:645:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:22:
../../gcc-4.8.2/gcc/../include/libiberty.h:110:36: error: new declaration ‘char* basename(const char*)’
In file included from /usr/include/c++/4.7/cstring:44:0,
from ../../gcc-4.8.2/gcc/system.h:205,
from ../../gcc-4.8.2/gcc/c/c-lang.c:22:
/usr/include/string.h:603:28: error: ambiguates old declaration ‘const char* basename(const char*)’
In file included from ../../gcc-4.8.2/gcc/tree.h:27:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:25:
../../gcc-4.8.2/gcc/vec.h: In static member function ‘static void va_heap::reserve(vec<T, va_heap, vl_embed>*&, unsigned int, bool)’:
../../gcc-4.8.2/gcc/vec.h:295:7: error: ‘GATHER_STATISTICS’ was not declared in this scope
../../gcc-4.8.2/gcc/vec.h:303:7: error: ‘GATHER_STATISTICS’ was not declared in this scope
../../gcc-4.8.2/gcc/vec.h: In static member function ‘static void va_heap::release(vec<T, va_heap, vl_embed>*&)’:
../../gcc-4.8.2/gcc/vec.h:317:7: error: ‘GATHER_STATISTICS’ was not declared in this scope
In file included from ../../gcc-4.8.2/gcc/tree.h:29:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:25:
../../gcc-4.8.2/gcc/real.h: At global scope:
../../gcc-4.8.2/gcc/real.h:51:21: error: ‘SIZEOF_LONG’ was not declared in this scope
../../gcc-4.8.2/gcc/real.h:51:21: error: ‘SIZEOF_LONG’ was not declared in this scope
../../gcc-4.8.2/gcc/real.h:76:31: error: ‘SIZEOF_LONG’ was not declared in this scope
../../gcc-4.8.2/gcc/real.h:76:31: error: ‘SIZEOF_LONG’ was not declared in this scope
../../gcc-4.8.2/gcc/real.h:76:31: error: ‘SIZEOF_LONG’ was not declared in this scope
../../gcc-4.8.2/gcc/real.h:76:31: error: ‘SIZEOF_LONG’ was not declared in this scope
In file included from ../../gcc-4.8.2/gcc/c-family/c-common.h:24:0,
from ../../gcc-4.8.2/gcc/c/c-tree.h:23,
from ../../gcc-4.8.2/gcc/c/c-lang.c:26:
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:267:35: error: expected initializer before ‘cppchar_t’
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:268:9: error: ‘CPPCHAR_SIGNED_T’ does not name a type
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:777:8: error: ‘cppchar_t’ does not name a type
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:788:8: error: ‘cppchar_t’ does not name a type
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:966:8: error: ‘cppchar_t’ does not name a type
make[3]: *** [c/c-lang.o] Error 1
make[3]: Leaving directory `/home/mdrozdik/gccbuild/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/home/mdrozdik/gccbuild'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/mdrozdik/gccbuild'
make: *** [all] Error 2
I am compiling with gcc 4.7.2-5 on Debian.
On the local machine there is Ubuntu 13.10 with gcc 4.7.3 and the build seems fine so far (still running).
Please, what could be the cause of these errors?
EDIT:
I checked the /home/mdrozdik/gccbuild/libcpp/config.log file. It is very longm but in two places there are these errors:
configure:3086: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3097: $? = 4
configure:3086: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:3097: $? = 4
But the log continues for several pages nevertheless.
I had a similar problem (gcc 4.8.3) and this solved it: g++ 4.7.1 compilation error : conflicting types for ‘strsignal’
The solution was to unset a bunch of C compiler flags (CPATH, etc.)
https://stackoverflow.com/users/1224886/tsbertalan reported this worked for him (and it's what I used):
unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE

MySQL Connect/C++ 64 bit build error

I am using Netbeans and MacoSX and installed 64bit connector. On building I am getting following errors:
/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
/usr/bin/make -f nbproject/Makefile-Debug.mk dist/Debug/GNU-MacOSX/inventory
mkdir -p build/Debug/GNU-MacOSX
rm -f build/Debug/GNU-MacOSX/addproduct.o.d
g++ -c -g -Iinclude -Iinclude -MMD -MP -MF build/Debug/GNU-MacOSX/addproduct.o.d -o build/Debug/GNU-MacOSX/addproduct.o addproduct.cpp
from addproduct.cpp:10:
In file included from include/mysql_connection.h:30,
include/cppconn/connection.h:31:29: warning: boost/variant.hpp: No such file or directory
In file included from addproduct.cpp:10:
include/mysql_connection.h:31:32: warning: boost/shared_ptr.hpp: No such file or directory
from addproduct.cpp:10:
In file included from include/mysql_connection.h:30,
include/cppconn/connection.h:41: error: 'boost' has not been declared
include/cppconn/connection.h:41: error: expected initializer before '<' token
include/cppconn/connection.h:43: error: 'ConnectPropertyVal' was not declared in this scope
include/cppconn/connection.h:43: error: template argument 2 is invalid
include/cppconn/connection.h:43: error: template argument 4 is invalid
include/cppconn/connection.h:43: error: invalid type in declaration before ';' token
In file included from addproduct.cpp:10:
include/mysql_connection.h:75: error: 'ConnectPropertyVal' is not a member of 'sql'
include/mysql_connection.h:75: error: 'ConnectPropertyVal' is not a member of 'sql'
include/mysql_connection.h:75: error: template argument 2 is invalid
include/mysql_connection.h:75: error: template argument 4 is invalid
include/mysql_connection.h:157: error: 'ConnectPropertyVal' is not a member of 'sql'
include/mysql_connection.h:157: error: 'ConnectPropertyVal' is not a member of 'sql'
include/mysql_connection.h:157: error: template argument 2 is invalid
include/mysql_connection.h:157: error: template argument 4 is invalid
include/mysql_connection.h:160: error: 'boost' has not been declared
include/mysql_connection.h:160: error: ISO C++ forbids declaration of 'shared_ptr' with no type
include/mysql_connection.h:160: error: expected ';' before '<' token
make[2]: *** [build/Debug/GNU-MacOSX/addproduct.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 538ms)
In Netbeans I am linking libmysqlcppconn.dylib only.
What files am I missing?
Why is it asking for BOOST? and which Boost Libs do I need to install?
mysql_connection.h includes #include <boost/shared_ptr.hpp>, you could either use latest versions of boost or modify below lines mysql_connection.h to use std::shared_ptr instead:
update
#include <boost/shared_ptr.hpp>
boost::shared_ptr< NativeAPI::NativeConnectionWrapper > proxy;
to
#include <memory>
std::shared_ptr< NativeAPI::NativeConnectionWrapper > proxy;
Have you read the documentation entitled "21.4.2. Installing MySQL Connector/C++ from Source"? Read the entire page carefully, then look for links specific to MacOSX...