Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No explanation how to build Test Suite #120

Open
admiyo opened this issue Nov 20, 2023 · 2 comments
Open

No explanation how to build Test Suite #120

admiyo opened this issue Nov 20, 2023 · 2 comments
Assignees

Comments

@admiyo
Copy link

admiyo commented Nov 20, 2023

Usually the explanation would be in the README. Barring that, it would be in the Documentation file.

I tied building with the obvious : mkdir build; cd build; cmake ..

But quickly got into errors like :

CMake Error at CMakeLists.txt:49 (MESSAGE):
Unkown ARCH

Setting the arch gets to:

cmake -DARCH:STRING=aarch64 -DTOOLCHAIN:STRING=gcc ..
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 3.5 will be removed from a future version of
CMake.

Update the VERSION argument value or use a ... suffix to tell
CMake that the project does not need compatibility with older versions.

#########################

Build Configuration

#########################
ARCH = aarch64
CMake Error at CMakeLists.txt:78 (MESSAGE):
Unkown TOOLCHAIN

Unkown TOOLCHAIN

@steven-bellock steven-bellock self-assigned this Dec 11, 2023
@admiyo
Copy link
Author

admiyo commented Dec 13, 2023

OK, I was able to get this to build by passing in a bunch of -D options. Why they were not found by default on AARCH64 is a mystery still.

CMakeLists.txt has one error in it that breaks on ARM64: Essentially, I had to remove two flags to GCC

-maccumulate-outgoing-args -mno-red-zone

IN the block that starts with
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(CMAKE_EXE_EXPORTS_C_FLAG "")

The following Diff got me past it.

@@ -146,10 +146,11 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")

 if(TOOLCHAIN STREQUAL "GCC")
     SET(CMAKE_C_COMPILER gcc)
  •    ADD_COMPILE_OPTIONS(-std=c99 -g -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -fno-common -maccumulate-outgoing-args -mno-red-zone -Wno-address -fpie -fno-asynchronous-unwind-tables -flto -DUSING_LTO  -Wno-maybe-uninitialized -Wno-uninitialized  -Wno-builtin-declaration-mismatch -Wno-nonnull-compare)
    
  •    ADD_COMPILE_OPTIONS(-std=c99 -g -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -fno-common -Wno-address -fpie -fno-asynchronous-unwind-tables -flto -DUSING_LTO  -Wno-maybe-uninitialized -Wno-uninitialized  -Wno-builtin-declaration-mismatch -Wno-nonnull-compare)
       if(GCOV STREQUAL "ON")
           ADD_COMPILE_OPTIONS(--coverage -fprofile-arcs -ftest-coverage)
       endif()
    
  •   # add -maccumulate-outgoing-args -mno-red-zone for X86 
       SET(MBEDTLS_FLAGS "")
       SET(OPENSSL_FLAGS -include base.h -Wno-error=maybe-uninitialized -Wno-error=format -Wno-format -Wno-error=unused-but-set-variable)
       SET(CMOCKA_FLAGS -std=gnu99 -Wpedantic -Wall -Wshadow -Wmissing-prototypes -Wcast-align -Werror=address -Wstrict-prototypes -Werror=strict-prototypes -Wwrite-strings -Werror=write-strings -Werror-implicit-function-declaration -Wpointer-arith -Werror=pointer-arith -Wdeclaration-after-statement -Werror=declaration-after-statement -Wreturn-type -Werror=return-type -Wuninitialized -Werror=uninitialized -Werror=strict-overflow -Wstrict-overflow=2 -Wno-format-zero-length -Wmissing-field-initializers -Wformat-security -Werror=format-security -fno-common -Wformat -fno-common -fstack-protector-strong)
    

@admiyo
Copy link
Author

admiyo commented Dec 13, 2023

This is the Cache file that got it to run (minus the comments):

ARCH:STRING=aarch64

CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line

CMAKE_AR:FILEPATH=/usr/bin/ar

CMAKE_BUILD_TYPE:STRING=Debug

CMAKE_COLOR_MAKEFILE:BOOL=ON

CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc

CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar

CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib

CMAKE_C_FLAGS:STRING=

CMAKE_C_FLAGS_DEBUG:STRING=-g

CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG

CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG

CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG

CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND

CMAKE_EXE_LINKER_FLAGS:STRING=

CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=

CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=

CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=

CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=

CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF

CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=/root/SPDM-Responder-Validator/build/CMakeFiles/pkgRedirects

CMAKE_INSTALL_PREFIX:PATH=/usr/local

CMAKE_LINKER:FILEPATH=/usr/bin/ld

CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/gmake

CMAKE_MODULE_LINKER_FLAGS:STRING=

CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=

CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=

CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=

CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=

CMAKE_NM:FILEPATH=/usr/bin/nm

CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy

CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump

CMAKE_PROJECT_DESCRIPTION:STATIC=

CMAKE_PROJECT_HOMEPAGE_URL:STATIC=

CMAKE_PROJECT_NAME:STATIC=SPDM-Responder-Validator

CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib

CMAKE_READELF:FILEPATH=/usr/bin/readelf

CMAKE_SHARED_LINKER_FLAGS:STRING=

CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=

CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=

CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=

CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=

CMAKE_SKIP_INSTALL_RPATH:BOOL=OFF

CMAKE_SKIP_RPATH:BOOL=OFF

CMAKE_STATIC_LINKER_FLAGS:STRING=

CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=

CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=

CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=

CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=

CMAKE_STRIP:FILEPATH=/usr/bin/strip

CMAKE_TAPI:FILEPATH=CMAKE_TAPI-NOTFOUND

CMAKE_VERBOSE_MAKEFILE:BOOL=OFF

COMPILED_LIBCRYPTO_PATH:STRING=/lib64/libcrypto.so.3

COMPILED_LIBSSL_PATH:STRING=/lib64/libssl.so.3

CRYPTO:STRING=openssl

ENABLE_BINARY_BUILD:UNINITIALIZED=1

GCOV:STRING=

SPDM-Responder-Validator_BINARY_DIR:STATIC=/root/SPDM-Responder-Validator/build

SPDM-Responder-Validator_IS_TOP_LEVEL:STATIC=ON

SPDM-Responder-Validator_SOURCE_DIR:STATIC=/root/SPDM-Responder-Validator

TARGET:UNINITIALIZED=Debug

TOOLCHAIN:STRING=GCC

########################

INTERNAL cache entries

########################

CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1
CMAKE_AR-ADVANCED:INTERNAL=1
CMAKE_CACHEFILE_DIR:INTERNAL=/root/SPDM-Responder-Validator/build
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
CMAKE_CACHE_MINOR_VERSION:INTERNAL=27
CMAKE_CACHE_PATCH_VERSION:INTERNAL=7
CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1
CMAKE_COMMAND:INTERNAL=/usr/bin/cmake
CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack
CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest
CMAKE_C_COMPILER-ADVANCED:INTERNAL=1
CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1
CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1
CMAKE_C_FLAGS-ADVANCED:INTERNAL=1
CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1
CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
CMAKE_DLLTOOL-ADVANCED:INTERNAL=1
CMAKE_EDIT_COMMAND:INTERNAL=/usr/bin/cmake-gui
CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF
CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1
CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1
CMAKE_EXTRA_GENERATOR:INTERNAL=
CMAKE_GENERATOR:INTERNAL=Unix Makefiles
CMAKE_GENERATOR_INSTANCE:INTERNAL=
CMAKE_GENERATOR_PLATFORM:INTERNAL=
CMAKE_GENERATOR_TOOLSET:INTERNAL=
CMAKE_HOME_DIRECTORY:INTERNAL=/root/SPDM-Responder-Validator
CMAKE_INSTALL_SO_NO_EXE:INTERNAL=0
CMAKE_LINKER-ADVANCED:INTERNAL=1
CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1
CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
CMAKE_NM-ADVANCED:INTERNAL=1
CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=4
CMAKE_OBJCOPY-ADVANCED:INTERNAL=1
CMAKE_OBJDUMP-ADVANCED:INTERNAL=1
CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1
CMAKE_RANLIB-ADVANCED:INTERNAL=1
CMAKE_READELF-ADVANCED:INTERNAL=1
CMAKE_ROOT:INTERNAL=/usr/share/cmake
CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1
CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1
CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1
CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
CMAKE_STRIP-ADVANCED:INTERNAL=1
CMAKE_TAPI-ADVANCED:INTERNAL=1
CMAKE_UNAME:INTERNAL=/usr/bin/uname
CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1
_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED:INTERNAL=TRUE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants