CppServer
CppServer copied to clipboard
Cannot build on raspberry / UbuntuServer64
While trying to compile on a tiny-but-nice Raspi3, with Ubuntu-server 64bits installed, I get stuck on this compilation:
/home/XXXX/CppServer/modules/CppCommon/source/time/timestamp.cpp: In static member function ‘static uint64_t CppCommon::Timestamp::rdts()’: /home/XXXX/CppServer/modules/CppCommon/source/time/timestamp.cpp:218:1: error: no return statement in function returning non-void [-Werror=return-type] } ^
Looking in source code, I can see that:
uint64_t Timestamp::rdts() { #if defined(_MSC_VER) return __rdtsc(); #elif defined(i386) uint64_t x; asm volatile (".byte 0x0f, 0x31" : "=A" (x)); return x; #elif defined(x86_64) unsigned hi, lo; asm volatile ("rdtsc" : "=a"(lo), "=d"(hi)); return ((uint64_t)lo) | (((uint64_t)hi) << 32); #endif }
As you can see, all defines concern other platforms, so Linux compilation leads to an empty function, which obviously is not right.
I am very suprised, as I already compiled successfully CppServer on my station which is on Ubuntu (Mate).
Here is the ouput beginning of ./unix.sh command (on the faulty Raspi):
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.13") found components: doxygen missing components: dot
-- The System identification is Linux-5.3.0-1022-raspi2 Linux 5.3.0-1022-raspi2 Platform/Linux
-- Found OpenSSL: /usr/lib/aarch64-linux-gnu/libcrypto.so (found version "1.1.1")
-- The System identification is Linux-5.3.0-1022-raspi2 Linux 5.3.0-1022-raspi2 Platform/Linux
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- The System identification is Linux-5.3.0-1022-raspi2 Linux 5.3.0-1022-raspi2 Platform/Linux
-- Found LIBBFD: /usr/lib/aarch64-linux-gnu/libbfd.so
-- Found LIBDL: /usr/lib/aarch64-linux-gnu/libdl.so
-- Found LIBRT: /usr/lib/aarch64-linux-gnu/librt.so
-- Found LIBUUID: /usr/lib/aarch64-linux-gnu/libuuid.so
-- Could NOT find LIBVLD (missing: LIBVLD_LIBRARY)
-- OpenSSL version: 1.1.1 /usr/include /usr/lib/aarch64-linux-gnu/libssl.so;/usr/lib/aarch64-linux-gnu/libcrypto.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/XXXXX/CppServer/temp
Any clue? Thanks a lot
Hi @esppat, I solved it by adding extra lines of code for the other platforms too.
You can check here (particularly on line 102 for arm64) https://github.com/google/benchmark/blob/v1.1.0/src/cycleclock.h#L102
Fixed in CppCommon!