cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5045
Views
10
Helpful
2
Replies

error: size of array ‘altStackMem’ is not an integral constant-express

hjensas
Level 1
Level 1

I get an error when trying to build core/ydk from source:

$ git clone https://github.com/CiscoDevNet/ydk-cpp.git

$ cd ydk-cpp

ydk-cpp]$ cd core/ydk

ydk]$ mkdir build && cd build

build]$ cmake ..
-- The C compiler identification is GNU 11.2.1
-- The CXX compiler identification is GNU 11.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found LibXml2: /usr/lib64/libxml2.so (found version "2.9.12")
Set libyang plugin installation directory to: lib/libyang
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rpmbuild/ydk-cpp/core/ydk/build

build]$ make

 

The error happens in tests, catch.hpp *size of array ‘altStackMem’ is not an integral constant-expression*:

[ 99%] Building CXX object tests/CMakeFiles/ydk_core_test.dir/main.cpp.o
In file included from /usr/include/signal.h:328,
                 from /home/rpmbuild/ydk-cpp/core/ydk/src/catch.hpp:6230,
                 from /home/rpmbuild/ydk-cpp/core/ydk/tests/main.cpp:5:
/home/rpmbuild/ydk-cpp/core/ydk/src/catch.hpp:6253:33: error: size of array ‘altStackMem’ is not an integral constant-expression
 6253 |         static char altStackMem[SIGSTKSZ];
      |                                 ^~~~~~~~
/home/rpmbuild/ydk-cpp/core/ydk/src/catch.hpp:6304:45: error: size of array ‘altStackMem’ is not an integral constant-expression
 6304 |     char FatalConditionHandler::altStackMem[SIGSTKSZ] = {};
      |                                             ^~~~~~~~
make[2]: *** [tests/CMakeFiles/ydk_core_test.dir/build.make:174: tests/CMakeFiles/ydk_core_test.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:288: tests/CMakeFiles/ydk_core_test.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

This issue was fixes in Fedora:

https://src.fedoraproject.org/rpms/catch1/c/059104ba87494c0b5ebe16844ec190f253e51cac?branch=rawhide

 

I was able to fix this by using catch from the distribution, instead of the one bundled with ydk-cpp - this is the patch:

From 2040dc047892965306870828d9952ec351bc488b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Harald=20Jens=C3=A5s?= <hjensas@redhat.com>
Date: Sat, 19 Feb 2022 06:59:19 +0100
Subject: [PATCH 1/1] Fix non-constant SIGSTKSZ

Use catch from the distribution instead of the local copy.
---
 core/ydk/tests/bgptest.cpp                  | 2 +-
 core/ydk/tests/core_test.cpp                | 2 +-
 core/ydk/tests/main.cpp.in                  | 2 +-
 core/ydk/tests/test_capabilities_parser.cpp | 2 +-
 core/ydk/tests/test_codec.cpp               | 2 +-
 core/ydk/tests/test_entity.cpp              | 2 +-
 core/ydk/tests/test_value.cpp               | 2 +-
 core/ydk/tests/test_value_list.cpp          | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)


diff --git a/core/ydk/tests/bgptest.cpp b/core/ydk/tests/bgptest.cpp
index 2889e365..256aec41 100644
--- a/core/ydk/tests/bgptest.cpp
+++ b/core/ydk/tests/bgptest.cpp
@@ -24,7 +24,7 @@
 #include <iostream>
 #include "../src/path_api.hpp"
 #include "config.hpp"
-#include "catch.hpp"
+#include <catch/catch.hpp>
 #include "mock_data.hpp"
 
 const char* m = "\
diff --git a/core/ydk/tests/core_test.cpp b/core/ydk/tests/core_test.cpp
index d5d18f72..11e3fa7d 100644
--- a/core/ydk/tests/core_test.cpp
+++ b/core/ydk/tests/core_test.cpp
@@ -26,7 +26,7 @@
 #include "../src/path_api.hpp"
 #include "../src/path/path_private.hpp"
 #include "config.hpp"
-#include "catch.hpp"
+#include <catch/catch.hpp>
 #include "common_utilities.hpp"
 
 TEST_CASE( "test_segmentalize"  )
diff --git a/core/ydk/tests/main.cpp.in b/core/ydk/tests/main.cpp.in
index 9230e719..ee65abb2 100644
--- a/core/ydk/tests/main.cpp.in
+++ b/core/ydk/tests/main.cpp.in
@@ -2,7 +2,7 @@
 #include <spdlog/spdlog.h>
 
 #define CATCH_CONFIG_RUNNER
-#include "catch.hpp"
+#include <catch/catch.hpp>
 
 const char* TEST_HOME = "@CMAKE_SOURCE_DIR@/tests/models";
 
diff --git a/core/ydk/tests/test_capabilities_parser.cpp b/core/ydk/tests/test_capabilities_parser.cpp
index 93322125..7c969fe0 100644
--- a/core/ydk/tests/test_capabilities_parser.cpp
+++ b/core/ydk/tests/test_capabilities_parser.cpp
@@ -29,7 +29,7 @@
 #include "../src/ietf_parser.hpp"
 #include "../src/path_api.hpp"
 #include "../src/opendaylight_parser.hpp"
-#include "catch.hpp"
+#include <catch/catch.hpp>
 
 using namespace ydk;
 using namespace std;
diff --git a/core/ydk/tests/test_codec.cpp b/core/ydk/tests/test_codec.cpp
index 733d786f..f2ca624d 100644
--- a/core/ydk/tests/test_codec.cpp
+++ b/core/ydk/tests/test_codec.cpp
@@ -27,7 +27,7 @@
 
 #include <iostream>
 
-#include "catch.hpp"
+#include <catch/catch.hpp>
 #include "config.hpp"
 #include "mock_data.hpp"
 
diff --git a/core/ydk/tests/test_entity.cpp b/core/ydk/tests/test_entity.cpp
index 08baf76f..a41d7eb1 100644
--- a/core/ydk/tests/test_entity.cpp
+++ b/core/ydk/tests/test_entity.cpp
@@ -27,7 +27,7 @@
 
 #include "../src/types.hpp"
 #include "../src/entity_util.hpp"
-#include "catch.hpp"
+#include <catch/catch.hpp>
 #include <iostream>
 
 using namespace ydk;
diff --git a/core/ydk/tests/test_value.cpp b/core/ydk/tests/test_value.cpp
index 3bb03f32..ea78e905 100644
--- a/core/ydk/tests/test_value.cpp
+++ b/core/ydk/tests/test_value.cpp
@@ -1,6 +1,6 @@
 #include "../src/types.hpp"
 #include "../src/errors.hpp"
-#include "catch.hpp"
+#include <catch/catch.hpp>
 #include <spdlog/spdlog.h>
 
 #include <iostream>
diff --git a/core/ydk/tests/test_value_list.cpp b/core/ydk/tests/test_value_list.cpp
index 2648d804..db7e13d4 100644
--- a/core/ydk/tests/test_value_list.cpp
+++ b/core/ydk/tests/test_value_list.cpp
@@ -1,7 +1,7 @@
 
 #include "../src/types.hpp"
 #include "../src/errors.hpp"
-#include "catch.hpp"
+#include <catch/catch.hpp>
 #include <iostream>
 
 using namespace ydk;
-- 
2.35.1
2 Replies 2

ygorelik
Cisco Employee
Cisco Employee

Could you please describe your platform, I mean Linux distribution, version etc.

Thanks,

Yan 

Hi Yan,

 

I am running Fedora release 35 (Thirty Five), I understand from the readme on https://github.com/CiscoDevNet/ydk-cpp that this is potentially not a supported release. I tried using the RPM package from Cisco artifactory (libydk-0.8.5-1.x86_64.rpm) but this did not work, so I went down the route of creating my own RPM spec file to get the core library compiled and linked against the system libraries.

 

Below is some information from the system, kernel version and package versions for the dependencies listed here https://github.com/CiscoDevNet/ydk-cpp#centos-7x-fedora-based 

$ uname -a
Linux hypervisor.lab.example.com 5.16.8-200.fc35.x86_64 #1 SMP PREEMPT Tue Feb 8 20:58:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

$ rpm -q catch1-devel catch1-devel-1.12.2-9.fc35.x86_64

$ rpm -q libxml2-devel libxslt-devel libssh-devel libtool gcc-c++ pcre-devel cmake python3-devel
libxml2-devel-2.9.12-6.fc35.x86_64
libxslt-devel-1.1.34-6.fc35.x86_64
libssh-devel-0.9.6-1.fc35.x86_64
libtool-2.4.6-42.fc35.x86_64
gcc-c++-11.2.1-9.fc35.x86_64
pcre-devel-8.45-1.fc35.x86_64
cmake-3.22.2-1.fc35.x86_64
python3-devel-3.10.2-1.fc35.x86_64

 

Another thing I notice while building an RPM package for Fedora 35 is that libydk is statically linked. Is there a reason for this?

Static libraries should be packaged in a separate -static package, and is discouraged in packaging guidelines, see: https://docs.fedoraproject.org/en-US/packaging-guidelines/#packaging-static-libraries.

 

I decided to put a patch in my RPM for this as well. I guess I'll find out if this cause problems later ...

From a7d4c5d85e7357001ca026668585290c5342a657 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Harald=20Jens=C3=A5s?= <hjensas@redhat.com>
Date: Mon, 21 Feb 2022 15:40:40 +0100
Subject: [PATCH 1/1] Build libydk as shared instead of static

---
 core/ydk/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/ydk/CMakeLists.txt b/core/ydk/CMakeLists.txt
index 51ee415c..785ea114 100644
--- a/core/ydk/CMakeLists.txt
+++ b/core/ydk/CMakeLists.txt
@@ -450,7 +450,7 @@ include_directories(
 
 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 
-add_library(ydk STATIC ${libydk_src} ${libnetconf_inc_objs} ${libyang_inc_objs})
+add_library(ydk SHARED ${libydk_src} ${libnetconf_inc_objs} ${libyang_inc_objs})
 
 target_link_libraries(ydk
     ${LIBXML2_LIBRARIES}
-- 
2.35.1

 

Best Regards,

Harald