EVerest / everest-demo

EVerest demo: Dockerized demo with software in the loop simulation
Apache License 2.0
16 stars 21 forks source link

Build and run custom version of EVerest on the uMWC #51

Closed shankari closed 1 month ago

shankari commented 6 months ago

The EVerest project has open hardware as well https://everest.github.io/nightly/hardware/pionix_belay_box.html which is available as a kit from Pionix. Pionix also sells the uMWC (https://shop.pionix.com/products/umwc-micro-mega-watt-charger). This is is a non-open device in a housing that shares some hardware with the Belay Box although it has a different power module that is limited to 1W output.

In this issue, we will track the steps to run a custom build of EVerest on the uMWC so that we can perform HIL testing.

@faizanmir21 The instructions are here: https://everest.github.io/nightly/hardware/pionix_belay_box.html#developing-with-everest-and-belaybox

They are for the Belay Box, but I'm hoping that they will apply to the uMWC as well. If not, we can ask the community for help.

My suggested steps are:

  1. check everest-dev.service and verify that it starts the dev build from /mnt/user_data/opt/everest
  2. Install a dev build from the latest stable release (2024.3.0) https://github.com/EVerest/everest-core/releases/tag/2024.3.0
    • We already have everest builds in the docker containers. So you can run the manager docker container and use it as the base to cross-compile. To get a shell, you can use:
    • one of the demo scripts and then docker exec -it ....manager /bin/bash OR
    • docker run -it ghcr.io/everest/everest-demo/manager:0.0.16 /bin/bash
  3. Then rsync it over and try to boot up!

@drmrd @couryrr-afs @wjmp for visibility

faizanmir21 commented 6 months ago

Connection refused while compiling the environment. See below.

Screenshot 2024-06-03 at 5 07 26 PM
faizanmir21 commented 6 months ago

I think it was getting blocked by the NREL firewall. Was able to access using the hotspot network.

louisg1337 commented 5 months ago

I am currently on the third step on the Pionix guide where you have to run the cmake commands, and I am getting this error:

cb57bb2cbe6f:/ext/source# cmake \
 -DCMAKE_TOOLCHAIN_FILE=../../bullseye-toolchain/toolchain.cmake \
 -DCMAKE_INSTALL_PREFIX=/mnt/user_data/opt/everest \
 -S . -B build-cross
-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /bullseye-toolchain/crosstool/bin/armv8-rpi4-linux-gnueabihf-g++
-- Check for working CXX compiler: /bullseye-toolchain/crosstool/bin/armv8-rpi4-linux-gnueabihf-g++ - broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:62 (message):
  The C++ compiler

    "/bullseye-toolchain/crosstool/bin/armv8-rpi4-linux-gnueabihf-g++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /ext/source/build-cross/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/make -f Makefile cmTC_f7171/fast && /usr/bin/make  -f CMakeFiles/cmTC_f7171.dir/build.make CMakeFiles/cmTC_f7171.dir/build
    make[1]: Entering directory '/ext/source/build-cross/CMakeFiles/CMakeTmp'
    Building CXX object CMakeFiles/cmTC_f7171.dir/testCXXCompiler.cxx.o
    /bullseye-toolchain/crosstool/bin/armv8-rpi4-linux-gnueabihf-g++ -D__ARM_ARCH_8__ -D__arm__  -Wno-psabi  -o CMakeFiles/cmTC_f7171.dir/testCXXCompiler.cxx.o -c /ext/source/build-cross/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    make[1]: /bullseye-toolchain/crosstool/bin/armv8-rpi4-linux-gnueabihf-g++: No such file or directory
    make[1]: *** [CMakeFiles/cmTC_f7171.dir/build.make:78: CMakeFiles/cmTC_f7171.dir/testCXXCompiler.cxx.o] Error 127
    make[1]: Leaving directory '/ext/source/build-cross/CMakeFiles/CMakeTmp'
    make: *** [Makefile:127: cmTC_f7171/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)

-- Configuring incomplete, errors occurred!
See also "/ext/source/build-cross/CMakeFiles/CMakeOutput.log".
See also "/ext/source/build-cross/CMakeFiles/CMakeError.log".

It seems like something is wrong with bullseye, but when I ran the commands to install and untar it, it looked normal and didn't give me any errors.

cb57bb2cbe6f:/# wget http://build.pionix.de:8888/release/toolchains/bullseye-toolchain.tgz
Connecting to build.pionix.de:8888 (35.242.226.179:8888)
saving to 'bullseye-toolchain.tgz'
bullseye-toolchain.t 100% |**********************************************************************************************************************************************************************************************|  606M  0:00:00 ETA
'bullseye-toolchain.tgz' saved
cb57bb2cbe6f:/# ls
=0.10.9.5               =3.7.4                  bin                     etc                     media                   root                    sys                     workspace
=0.11.0                 =5.9.1                  bullseye-toolchain.tgz  ext                     mnt                     run                     tmp
=2.8.2                  =9.5.0                  dev                     home                    opt                     sbin                    usr
=3.4.6                  assets                  entrypoint.sh           lib                     proc                    srv                     var
cb57bb2cbe6f:/# tar xfz bullseye-toolchain.tgz 

To get here, I did docker exec into the everest-ac-demo-manager-1, which was built using our one line demos in the latest branch of everest-demo.

shankari commented 5 months ago

this is the same error that Faizan got. When you untar the toolchain, what directory does it create? Maybe you have to untar it in a different way or move it around or sth. you need to show that you have a /bullseye-toolchain/crosstool/bin directory.

louisg1337 commented 5 months ago

When I untar the toolchain it creates a directory called bullseye-toolchain the same place that I downloaded the bullseye-toolchain.tgz file. Going off of this error:

make[1]: /bullseye-toolchain/crosstool/bin/armv8-rpi4-linux-gnueabihf-g++: No such file or directory

It is weird because I do have a /bullseye-toolchain/crosstool/bin directory, and I have the armv8-rpi4-linux-gnueabihf-g++ file within it.

cb57bb2cbe6f:/# ls
=0.10.9.5               =3.7.4                  bin                     entrypoint.sh           lib                     proc                    srv                     var
=0.11.0                 =5.9.1                  bullseye-toolchain      etc                     media                   root                    sys                     workspace
=2.8.2                  =9.5.0                  bullseye-toolchain.tgz  ext                     mnt                     run                     tmp
=3.4.6                  assets                  dev                     home                    opt                     sbin                    usr
cb57bb2cbe6f:/# cd bullseye-toolchain/crosstool/bin/
cb57bb2cbe6f:/bullseye-toolchain/crosstool/bin# ls
armv8-rpi4-linux-gnueabihf-addr2line      armv8-rpi4-linux-gnueabihf-dwp            armv8-rpi4-linux-gnueabihf-gcov           armv8-rpi4-linux-gnueabihf-ld.gold        armv8-rpi4-linux-gnueabihf-readelf
armv8-rpi4-linux-gnueabihf-ar             armv8-rpi4-linux-gnueabihf-elfedit        armv8-rpi4-linux-gnueabihf-gcov-dump      armv8-rpi4-linux-gnueabihf-ldd            armv8-rpi4-linux-gnueabihf-size
armv8-rpi4-linux-gnueabihf-as             armv8-rpi4-linux-gnueabihf-g++            armv8-rpi4-linux-gnueabihf-gcov-tool      armv8-rpi4-linux-gnueabihf-lto-dump       armv8-rpi4-linux-gnueabihf-strings
armv8-rpi4-linux-gnueabihf-c++            armv8-rpi4-linux-gnueabihf-gcc            armv8-rpi4-linux-gnueabihf-gdb            armv8-rpi4-linux-gnueabihf-nm             armv8-rpi4-linux-gnueabihf-strip
armv8-rpi4-linux-gnueabihf-c++filt        armv8-rpi4-linux-gnueabihf-gcc-10.3.0     armv8-rpi4-linux-gnueabihf-gdb-add-index  armv8-rpi4-linux-gnueabihf-objcopy
armv8-rpi4-linux-gnueabihf-cc             armv8-rpi4-linux-gnueabihf-gcc-ar         armv8-rpi4-linux-gnueabihf-gprof          armv8-rpi4-linux-gnueabihf-objdump
armv8-rpi4-linux-gnueabihf-cpp            armv8-rpi4-linux-gnueabihf-gcc-nm         armv8-rpi4-linux-gnueabihf-ld             armv8-rpi4-linux-gnueabihf-populate
armv8-rpi4-linux-gnueabihf-ct-ng.config   armv8-rpi4-linux-gnueabihf-gcc-ranlib     armv8-rpi4-linux-gnueabihf-ld.bfd         armv8-rpi4-linux-gnueabihf-ranlib
cb57bb2cbe6f:/bullseye-toolchain/crosstool/bin# 

Any ideas on where I would move it or where I should untar it instead?

louisg1337 commented 5 months ago

I think that this may be our issue, I'm figuring out how to install this dependency right now to see if that fixes it.

cb57bb2cbe6f:/# ldd /bullseye-toolchain/crosstool/bin/armv8-rpi4-linux-gnueabihf-g++
    /lib64/ld-linux-x86-64.so.2 (0x7f44e57a8000)
    libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f44e57a8000)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /bullseye-toolchain/crosstool/bin/armv8-rpi4-linux-gnueabihf-g++)
louisg1337 commented 5 months ago

I don't know a lot about Linux, so please correct me if I'm wrong, but it seems like the issue we are experiencing is because I am trying to use Alpine Linux (via the docker container) instead of Ubuntu. Apparently Alpine uses musl as its C library, which doesn't have the package above, while Ubuntu uses glibc, which does have the package.

In the Alpine Linux wiki, they have a way to run glibc binaries on Alpine, which is by installing gcompat via apk add gcompat. After that, the cmake command seemed to work successfully.

shankari commented 5 months ago

Perfect! Unfortunately, we bricked the uMWC while experimenting today so I can't test this until I get some new firmware. But maybe you can zip up the directory that we are supposed to copy over using rsync and upload it to someplace internal to NREL? I can then pull it and install it once everything is working again.

We will need to repeat this once the docker image with the setChargingProfile is ready

louisg1337 commented 5 months ago

Unfortunately I've hit another roadblock, instead this time with the final make build commands. When I run the command, the build gets to about 60-65% done before it substantially slows down, and eventually stops making progress. I don't get any errors either, it kind of just freezes. I've ran this build command a few times, and it has always happened like this. Heres an example of what I've been stuck on for the past 10 ish minutes.

...
[ 64%] Building C object _deps/ext-mbedtls-build/library/CMakeFiles/mbedtls.dir/ssl_ticket.c.o
make[2]: Leaving directory '/ext/source/build-cross'
make[2]: Entering directory '/ext/source/build-cross'
[ 64%] Building CXX object modules/CMakeFiles/API.dir/API/API.cpp.o
[ 64%] Building C object _deps/ext-mbedtls-build/library/CMakeFiles/mbedtls.dir/ssl_tls.c.o
[ 64%] Building C object _deps/ext-mbedtls-build/library/CMakeFiles/mbedtls.dir/ssl_tls13_keys.c.o
[ 64%] Linking C static library libmbedtls.a
make[2]: Leaving directory '/ext/source/build-cross'
[ 64%] Built target mbedtls
make[2]: Entering directory '/ext/source/build-cross'
make[2]: Leaving directory '/ext/source/build-cross'
make[2]: Entering directory '/ext/source/build-cross'
[ 64%] Building CXX object modules/Auth/lib/CMakeFiles/auth_handler.dir/AuthHandler.cpp.o
[ 64%] Linking CXX executable controller
make[2]: Leaving directory '/ext/source/build-cross'
[ 64%] Built target controller
make[2]: Entering directory '/ext/source/build-cross'
make[2]: Leaving directory '/ext/source/build-cross'
make[2]: Entering directory '/ext/source/build-cross'
[ 64%] Building CXX object modules/CMakeFiles/EnergyManager.dir/EnergyManager/EnergyManager.cpp.o

I figured it may be because the docker container doesn't have enough resources, but I'm decently below my max utilization for everything. I'll keep working on this and see if I can get this to work.

shankari commented 5 months ago

It might just be slow. There is a reason that "compile the Linux kernel" used to be the standard workload for performance testing in the old system papers.

Bump up the resources anyway just to be on the safe side and then just wait for 30mins or so

louisg1337 commented 5 months ago

I tried bumping all the resources to 75% of what my computer can handle (12 gb RAM, 6 cores, 3 gb swap) and it still is stuck in the low 60s. I left it for about a hour and it doesn't seem to be making any progress past that. I did get an error now, however, although it seems a bit unhelpful. Here are the logs:

...
[ 53%] Built target slac_fsm_ev
[ 53%] Building CXX object _deps/everest-framework-build/lib/CMakeFiles/framework.dir/everest.cpp.o
[ 53%] Building CXX object _deps/everest-framework-build/lib/CMakeFiles/framework.dir/runtime.cpp.o
[ 53%] Built target slac_fsm_evse
[ 60%] Built target websockets_shared
[ 60%] Building CXX object _deps/everest-framework-build/lib/CMakeFiles/framework.dir/yaml_loader.cpp.o
make[2]: Entering directory '/ext/source/build-cross'
make[2]: Entering directory '/ext/source/build-cross'
make[2]: Leaving directory '/ext/source/build-cross'
[ 61%] Built target controller
Consolidate compiler generated dependencies of target ocpp
make[2]: Leaving directory '/ext/source/build-cross'
make[2]: Entering directory '/ext/source/build-cross'
[ 61%] Building CXX object _deps/libocpp-build/lib/CMakeFiles/ocpp.dir/ocpp/v16/charge_point.cpp.o
[ 61%] Building CXX object _deps/libocpp-build/lib/CMakeFiles/ocpp.dir/ocpp/v16/smart_charging.cpp.o
armv8-rpi4-linux-gnueabihf-g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [_deps/everest-framework-build/lib/CMakeFiles/framework.dir/build.make:328: _deps/everest-framework-build/lib/CMakeFiles/framework.dir/runtime.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 61%] Building CXX object _deps/libocpp-build/lib/CMakeFiles/ocpp.dir/ocpp/v16/charge_point_configuration.cpp.o
[ 61%] Building CXX object _deps/libocpp-build/lib/CMakeFiles/ocpp.dir/ocpp/v16/charge_point_state_machine.cpp.o
louisg1337 commented 5 months ago

I read somewhere online that the armv8-rpi4-linux-gnueabihf-g++: fatal error: Killed signal terminated program cc1plus error is usually do to lack of memory, so I dug a bit deeper into whether or not the container itself was getting all the resources I allocated. I then realized that in docker-compose.ocpp201.yml there was a 1 core limit on the CPU and 1 gb limit for the ram. I then bumped it up to 6 cores and 10 gb of ram and it finally built. The container consistently used around 5 cores and the ram fluctuated between 2-6 gb, so the boost was definitely needed. I'll write up a nice guide under this post so that in the future the steps to build using Docker are outlined.

louisg1337 commented 5 months ago

Building EVerest Using Docker

The cross compiling steps are outlined here, in the EVerest docs. You are required to have EVerest built natively, which means you need a Linux machine, and the rest of the commands are Linux based as well. We can circumvent this hardware requirement by doing this build process on a docker container which 1) has EVerest built on it, and 2) runs Linux Alpine. Thankfully, we have one line demos which builds EVerest to these containers for us. Below is a complete walkthrough of the steps I took to utilize Docker to build for hardware.

Steps

  1. Increase Docker resources through the settings.
    • When I was building my cpu usage was between 5-6 cores, and my memory fluctuated between 2-6gb. So, ideally set cores = 6 and memory = 6 gb.
  2. Change the CPU and memory limit in everest-demo/.env found here.
    • These limits prevent everest-ac-demo-manager-1, the docker container we will be working in, from utilizing all the resources we allocated.
    • Recommended Steps
      1. Clone everest-demo to your machine.
      2. Navigate to .env and change EVEREST_MANAGER_CPUS and EVEREST_MANAGER_MEMORYto 1 below the maximum values set in Step 1.
  3. Run one of the one line demos to build EVerest in Docker.
    • Recommended Steps Continued (assuming the steps above were followed)
      1. Navigate to demo-iso15118-2-ac-plus-ocpp.sh and change git clone --branch "${DEMO_BRANCH}" "${DEMO_REPO}" everest-demo to cp -r "${DEMO_REPO}" everest-demo
      2. Now run bash demo-iso15118-2-ac-plus-ocpp.sh -r $(pwd) -3
      3. Wait until Docker shows all containers in everest-ac-demo running.
      4. Enter the everest-ac-demo-manager-1 container via docker exec -it <container_id> /bin/bash.
      5. Run apk add gcompat
      6. The next steps follow the EVerest docs for cross compiling.
        • Here are the tailored steps for documentation purposes.
      7. cd .. to navigate to the / directory.
      8. wget http://build.pionix.de:8888/release/toolchains/bullseye-toolchain.tgz
        tar xfz bullseye-toolchain.tgz
      9. cd ext/source
      10.  cmake \
         -DCMAKE_TOOLCHAIN_FILE=../../bullseye-toolchain/toolchain.cmake \
         -DCMAKE_INSTALL_PREFIX=/mnt/user_data/opt/everest \
         -S . -B build-cross
        1. make -j$(nproc) -C build-cross
          make -j$(nproc) DESTDIR=./dist -C build-cross install
  4. Once built, get the cross compiled build out of docker
    • This is how I did it docker cp <container_id>:/ext/source/build-cross ~/Desktop
shankari commented 5 months ago

Affer switching to the custom build that includes smart charging, ran into this error

CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR: Found unsuitable version "1.1.1n", but
  required is at least "3" (found
  /bullseye-toolchain/sysroot/usr/lib/arm-linux-gnueabihf/libcrypto.so, )
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:592 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindOpenSSL.cmake:599 (find_package_handle_standard_args)
  build-cross/_deps/libevse-security-src/CMakeLists.txt:46 (find_package)

This was caused by https://github.com/EVerest/libevse-security/commit/8777cc2079f9529a3975395d9259e5d2cbf1fc5a

Double-checked the uMWC, and found

/usr/lib/arm-linux-gnueabihf/libcrypt
libcrypt.a               libcryptsetup.so.12      libcrypt.so              libcrypt.so.1.1.0
libcrypto.so.1.1         libcryptsetup.so.12.6.0  libcrypt.so.1

So we will have to revert the libevse change. Let's try only removing that dependency and see if it works.

EDIT: Removed dependency in build-cross/_deps/libocpp-src/CMakeLists.txt and in /ext/source/build-cross/_deps/libevse-security-src/CMakeLists.txt (wait those are the same, so why didn't it work the first time?) It has moved forward now...

EDIT: cmake completed successfully, starting build...

shankari commented 5 months ago

Build failed with

/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:544:21: error: 'X509_ADD_FLAG_NO_DUP' was not declared in this scope; did you mean 'X509_FLAG_NO_AUX'?
  544 |         int flags = X509_ADD_FLAG_NO_DUP | X509_ADD_FLAG_NO_SS;
      |                     ^~~~~~~~~~~~~~~~~~~~
      |                     X509_FLAG_NO_AUX
make[2]: Leaving directory '/ext/source/build-cross'
make[2]: Entering directory '/ext/source/build-cross'
[ 61%] Building CXX object _deps/libmodbus-build/CMakeFiles/modbus.dir/src/modbus_client.cpp.o
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:544:44: error: 'X509_ADD_FLAG_NO_SS' was not declared in this scope; did you mean 'X509_FLAG_NO_IDS'?
  544 |         int flags = X509_ADD_FLAG_NO_DUP | X509_ADD_FLAG_NO_SS;
      |                                            ^~~~~~~~~~~~~~~~~~~
      |                                            X509_FLAG_NO_IDS
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:547:22: error: 'X509_add_cert' was not declared in this scope; did you mean 'X509_add_ext'?
  547 |             if (1 != X509_add_cert(untrusted.get(), get(untrusted_cert), flags)) {
      |                      ^~~~~~~~~~~~~
      |                      X509_add_ext

Replaced all the text in /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp with the version before the latest changes: https://github.com/EVerest/libevse-security/blob/34ced9f4452c2ffe3145f4ff200c42dc83278c47/lib/evse_security/crypto/openssl/openssl_supplier.cpp

Ran into issues with

/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:188:9: error: 'EC_KEY_ptr' was not declared in this scope; did you mean 'EVP_PKEY_ptr'?
  188 |         EC_KEY_ptr ec_key(EC_KEY_new_by_curve_name(nid));

/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:211:9: error: 'RSA_ptr' was not declared in this scope
  211 |         RSA_ptr rsa_key(RSA_generate_key(bits, RSA_PRIME, nullptr, nullptr));
      |         ^~~~~~~

/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp: In static member function 'static evse_security::CertificateValidationResult evse_security::OpenSSLSupplier::x509_verify_certificate_chain(evse_security::X509Handle*, const std::vector<evse_security::X509Handle*>&, const std::vector<evse_security::X509Handle*>&, bool, std::optional<std::filesystem::__cxx11::path>, std::optional<std::filesystem::__cxx11::path>)':
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:544:21: error: 'X509_ADD_FLAG_NO_DUP' was not declared in this scope; did you mean 'X509_FLAG_NO_AUX'?
  544 |         int flags = X509_ADD_FLAG_NO_DUP | X509_ADD_FLAG_NO_SS;
      |                     ^~~~~~~~~~~~~~~~~~~~
      |                     X509_FLAG_NO_AUX
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:544:44: error: 'X509_ADD_FLAG_NO_SS' was not declared in this scope; did you mean 'X509_FLAG_NO_IDS'?
  544 |         int flags = X509_ADD_FLAG_NO_DUP | X509_ADD_FLAG_NO_SS;
      |                                            ^~~~~~~~~~~~~~~~~~~
      |                                            X509_FLAG_NO_IDS
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:547:22: error: 'X509_add_cert' was not declared in this scope; did you mean 'X509_add_ext'?
  547 |             if (1 != X509_add_cert(untrusted.get(), get(untrusted_cert), flags)) {
      |                      ^~~~~~~~~~~~~
      |                      X509_add_ext

Copied over deleted code. There are still failures. Trying to just revert the dependency and rebuild. This was only changed 2 weeks ago, and computers are faster than me.

shankari commented 5 months ago

Reverted back to version 0.6.0, OCPP compile is failing with

[ 84%] Building CXX object _deps/libocpp-build/lib/CMakeFiles/ocpp.dir/ocpp/common/types.cpp.o
In file included from /ext/source/lib/staging/evse_security/conversions.cpp:6:
/ext/source/lib/staging/evse_security/../evse_security/conversions.hpp:27:16: error: 'CertificateInfo' in namespace 'evse_security' does not name a type; did you mean 'CertificateType'?
   27 | evse_security::CertificateInfo from_everest(types::evse_security::CertificateInfo other);
      |                ^~~~~~~~~~~~~~~
      |                CertificateType

Trying to revert to the commit just before this change.

EDIT: Setting the git_tag to 4330ce2e28e25535dd01558edb2331891c146769 built! Now, let's try to cross-compile again. Will check with SIL before pushing out to the uMWC...

shankari commented 5 months ago

Now it is required in libocpp

CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR: Found unsuitable version "1.1.1n", but
  required is at least "3" (found
  /bullseye-toolchain/sysroot/usr/lib/arm-linux-gnueabihf/libcrypto.so, )
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:592 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindOpenSSL.cmake:599 (find_package_handle_standard_args)
  build-cross/_deps/libocpp-src/CMakeLists.txt:28 (find_package)

Not easy to roll this back, so let's just try to edit and assume that the dependencies are not too bad.

shankari commented 5 months ago

Broke in the same way

/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp: In static member function 'static evse_security::CertificateValidationResult evse_security::OpenSSLSupplier::x509_verify_certificate_chain(evse_security::X509Handle*, const std::vector<evse_security::X509Handle*>&, const std::vector<evse_security::X509Handle*>&, bool, std::optional<std::filesystem::__cxx11::path>, std::optional<std::filesystem::__cxx11::path>)':
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:599:21: error: 'X509_ADD_FLAG_NO_DUP' was not declared in this scope; did you mean 'X509_FLAG_NO_AUX'?
  599 |         int flags = X509_ADD_FLAG_NO_DUP | X509_ADD_FLAG_NO_SS;
      |                     ^~~~~~~~~~~~~~~~~~~~
      |                     X509_FLAG_NO_AUX
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:599:44: error: 'X509_ADD_FLAG_NO_SS' was not declared in this scope; did you mean 'X509_FLAG_NO_IDS'?
  599 |         int flags = X509_ADD_FLAG_NO_DUP | X509_ADD_FLAG_NO_SS;
      |                                            ^~~~~~~~~~~~~~~~~~~
      |                                            X509_FLAG_NO_IDS
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:602:22: error: 'X509_add_cert' was not declared in this scope; did you mean 'X509_add_ext'?
  602 |             if (1 != X509_add_cert(untrusted.get(), get(untrusted_cert), flags)) {
      |                      ^~~~~~~~~~~~~
      |                      X509_add_ext

I guess the interim changes are not known to work. Off to check the openssl code...

shankari commented 5 months ago

ok so verified that these are from SSL 3 https://man.archlinux.org/man/X509_add_cert.3ssl.en But the OpenSSL docs have a slightly different method name https://www.openssl.org/docs/man1.1.1/man3/X509_STORE_add_cert.html which has been unchanged since version 1.

And grepping seems to find the old value as well. Did this ever work? When was it added? /bullseye-toolchain/sysroot/var/lib/dpkg/info/libssl1.1:armhf.symbols: X509_STORE_add_cert@OPENSSL_1_1_0 1.1.0

There are no symbols for X509_ADD_FLAG_NO_DUP and X509_ADD_FLAG_NO_SS It was added in https://github.com/EVerest/libevse-security/commit/acc12fe5353d8090fc8cb0a84564b52ad7301e51 which is good for PKI but is not needed for our demo. Reverting to the version before that for just this location: https://github.com/EVerest/libevse-security/commit/acc12fe5353d8090fc8cb0a84564b52ad7301e51#diff-9b5e7ace83962c09e4fd78bac64e78b58816ec321a0ef6ecf90c97493d1ff6c6R593

Having said that, I do see a X509_STORE_add_cert(store_ptr.get(), get(parents[i])); but this is if (1 != X509_add_cert(untrusted.get(), get(untrusted_cert), flags)) {....

shankari commented 5 months ago

Final issue: it looks like openssl cleaned up their code by adding consts and plumbing them through. So the calling code has consts but the function does not.

/ext/source/build-cross/_deps/libocpp-src/lib/ocpp/common/websocket/websocket_libwebsockets.cpp:175:61: error: invalid conversion from 'const X509_STORE_CTX*' {aka 'const x509_store_ctx_st*'} to 'X509_STORE_CTX*' {aka 'x509_store_ctx_st*'} [-fpermissive]
  175 |         X509* server_cert = X509_STORE_CTX_get_current_cert(ctx);
      |                                                             ^~~
      |                                                             |
      |                                                             const X509_STORE_CTX* {aka const x509_store_ctx_st*}

I am making the assumption that the underlying implementation has not changed significantly, so we just need to un constify it. I did consider removing the const, but it is passed in as an argument, so we would need to go through and remove all the call sites and potentially their call sites and so on, which will make this very complex.

I can create a new struct fairly easily, but copying over the fields is complicated. And some of them are functions. https://docs.huihoo.com/doxygen/openssl/1.0.1c/structx509__store__ctx__st.html

So I just use memcpy to copy over all the pointers. If the underlying functions are not actually const, this will be bad, but see assumption above.

        X509_STORE_CTX* non_const_ctx = X509_STORE_CTX_new();
        memcpy(non_const_ctx, ctx, sizeof(ctx)); // args are (dest, src, size)
        X509* server_cert = X509_STORE_CTX_get_current_cert(non_const_ctx);

This code, copied three times, lets the compile succeed!

shankari commented 5 months ago

Verified that there is also a firmware file and only one firmware file

./dist/mnt/user_data/opt/everest/share/everest/modules/YetiDriver/firmware/yetiR1_2.1_firmware.bin

which is built here

./modules/YetiDriver/cmake_install.cmake:  file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/share/everest/modules/YetiDriver/firmware" TYPE FILE FILES "/ext/source/modules/YetiDriver/yetiR1_2.1_firmware.bin")

Double-checked and the instructions from Pionix say that it should be in the "/libexec/everest/modules/YetiDriver", which is not the same, but at least it is in the YetiDriver directory. Just to be on the safe side, I will first backport the changes and check in the SIL before pushing it to EVerest, and will update EVerest without flashing the firmware first (learned my lesson last time!)

shankari commented 5 months ago

edited /ext/cache/cpm/libevse-security/f4c722882414e8cb77a2f572b45fde98e2647f8d/libevse-security/lib/evse_security/crypto/openssl/openssl_supplier.cpp and /ext/cache/cpm/libocpp/6502037f667273b3f55e917ec94a3fe0a2d27720/libocpp/lib/ocpp/common/websocket/websocket_libwebsockets.cpp

Recompiled. But I can't kill the existing process! Need to pull all the patches and recompile to restart the new version.

shankari commented 5 months ago

SIL fails

2024-06-14 01:05:31.810823 [INFO] ocpp:OCPP201     :: Loading CA csms bundle to verify server certificate: /ext/source/build/dist/etc/everest/certs/ca/v2g/V2G_ROOT_CA.pem
2024-06-14 01:05:31.851814 [INFO] ocpp:OCPP201     :: LWS connect with info port: [443] address: [host.docker.internal] path: [/ws/cp001] protocol: [ocpp2.0.1]
2024-06-14 01:05:31.851958 [DEBG] ocpp:OCPP201    int ocpp::WebsocketTlsTPM::process_callback(void*, int, void*, void*, size_t) :: Callback with unhandled reason: 85
2024-06-14 01:05:31.852062 [DEBG] ocpp:OCPP201    int ocpp::WebsocketTlsTPM::process_callback(void*, int, void*, void*, size_t) :: Client connecting...
2024-06-14 01:05:31.852196 [DEBG] ocpp:OCPP201    void ocpp::WebsocketTlsTPM::client_loop() :: Init client loop with ID: 7f35cdd71b38
2024-06-14 01:05:31.853606 [DEBG] ocpp:OCPP201    int ocpp::WebsocketTlsTPM::process_callback(void*, int, void*, void*, size_t) :: Callback with unhandled reason: 29
2024-06-14 01:05:31.858875 [DEBG] ocpp:OCPP201    int ocpp::WebsocketTlsTPM::process_callback(void*, int, void*, void*, size_t) :: Verifying server certs!
2024-06-14 01:05:31.900821 [CRIT] manager         int boot(const boost::program_options::variables_map&) :: Module ocpp (pid: 4010) exited with status: 11. Terminating all modules.

Trying SP2 and then SP1 as backup

shankari commented 5 months ago
SP2 got the same error ``` 2024-06-14 01:09:16.578069 [DEBG] ocpp:OCPP201 Everest::Everest::subscribe_var(const Requirement&, const std::string&, const JsonCallback&):: :: Incoming evse_manager_1:EvseManager->evse:evse_manager->session_event 2024-06-14 01:09:16.619116 [INFO] ocpp:OCPP201 :: LWS connect with info port: [443] address: [host.docker.internal] path: [/ws/cp001] protocol: [ocpp2.0.1] 2024-06-14 01:09:16.619264 [DEBG] ocpp:OCPP201 int ocpp::WebsocketTlsTPM::process_callback(void*, int, void*, void*, size_t) :: Callback with unhandled reason: 85 2024-06-14 01:09:16.619409 [DEBG] ocpp:OCPP201 int ocpp::WebsocketTlsTPM::process_callback(void*, int, void*, void*, size_t) :: Client connecting... 2024-06-14 01:09:16.619647 [DEBG] ocpp:OCPP201 void ocpp::WebsocketTlsTPM::client_loop() :: Init client loop with ID: 7f441ccd3b38 2024-06-14 01:09:16.621047 [DEBG] ocpp:OCPP201 int ocpp::WebsocketTlsTPM::process_callback(void*, int, void*, void*, size_t) :: Callback with unhandled reason: 29 2024-06-14 01:09:16.624015 [DEBG] ocpp:OCPP201 int ocpp::WebsocketTlsTPM::process_callback(void*, int, void*, void*, size_t) :: Verifying server certs! 2024-06-14 01:09:16.647011 [CRIT] manager int boot(const boost::program_options::variables_map&) :: Module ocpp (pid: 4280) exited with status: 11. Terminating all modules. ```
But SP1 worked ``` 2024-06-14 01:33:01.959977 [INFO] ocpp:OCPP201 :: Received BootNotificationResponse: { "currentTime": "2024-06-14T01:33:01.000Z", "interval": 300, "status": "Accepted" } ```

So it is almost certainly a cert issue. We are going with SP1 tomorrow and will have to figure out how to debug cert issues in the future.

shankari commented 5 months ago

With all these changes, SP1 works with EIM. PnC still fails because of SP1 and because the CSMS can't validate the cert. Set charging profile works, and returns the proper response

2024-06-14 02:05:33.588493 [DEBG] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: Decoded message (ns=urn:iso:15118:2:2013:MsgDef): {"V2G_Message":{"Header":{"SessionID":"CADE7FF7DE3FFF4F"},"Body":{"ChargingStatusRes":{"ResponseCode":"OK","EVSEID":"DE*PNX*00001","SAScheduleTupleID":1,"EVSEMaxCurrent":{"Multiplier":-1,"Unit":"A","Value":66},"MeterInfo":{"MeterID":"YETI_POWERMETER","MeterReading":10},"AC_EVSEStatus":{"NotificationMaxDelay":0,"EVSENotification":"None","RCD":false}}}}}

Checking in these changes and re-cross-compiling...

EDIT: The demo is cursed. I finally got to the point where I had a stable build that included all the changes required for crosscompiling and was running (at least in a restricted version). And then the pionix release server went down, so no toolchain for me...

bd830b356e53:/# wget http://build.pionix.de:8888/release/toolchains/bullseye-toolchain.tgz
Connecting to build.pionix.de:8888 (35.242.226.179:8888)
wget: can't connect to remote host (35.242.226.179): Connection refused

EDIT: This is because I was on the VPN which blocks port 8888. getting off allows the download; phew!

shankari commented 5 months ago

Cross-compile was successful.

# cd /ext/source/build-cross/dist
# tar czvf charin-e2e-demo-smart-charging.tar.gz mnt/
$ docker cp everest-ac-demo-manager-1:/ext/source/build-cross/dist/charin-e2e-demo-smart-charging.tar.gz .
$ systemctl stop everest.service (this didn't work immediately, so had to start and then stop)
$ ps -aef | grep manager
everest   1604  1069  0 04:15 pts/0    00:00:00 grep --color=auto manager
$ scp ~/joet-everest/everest-demo/charin-e2e-demo-smart-charging.tar.gz everest@...:/tmp
$ pushd /tmp/
$ tar xzvf charin-e2e-demo-smart-charging.tar.gz
$ mv mnt/user_data/opt /mnt/user_data/
$ /mnt/user_data/opt/everest/bin/manager --conf /mnt/user_data/custom_configs/2_config-dc-iso2.yaml
2024-06-14 04:21:21.275342 [ERRO] manager         void Everest::Config::load_and_validate_manifest(const string&, const json&) :: Failed to load and parse manifest file /mnt/user_data/opt/everest/libexec/everest/modules/JsIMDSimulator/manifest.yaml: File 'manifest.(yaml|json)' does not exist
2024-06-14 04:21:21.279842 [ERRO] manager         int boot(const boost::program_options::variables_map&) :: Failed to load and validate config!
2024-06-14 04:21:21.280027 [CRIT] manager         int boot(const boost::program_options::variables_map&) :: Caught top level boost::exception:
/ext/source/build-cross/_deps/everest-framework-src/lib/config.cpp(262): Throw in function void Everest::Config::load_and_validate_manifest(const string&, const json&)
Dynamic exception type: boost::wrapexcept<Everest::EverestConfigError>
std::exception::what: Failed to load and parse manifest file /mnt/user_data/opt/everest/libexec/everest/modules/JsIMDSimulator/manifest.yaml: File 'manifest.(yaml|json)' does not exist
[boost::log::v2_mt_posix::current_scope_info_tag*] = Everest::Config::Config(std::shared_ptr<Everest::RuntimeSettings>, bool)

That won't actually work any more because the modules in the config have changed.

$ /opt/everest/libexec/everest/modules/JsIMDSimulator
$ /mnt/user_data/opt/everest/libexec/everest/modules/IMDSimulator

Let's copy over the config that we use with our SIL

$ scp ~/joet-everest/everest-demo/config-sil-ocpp201-pnc.yaml everest@169.254.223.122:/tmp
$ /mnt/user_data/opt/everest/bin/manager --conf /tmp/config-sil-ocpp201-pnc.yaml
2024-06-14 04:27:19.688053 [ERRO] ocpp:OCPP201    void ocpp::v201::DeviceModel::check_integrity(const std::map<int, int>&) :: Integrity check in Device Model storage failed:Number of EVSE configured in device model is incompatible with number of configured EVSEs of the ChargePoint: 2: 1
terminate called after throwing an instance of 'ocpp::v201::DeviceModelStorageError'
  what():  Number of EVSE configured in device model is incompatible with number of configured EVSEs of the ChargePoint: 2: 1

It actually has 2 EVSEs and two connectors

$ sqlite3 opt/everest/share/everest/modules/OCPP201/device_model_storage.db
sqlite> select * from component;
20|InternalCtrlr|||
21|EVSE||1|
22|Connector||1|1
23|Connector||2|1
24|EVSE||2|

It now starts up, but tries to connect to the local OCPP server, which fails. Resetting the host...

sqlite> update variable_attribute set "value"='[{"configurationSlot": 1, "connectionData": {"messageTimeout": 30, "ocppCsmsUrl": "ws://169.254.223.121/ws/cp001", "ocppInterface": "Wired0", "ocppTransport": "JSON", "ocppVersion": "OCPP20", "securityProfile": 1}}]' where id=161

The OCPP connection is now set up correctly and we can receive a setChargingProfile!

2024-06-14 04:53:09.342111 [ERRO] ocpp:OCPP201    void ocpp::v201::ChargePoint::handle_set_charging_profile_req(ocpp::Call<ocpp::v201::SetChargingProfileRequest>) :: Received profile validity: ChargingScheduleChargingRateUnitUnsupportedsetting response to {
    "status": "Rejected"
}

But it is invalid because the rate is incorrect. Fixing that...

SetChargingProfiles now works ``` 2024-06-14 04:55:58.071299 [ERRO] ocpp:OCPP201 void ocpp::v201::ChargePoint::handle_set_charging_profile_req(ocpp::Call) :: Received SetChargingProfile: { "chargingProfile": { "chargingProfileKind": "Absolute", "chargingProfilePurpose": "TxDefaultProfile", "chargingSchedule": [ { "chargingRateUnit": "A", "chargingSchedulePeriod": [ { "limit": 20.0, "numberPhases": 1, "startPeriod": 0 } ], "duration": 86400, "id": 0, "minChargingRate": 0.0, "startSchedule": "2024-06-14T00:00:00.000Z" } ], "id": 1, "recurrencyKind": "Daily", "stackLevel": 1 }, "evseId": 1 } with messageId: d0475541-502f-4687-9833-b8fb2857601e 2024-06-14 04:55:58.073914 [WARN] ocpp:OCPP201 module::OCPP201::ready():: :: Received a new Charging Schedules from the CSMS or another actor. 2024-06-14 04:55:58.074300 [INFO] ocpp:OCPP201 :: ProfileId #1 Kind: Absolute 2024-06-14 04:55:58.074453 [INFO] ocpp:OCPP201 :: #1 find_period_at> 2024-06-14T00:00:00.000Z 2024-06-14 04:55:58.074645 [INFO] ocpp:OCPP201 :: find_period_at> start_time> 2024-06-14T03:55:58.074Z 2024-06-14 04:55:58.074864 [INFO] ocpp:OCPP201 :: find_period_at> period_start_time> 2024-06-14T00:00:00.000Z 2024-06-14 04:55:58.075066 [INFO] ocpp:OCPP201 :: find_period_at> period_end_time> 2024-06-15T00:00:00.000Z 2024-06-14 04:55:58.075487 [INFO] ocpp:OCPP201 :: PeriodDateTimePair> period: { "limit": 20.0, "numberPhases": 1, "startPeriod": 0 } end_time: 2024-06-15T00:00:00.000Z 2024-06-14 04:55:58.075789 [INFO] ocpp:OCPP201 :: period.has_value() limit = 4600 2024-06-14 04:55:58.075989 [INFO] ocpp:OCPP201 :: period.has_value() stackLevel = 4600 2024-06-14 04:55:58.076380 [WARN] ocpp:OCPP201 void module::OCPP201::set_external_limits(const std::map&) :: OCPP sets the following external limits for EVSE 1 at index 0 : { "schedule_import": [ { "limits_to_leaves": { "total_power_W": 4600.0 }, "limits_to_root": {}, "timestamp": "2024-06-14T03:55:58.076Z" } ] } 2024-06-14 04:55:58.132150 [ERRO] ocpp:OCPP201 void ocpp::v201::ChargePoint::handle_set_charging_profile_req(ocpp::Call) :: Received profile validity: Validsetting response to { "status": "Accepted" } ```

Next step: I see a message saying:

2024-06-14 04:55:39.453787 [INFO] ocpp:OCPP201     :: Logging SecurityEvents to file
2024-06-14 04:55:39.560707 [INFO] ocpp:OCPP201     :: TxStartPoints from device model: PowerPathClosed
2024-06-14 04:55:39.561344 [INFO] ocpp:OCPP201     :: TxStopPoints from device model: EVConnected,Authorized
2024-06-14 04:55:39.590262 [INFO] evse_manager_1:  :: Ignoring BSP Event, BSP is not enabled yet.
2024-06-14 04:55:39.805773 [INFO] evse_manager_1:  :: Max AC hardware capabilities: 32A/3ph
2024-06-14 04:55:39.880845 [INFO] car_simulator_1  :: Unplug detected, restarting simulation.
2024-06-14 04:55:39.911712 [INFO] evse_manager_1:  :: AC HLC mode enabled.

Let's enable the uMWC BSP on this config after copying it to a safe place.

Now the error is

2024-06-14 05:09:26.842693 [DEBG] yeti_driver_1:M void Everest::MQTTAbstractionImpl::on_mqtt_message(std::shared_ptr<Everest::Message>) :: topic everest/yeti_driver_1/board_support/cmd starts with everest/
2024-06-14 05:09:26.843793 [DEBG] yeti_driver_1:M Everest::Everest::provide_cmd(std::string, std::string, JsonCommand)::<lambda(Everest::json)> :: Incoming yeti_driver_1:MicroMegaWattBSP->board_support:evse_board_support->get_hw_capabilities() for <handler>
terminate called after throwing an instance of 'std::out_of_range'
  what():  No known string conversion for provided enum of type Connector_type

I guess it is time to update the firmware but let's check the code and verify first.

shankari commented 5 months ago

Bingo! The connector_type in https://github.com/EVerest/everest-core/blame/14aa49efe8a29d8e3e7f8485f522b4298fbe4250/types/evse_board_support.yaml#L3 was added in the commit that I identified at the beginning of this https://github.com/EVerest/everest-core/commit/e194737f06f7a5a90635046635f399fd4582cd46 (feeling pretty good...)

Let's update the firmware. Firmware updates are failing

$ ./umwc_fwupdate /dev/serial0 ../share/everest/modules/YetiDriver/firmware/yetiR1_2.1_firmware.bin
uMWC ROM Bootloader Firmware Updater
uMWC ROM Bootloader Firmware Updater
cobsDecode: Garbage detected
cobsDecode: Garbage detected
Current uMWC SW Version: fcb731e (Protocol 0.1)

Rebooting uMWC in ROM Bootloader mode...
Executing stm32flash -b 115200 /dev/serial0 -v -w ../share/everest/modules/YetiDriver/firmware/yetiR1_2.1_firmware.bin -R ...
stm32flash 0.7

http://stm32flash.sourceforge.net/

Using Parser : Raw BINARY
Size         : 114808
Interface serial_posix: 115200 8E1
Failed to init device, timeout.

Reverting back to the simulator temporarily. This should allow us to get the communication to work again and have a "new" everest starting up by default. Then, we can try to downgrade the BSP and see if it works.

shankari commented 5 months ago

This might actually be easier than I thought, and might be a bug in the code.

The simulator, phytec board, and BSP all set the connector type, but the uMWC does not

./simulation/JsYetiSimulator/index.js:    connector_type: 'IEC62196Type2Cable',
./PhyVersoBSP/connector_1/evse_board_supportImpl.cpp:            caps.connector_type = types::evse_board_support::Connector_type::IEC62196Type2Socket;
./PhyVersoBSP/connector_1/evse_board_supportImpl.cpp:            caps.connector_type = types::evse_board_support::Connector_type::IEC62196Type2Cable;
./PhyVersoBSP/connector_2/evse_board_supportImpl.cpp:            caps.connector_type = types::evse_board_support::Connector_type::IEC62196Type2Socket;
./PhyVersoBSP/connector_2/evse_board_supportImpl.cpp:            caps.connector_type = types::evse_board_support::Connector_type::IEC62196Type2Cable;
./YetiDriver/board_support/evse_board_supportImpl.cpp:        caps.connector_type = types::evse_board_support::Connector_type::IEC62196Type2Cable;

Let's try hardcoding it and rebuilding...

shankari commented 5 months ago

Hardcoded and rebuilt. However, I now get a different error

2024-06-14 07:51:10.152283 [ERRO] yeti_driver_1:M void module::MicroMegaWattBSP::ready() :: uMWC reset not successful.
terminate called after throwing an instance of 'boost::wrapexcept<Everest::EverestInternalError>'
  what():  uMWC reset not successful.
2024-06-14 07:51:10.326674 [ERRO] ocpp:OCPP201    void ocpp::v201::ChargePoint::handle_message(const ocpp::EnhancedMessage<ocpp::v201::MessageType>&) :: json_message called: [3,"3eb46edd-8338-4a57-adea-21cea3610694",{"status":"Failed"}]
2024-06-14 07:51:11.059698 [CRIT] manager         int boot(const boost::program_options::variables_map&) :: Module yeti_driver_1 (pid: 2922) exited with status: 134. Terminating all modules.

So it looks like the BSP initialization will fail with the new everest. Will send an email but we may just have to experiment with general ISO 15118 tomorrow and not support smart charging

everest_crash.logs.gz

shankari commented 5 months ago

Response from Pionix is that the power BSP (yeti board) might be bricked if we tried to flash the firmware while everest was running!! The original message had said that we could roll back by "decreasing the timestamp version in /etc/update.meta".

I was freaked out and couldn't sleep. However, the old version of everest still works although there are some "garbage detected" messages there too.

$ sudo /opt/everest/bin/manager --conf /opt/everest/conf/3_config-ac-iso2.yaml
2024-06-14 11:35:27.136600 [INFO] yeti_driver:Mic  :: Module yeti_driver initialized [3592ms]
2024-06-14 11:35:27.310689 [INFO] iso15118_charge  :: Module iso15118_charger initialized [3977ms]
2024-06-14 11:35:27.704641 [INFO] manager          :: 🚙🚙🚙 All modules are initialized. EVerest up and running [8421ms] 🚙🚙🚙
cobsDecode: Garbage detected
cobsDecode: Garbage detected
2024-06-14 11:35:29.380468 [INFO] slac:EvseSlac    :: EvseSlac: Entered Idle state
2024-06-14 11:35:29.559732 [INFO] evse_manager:Ev  :: AC HLC mode enabled.
2024-06-14 11:35:29.672688 [INFO] evse_manager:Ev  :: 🌀🌀🌀 Ready to start charging 🌀🌀🌀
sudo /opt/everest/bin/manager --conf /opt/everest/conf/3_config-ac-iso2.yaml ``` everest@umwcdbde:~ $ sudo mount -o remount,rw /dev/mmcblk0p2 / sudo: unable to resolve host umwcdbde: Name or service not known everest@umwcdbde:~ $ sudo chmod a+w /opt/everest/etc/everest/default_logging.cfg sudo: unable to resolve host umwcdbde: Name or service not known everest@umwcdbde:~ $ sudo mount -o remount,ro /dev/mmcblk0p2 / sudo: unable to resolve host umwcdbde: Name or service not known everest@umwcdbde:~ $ sudo /opt/everest/bin/manager --conf /opt/everest/conf/3_config-ac-iso2.yaml sudo: unable to resolve host umwcdbde: Name or service not known 2024-06-14 11:55:06.457022 [INFO] manager :: ________ __ _ 2024-06-14 11:55:06.457831 [INFO] manager :: | ____\ \ / / | | 2024-06-14 11:55:06.458095 [INFO] manager :: | |__ \ \ / /__ _ __ ___ ___| |_ 2024-06-14 11:55:06.458357 [INFO] manager :: | __| \ \/ / _ \ '__/ _ \/ __| __| 2024-06-14 11:55:06.458587 [INFO] manager :: | |____ \ / __/ | | __/\__ \ |_ 2024-06-14 11:55:06.458804 [INFO] manager :: |______| \/ \___|_| \___||___/\__| 2024-06-14 11:55:06.459011 [INFO] manager :: 2024-06-14 11:55:06.459212 [INFO] manager :: Using MQTT broker localhost:1883 2024-06-14 11:55:06.459432 [INFO] manager :: Telemetry enabled 2024-06-14 11:55:06.547596 [INFO] manager :: Loading config file at: /opt/everest/conf/3_config-ac-iso2.yaml 2024-06-14 11:55:09.487685 [INFO] manager :: - Types loaded in [139ms] 2024-06-14 11:55:09.487879 [INFO] manager :: - Types validated [2764ms] 2024-06-14 11:55:09.493676 [INFO] manager :: - Errors loaded in [1ms] 2024-06-14 11:55:09.493805 [INFO] manager :: - Errors validated [4ms] 2024-06-14 11:55:10.294905 [INFO] manager :: Config loading completed in 3835ms 2024-06-14 11:55:10.320477 [INFO] everest_ctrl :: Launching controller service on port 8849 2024-06-14 11:55:13.465840 [INFO] packet_sniffer: :: Module packet_sniffer initialized [2935ms] 2024-06-14 11:55:13.554811 [INFO] persistent_stor :: Module persistent_store initialized [2952ms] 2024-06-14 11:55:13.964655 [INFO] energy_manager: :: Module energy_manager initialized [3583ms] 2024-06-14 11:55:14.043748 [INFO] setup:Setup :: Module setup initialized [3386ms] 2024-06-14 11:55:14.126837 [INFO] auth:Auth :: Module auth initialized [3754ms] 2024-06-14 11:55:14.177543 [INFO] grid_connection :: Module grid_connection_point initialized [3717ms] 2024-06-14 11:55:14.330242 [INFO] iso15118_charge :: TCP server on eth1 is listening on port [fe80::38bf:c90a:8546:4363%4]:61341 2024-06-14 11:55:14.331387 [INFO] iso15118_charge :: SDP socket setup succeeded 2024-06-14 11:55:14.332452 [INFO] iso15118_charge :: Module iso15118_charger initialized [3783ms] 2024-06-14 11:55:14.352749 [INFO] api:API :: Module api initialized [3973ms] 2024-06-14 11:55:14.358028 [INFO] slac:EvseSlac :: Module slac initialized [3680ms] 2024-06-14 11:55:14.487106 [INFO] evse_manager:Ev :: Module evse_manager initialized [4057ms] 2024-06-14 11:55:14.491393 [INFO] yeti_driver:Mic :: Module yeti_driver initialized [3745ms] 2024-06-14 11:55:14.494332 [INFO] security:EvseSe :: Module security initialized [3857ms] 2024-06-14 11:55:14.903523 [INFO] manager :: 🚙🚙🚙 All modules are initialized. EVerest up and running [8463ms] 🚙🚙🚙 sh: 1: echo: echo: I/O error 2024-06-14 11:55:15.029373 [INFO] slac:EvseSlac :: EvseSlac: Starting the SLAC state machine 2024-06-14 11:55:15.029569 [INFO] slac:EvseSlac :: EvseSlac: Entered Reset state 2024-06-14 11:55:15.029771 [INFO] slac:EvseSlac :: EvseSlac: New NMK key: 52:4A:38:4F:36:53:48:4F:58:53:50:58:48:43:34:57 2024-06-14 11:55:15.030457 [INFO] slac:EvseSlac :: EvseSlac: Received CM_SET_KEY_CNF 2024-06-14 11:55:15.030907 [INFO] slac:EvseSlac :: EvseSlac: Entered Idle state 2024-06-14 11:55:16.530402 [INFO] evse_manager:Ev :: Max AC hardware capabilities: 6A/3ph 2024-06-14 11:55:16.602603 [INFO] slac:EvseSlac :: EvseSlac: Entered Reset state 2024-06-14 11:55:16.602883 [INFO] slac:EvseSlac :: EvseSlac: New NMK key: 52:4A:38:4F:36:53:48:4F:58:53:50:58:48:43:34:57 2024-06-14 11:55:16.603516 [INFO] slac:EvseSlac :: EvseSlac: Received CM_SET_KEY_CNF 2024-06-14 11:55:16.603798 [INFO] slac:EvseSlac :: EvseSlac: Entered Idle state 2024-06-14 11:55:16.833685 [INFO] evse_manager:Ev :: AC HLC mode enabled. 2024-06-14 11:55:16.966391 [INFO] evse_manager:Ev :: 🌀🌀🌀 Ready to start charging 🌀🌀🌀 ```

old_everest_running.log.gz

shankari commented 5 months ago

I just tried to read from the serial port and it is sending data continuously with the same repeated string (2fcb731e) so it doesn’t appear to be random noise. So I really don’t think that it is bricked.

everest@umwcdbde:~ $ cat /dev/serial0
@@xM"B
��7�~�7��s��)(2fcb731e��B
c�7�d�7�!!�@�?��t�B
d�7�}�7�+��)(2fcb731e'c�B
2�7���7���
@?�|��)(2fcb731e��DB
��7���7�p�9OB
~�7���7�h��@?�|��)(2fcb731e[��B
�7�ʣ7���ІB

Although I can write to the serial port as non-root, so that is not the reason why we are not able to flash and does not provide any indication that we could not have bricked the board.

everest@umwcdbde:~ $ echo HELO > /dev/serial0
everest@umwcdbde:~ $
shankari commented 5 months ago

I am pretty sure that it is not bricked. The communication with the uMWC has (from modules/MicroMegaWattBSP/umwc_comms/protobuf/umwc.proto)

message KeepAlive {                                  
  uint32 time_stamp = 1;                             
  uint32 hw_type = 2;                                
  uint32 hw_revision = 3;                            
  string sw_version_string = 6;                      
}                                                    

or

message KeepAliveLo {                                                             
  uint32 time_stamp = 1;                                                                                  
  uint32 hw_type = 2;                                                             
  uint32 hw_revision = 3;                                                         
  uint32 protocol_version_major = 4;                                    
  uint32 protocol_version_minor = 5;                                       
  string sw_version_string = 6;                                         
  float hwcap_max_current = 7;      
  float hwcap_min_current = 8;                              
  uint32 hwcap_max_phase_count = 9; 
  uint32 hwcap_min_phase_count = 10;                                                
  bool supports_changing_phases_during_charging = 11;
}                                                          

Both of them have string sw_version_string. From our attempt to flash the yeti, https://github.com/EVerest/everest-demo/issues/51#issuecomment-2167266067

Current uMWC SW Version: fcb731e (Protocol 0.1)

And we see that repeat over and over in the serial stream

��7��7�l�Y��,(2fcb731e�2��B
ʣ7���7��)�@?�|���,(2fcb731e�-kCB
K�7���7�[��CB
ʣ7��7�D{�`�?|\��,(2fcb731eP��PB
��7��7�l�RB
�7���7��p0`�?|\��,(2fcb731eم�}B
}�7���7�l�q$@?�|��B
��7��7��A��,(2fcb731e�B��B
faizanmir21 commented 5 months ago

Tried to boot up the uMMW charger but I think the USB-C cable is not working. Placed an order for a new cable from IT.

faizanmir21 commented 4 months ago

Tried to load the config file from /tmp directory sudo /opt/everest/bin/manager --conf /mnt/user_data/custom_configs/config-sil-ocpp201-pnc.yaml but was giving me as error as: DatabaseHandler::sql_init() :: Could not create tables: attempt tp write a readonly database terminate called after throwing an instance of 'std::runtime_error what(): Database access error

Thinking it was having issue accessing the database I tried to give write access to the database and the directory using: chmod 666 /mnt/user_data/opt/everest/share/everest/modules/OCPP201/device_model_storage.db chmod 755 /mnt/user_data/opt/everest/share/everest/modules/OCPP201/

However it didn't work so I moved the config file from /tmp to /mnt directory which has read/write access. /mnt/user_data/custom_configs/config-sil-ocpp201-pnc.yaml

Loading the config file again sudo /opt/everest/bin/manager --conf /mnt/user_data/custom_configs/config-sil-ocpp201-pnc.yaml

Throwing error for connector_id: void Everest::Config::load_and_validate_manifest(const string&, const json&) :: Config entry 'connector_id' for module config not defined in manifest of module '"JsYetiSimulator"'!

faizanmir21 commented 4 months ago

Tried loading default config. sudo /opt/everest/bin/manager --conf /mnt/user_data/custom_configs/3_config-ac-iso2.yaml

2024-07-12 18:53:50.615401 [INFO] manager :: 🚙🚙🚙 All modules are initialized. EVerest up and running [8526ms] 🚙🚙🚙 sh: 1: echo: echo: I/O error 2024-07-12 18:53:50.718277 [INFO] slac:EvseSlac :: EvseSlac: Starting the SLAC state machine 2024-07-12 18:53:50.718768 [INFO] slac:EvseSlac :: EvseSlac: Entered Reset state 2024-07-12 18:53:50.719196 [INFO] slac:EvseSlac :: EvseSlac: New NMK key: 4A:5A:5A:56:54:44:38:43:48:38:4B:4A:57:58:58:35 2024-07-12 18:53:50.721624 [INFO] slac:EvseSlac :: EvseSlac: Received CM_SET_KEY_CNF 2024-07-12 18:53:50.722205 [INFO] slac:EvseSlac :: EvseSlac: Entered Idle state 2024-07-12 18:53:51.714289 [ERRO] yeti_driver:Mic void module::MicroMegaWattBSP::ready() :: uMWC reset not successful. terminate called after throwing an instance of 'boost::wrapexcept<Everest::EverestInternalError>' what(): uMWC reset not successful. 2024-07-12 18:53:52.618067 [CRIT] manager int boot(const boost::program_options::variables_map&) :: Module yeti_driver (pid: 5725) exited with status: 134. Terminating all modules.

shankari commented 4 months ago

@faizanmir21 which version did you cross-compile? Are you sure it works with the SIL? The general process should be: SIL (validate config as well) -> HIL.

It is not clear which branch you cross-compiled on, how you copied it over, where you got the config from....? Please document what you did in detail like a lab notebook. You can look at my prior commits for instructions.

faizanmir21 commented 4 months ago

Cross-Compile custom version of everest

  1. Cloned everest-demo to local drive Navigate to .env file and change EVEREST_MANAGER_CPUS and EVEREST_MANAGER_MEMORY to 1 below the maximum values to increase the resources used by docker. (More information shared by Louis @ Cross-Compite Everest

  2. Building EVerest in Docker

  1. Send the cross-compiled file to the charger
    rsync -a build-cross/dist/mnt/user_data/opt/everest/* everest@the.ip.add.res:/mnt/user_data/opt/everest
  2. Reboot to use everest-dev.service instead of everest.service to run custom version.
    ps -aef | grep manager
    everest   2401  1796  0 18:18 pts/0    00:00:00 grep --color=auto manager
  3. Copy custom version of config file to the charger.
    $ scp ~/joet-everest/everest-demo/config-sil-ocpp201-pnc.yaml everest@the.ip.add.res:/tmp
  4. Run the manager with custom config
    $ sudo /mnt/user_data/opt/everest/bin/manager --conf /tmp/config-sil-ocpp201-pnc.yaml

    Got database error:

    DatabaseHandler::sql_init() :: Could not create tables: attempt tp write a readonly database terminate called after throwing an instance of 'std::runtime_error what(): Database access error

    Thinking it was having issue accessing the database I tried to give write access to the database and the directory using:

    chmod 666 /mnt/user_data/opt/everest/share/everest/modules/OCPP201/device_model_storage.db
    chmod 755 /mnt/user_data/opt/everest/share/everest/modules/OCPP201/ 

    Got same error moved the config file from /tmp to /mnt directory:

    mv /tmp/config-sil-ocpp201-pnc.yaml  /mnt/user_data/custom_configs/

    Loading the config file again:

    sudo /opt/everest/bin/manager --conf /mnt/user_data/custom_configs/config-sil-ocpp201-pnc.yaml

    Throwing error for connector_id:

    void Everest::Config::load_and_validate_manifest(const string&, const json&) :: Config entry 'connector_id' for module config not defined in manifest of module '"JsYetiSimulator"'!
shankari commented 4 months ago

@faizanmir21

ah, none of the smart charging code has made it to everest/everest-demo We are working off US-JOET/everest-demo, charin-e2e-demo branch The version of the everest codebase that is running in everest/everest-demo is from march https://github.com/EVerest/everest-demo/blob/6ac32289f5ad2769c3fa6da88289a54c7e072a57/manager/Dockerfile#L3

when you are compiling the correct version, you will run into compile errors which you will need to address as outlined in my comments in this issue

faizanmir21 commented 4 months ago

Getting OpenSSL error as reported here OpenSSL 3 issue

[edm]: Using metadata file: /ext/source/build-cross/everest-metadata.yaml
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR: Found unsuitable version "1.1.1n", but
  required is at least "3" (found
  /bullseye-toolchain/sysroot/usr/lib/arm-linux-gnueabihf/libcrypto.so, )
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:592 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindOpenSSL.cmake:599 (find_package_handle_standard_args)
  build-cross/_deps/libevse-security-src/CMakeLists.txt:46 (find_package)

Rolled back dependency from OpenSSL 3 to OpenSSL in the files build-cross/_deps/libocpp-src/CMakeLists.txt and /ext/source/build-cross/_deps/libevse-security-src/CMakeLists.txt

Make compiled successfully

make -j$(nproc) -C build-cross 
make -j$(nproc) DESTDIR=./dist -C build-cross install

Getting Error:

/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp: In function bool evse_security::s_generate_key(const evse_security::KeyGenerationInfo&, evse_security::KeyHandle_ptr&, evse_security::EVP_PKEY_CTX_ptr&)':
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:182:5: error:'OSSL_PARAM' was not declared in this scope
  182 |     OSSL_PARAM params[2];
      |     ^~~~~~~~~~
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:183:18: error: 'params' was not declared in this scope
  183 |     std::memset(&params[0], 0, sizeof(params));
      |                  ^~~~~~
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:186:21: error: 'OSSL_PARAM_construct_utf8_string' was not declared in this scope
  186 |         params[0] = OSSL_PARAM_construct_utf8_string("group", group, group_sz);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:188:32: error: 'EVP_PKEY_CTX_new_from_name' was not declared in this scope
  188 |         ctx = EVP_PKEY_CTX_ptr(EVP_PKEY_CTX_new_from_name(nullptr, kt_ec, nullptr));
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:190:21: error: 'OSSL_PARAM_construct_uint' was not declared in this scope
  190 |         params[0] = OSSL_PARAM_construct_uint("bits", &bits);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:192:32: error: 'EVP_PKEY_CTX_new_from_name' was not declared in this scope
  192 |         ctx = EVP_PKEY_CTX_ptr(EVP_PKEY_CTX_new_from_name(nullptr, kt_rsa, nullptr));
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
[ 62%] Linking CXX static library libmodbus.a
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:195:17: error: 'OSSL_PARAM_construct_end' was not declared in this scope
  195 |     params[1] = OSSL_PARAM_construct_end();
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~
shankari commented 4 months ago

@faizanmir21 I document how I resolved that issue. You have to revert to particular git commits, before the migration to the most recent version of OpenSSL.

faizanmir21 commented 4 months ago

Reverted the changes from this commit https://github.com/EVerest/libevse-security/commit/acc12fe5353d8090fc8cb0a84564b52ad7301e51 to previous version 0.6.0, build still failing with this error:

[ 83%] Built target MicroMegaWattBSP
[ 84%] Built target PhyVersoBSP
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/certificate/x509_wrapper.cpp: In member function 'void evse_security::X509Wrapper::update_validity()':
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/certificate/x509_wrapper.cpp:80:15: error: invalid operands of types 'bool' and 'void' to binary 'operator=='
   80 |     if (false == CryptoSupplier::x509_get_validity(get(), valid_in, valid_to)) {
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [_deps/libevse-security-build/lib/evse_security/CMakeFiles/evse_security.dir/build.make:132: _deps/libevse-security-build/lib/evse_security/CMakeFiles/evse_security.dir/certificate/x509_wrapper.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp: In function 'bool evse_security::s_generate_key(const evse_security::KeyGenerationInfo&, evse_security::KeyHandle_ptr&, evse_security::EVP_PKEY_CTX_ptr&)':
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:261:75: warning:'RSA* RSA_generate_key(int, long unsigned int, void (*)(int, int, void*), void*)' is deprecated [-Wdeprecated-declaration]
  261 |         RSA_ptr rsa_key(RSA_generate_key(bits, RSA_PRIME, nullptr, nullptr));
      |                                                                           ^
In file included from /bullseye-toolchain/sysroot/usr/include/openssl/e_os2.h:13,
                 from /bullseye-toolchain/sysroot/usr/include/openssl/bio.h:13,
                 from /bullseye-toolchain/sysroot/usr/include/openssl/x509v3.h:13,
                 from /ext/source/build-cross/_deps/libevse-security-src/include/evse_security/detail/openssl/openssl_types.hpp:6,
                 from /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:5:
/bullseye-toolchain/sysroot/usr/include/openssl/rsa.h:235:1: note: declared here
  235 | DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void
      | ^~~~~~~~~~~~~~~~~~
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp: In static member function 'static bool evse_security::OpenSSLSupplier::digest_file_sha256(const std::filesystem::__cxx11::path&, std::vector<std::byte>&)':
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:844:10: error: invalid initialization of reference of type 'std::function<bool(const unsigned char*, unsigned int, bool)>&&' from expression of type 'evse_security::OpenSSLSupplier::digest_file_sha256(const std::filesystem::__cxx11::path&, std::vector<std::byte>&)::<lambda(const std::byte*, std::size_t, bool)>'
  844 |         });
      |          ^
In file included from /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:6:
/ext/source/build-cross/_deps/libevse-security-src/include/evse_security/utils/evse_filesystem.hpp:28:92: note: in passing argument 3 of 'bool evse_security::filesystem_utils::process_file(const std::filesystem::__cxx11::path&, size_t, std::function<bool(const unsigned char*, unsigned int, bool)>&&)'
   28 |                   std::function<bool(const std::uint8_t*, std::size_t, bool last_chunk)>&& func);
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~

CryptoSupplier::x509_get_validity function which returns void, and this is being compared with bool value ?

shankari commented 4 months ago

@faizanmir21 can you clarify what you mean by "reverted" to previous? I have the specific commit that I reverted to, and the changes in libevse_security that followed, documented above. As I highlighted, we want to focus on the process here, not just getting some random code to work

faizanmir21 commented 4 months ago

Was getting this error while building

[ 69%] Building CXX object modules/CMakeFiles/System.dir/System/System.cpp.o
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp: In function 'bool evse_security::s_generate_key(const evse_security::KeyGenerationInfo&, evse_security::KeyHandle_ptr&, evse_security::EVP_PKEY_CTX_ptr&)':
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:238:9: error: 'EC_KEY_ptr' was not declared in this scope; did you mean 'EVP_PKEY_ptr'?
  238 |         EC_KEY_ptr ec_key(EC_KEY_new_by_curve_name(nid));
      |         ^~~~~~~~~~
      |         EVP_PKEY_ptr
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:240:13: error: 'ec_key' was not declared in this scope; did you mean 'evp_key'?
  240 |         if (ec_key.get() == nullptr) {
      |             ^~~~~~
      |             evp_key
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:247:37: error: 'ec_key' was not declared in this scope; did you mean 'evp_key'?
  247 |             if (EC_KEY_generate_key(ec_key.get()) != 1) {
      |                                     ^~~~~~
      |                                     evp_key
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:255:27: error: 'ec_key' was not declared in this scope; did you mean 'evp_key'?
  255 |             EC_KEY* key = ec_key.release();
      |                           ^~~~~~
      |                           evp_key
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:261:9: error: 'RSA_ptr' was not declared in this scope
  261 |         RSA_ptr rsa_key(RSA_generate_key(bits, RSA_PRIME, nullptr, nullptr));
      |         ^~~~~~~

reverted to the this version openssl_supplier #70 file located at ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl

getting this error:

/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp: In static member function 'static evse_security::CertificateValidationResult evse_security::OpenSSLSupplier::x509_verify_certificate_chain(evse_security::X509Handle*, const std::vector<evse_security::X509Handle*>&, const std::vector<evse_security::X509Handle*>&, bool, std::optional<std::filesystem::__cxx11::path>, std::optional<std::filesystem::__cxx11::path>)':
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:599:21: error: 'X509_ADD_FLAG_NO_DUP' was not declared in this scope; did you mean 'X509_FLAG_NO_AUX'?
  599 |         int flags = X509_ADD_FLAG_NO_DUP | X509_ADD_FLAG_NO_SS;
      |                     ^~~~~~~~~~~~~~~~~~~~
      |                     X509_FLAG_NO_AUX
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:599:44: error: 'X509_ADD_FLAG_NO_SS' was not declared in this scope; did you mean 'X509_FLAG_NO_IDS'?
  599 |         int flags = X509_ADD_FLAG_NO_DUP | X509_ADD_FLAG_NO_SS;
      |                                            ^~~~~~~~~~~~~~~~~~~
      |                                            X509_FLAG_NO_IDS
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:602:22: error: 'X509_add_cert' was not declared in this scope; did you mean 'X509_add_ext'?
  602 |             if (1 != X509_add_cert(untrusted.get(), get(untrusted_cert), flags)) {
      |                      ^~~~~~~~~~~~~
      |                      X509_add_ext

X509_ADD_FLAG_NO_DUP | X509_ADD_FLAG_NO_SS were added in this version of the file openssl_supplier.cpp #71 reverting to this file.

failing with

[ 84%] Built target PhyVersoBSP
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp: In function 'bool evse_security::s_generate_key(const evse_security::KeyGenerationInfo&, evse_security::KeyHandle_ptr&, evse_security::EVP_PKEY_CTX_ptr&)':
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:236:9: error: 'EC_KEY_ptr' was not declared in this scope; did you mean 'EVP_PKEY_ptr'?
  236 |         EC_KEY_ptr ec_key(EC_KEY_new_by_curve_name(nid));
      |         ^~~~~~~~~~
      |         EVP_PKEY_ptr
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:238:13: error: 'ec_key' was not declared in this scope; did you mean 'evp_key'?
  238 |         if (ec_key.get() == nullptr) {
      |             ^~~~~~
      |             evp_key
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:245:37: error: 'ec_key' was not declared in this scope; did you mean 'evp_key'?
  245 |             if (EC_KEY_generate_key(ec_key.get()) != 1) {
      |                                     ^~~~~~
      |                                     evp_key
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:253:27: error: 'ec_key' was not declared in this scope; did you mean 'evp_key'?
  253 |             EC_KEY* key = ec_key.release();
      |                           ^~~~~~
      |                           evp_key
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:259:9: error: 'RSA_ptr' was not declared in this scope
  259 |         RSA_ptr rsa_key(RSA_generate_key(bits, RSA_PRIME, nullptr, nullptr));
      |         ^~~~~~~
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:261:13: error: 'rsa_key' was not declared in this scope
  261 |         if (rsa_key.get() == nullptr) {
      |             ^~~~~~~
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:269:24: error: 'rsa_key' was not declared in this scope
  269 |             RSA* key = rsa_key.release();
      |                        ^~~~~~~
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp: In static member function 'static evse_security::CertificateValidationResult evse_security::OpenSSLSupplier::x509_verify_certificate_chain(evse_security::X509Handle*, const std::vector<evse_security::X509Handle*>&, const std::vector<evse_security::X509Handle*>&, bool, std::optional<std::filesystem::__cxx11::path>, std::optional<std::filesystem::__cxx11::path>)':
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:599:21: error: 'X509_ADD_FLAG_NO_DUP' was not declared in this scope; did you mean 'X509_FLAG_NO_AUX'?
  599 |         int flags = X509_ADD_FLAG_NO_DUP | X509_ADD_FLAG_NO_SS;
      |                     ^~~~~~~~~~~~~~~~~~~~
      |                     X509_FLAG_NO_AUX
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:599:44: error: 'X509_ADD_FLAG_NO_SS' was not declared in this scope; did you mean 'X509_FLAG_NO_IDS'?
  599 |         int flags = X509_ADD_FLAG_NO_DUP | X509_ADD_FLAG_NO_SS;
      |                                            ^~~~~~~~~~~~~~~~~~~
      |                                            X509_FLAG_NO_IDS
/ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:602:22: error: 'X509_add_cert' was not declared in this scope; did you mean 'X509_add_ext'?
  602 |             if (1 != X509_add_cert(untrusted.get(), get(untrusted_cert), flags)) {
      |                      ^~~~~~~~~~~~~
      |                      X509_add_ext
shankari commented 4 months ago

@faizanmir21 please read my comments carefully. I did not revert individual files, but instead, reverted the entire module/dependency.

faizanmir21 commented 4 months ago

Reverted the entire module to #71

Ran into this

[ 87%] Building CXX object _deps/libocpp-build/lib/CMakeFiles/ocpp.dir/ocpp/v16/messages/GetLog.cpp.o
/ext/source/build-cross/_deps/libocpp-src/lib/ocpp/common/websocket/websocket_libwebsockets.cpp: In function 'bool ocpp::verify_csms_cn(const string&, bool, const X509_STORE_CTX*, bool)':
/ext/source/build-cross/_deps/libocpp-src/lib/ocpp/common/websocket/websocket_libwebsockets.cpp:164:48: error: invalid conversion from 'const X509_STORE_CTX*' {aka 'const x509_store_ctx_st*'} to 'X509_STORE_CTX*' {aka 'x509_store_ctx_st*'} [-fpermissive]
  164 |     int depth = X509_STORE_CTX_get_error_depth(ctx);
      |                                                ^~~
      |                                                |
      |                                                const X509_STORE_CTX* {aka const x509_store_ctx_st*}
In file included from /bullseye-toolchain/sysroot/usr/include/openssl/x509.h:320,
                 from /bullseye-toolchain/sysroot/usr/include/openssl/ssl.h:20,
                 from /ext/source/build-cross/_deps/libwebsockets-src/lib/../include/libwebsockets.h:308,
                 from /ext/source/build-cross/_deps/libocpp-src/lib/ocpp/common/websocket/websocket_libwebsockets.cpp:8:
/bullseye-toolchain/sysroot/usr/include/openssl/x509_vfy.h:495:52: note:   initializing argument 1 of 'int X509_STORE_CTX_get_error_depth(X509_STORE_CTX*)'
  495 | int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);

This is similar issue here

faizanmir21 commented 4 months ago

Copied

X509_STORE_CTX* non_const_ctx = X509_STORE_CTX_new();
    memcpy(non_const_ctx, ctx, sizeof(ctx)); // args are (dest, src, size)
    int depth = X509_STORE_CTX_get_error_depth(non_const_ctx);
X509_STORE_CTX* non_const_ctx = X509_STORE_CTX_new();
        memcpy(non_const_ctx, ctx, sizeof(ctx)); // args are (dest, src, size)
        int error = X509_STORE_CTX_get_error(non_const_ctx);
X509_STORE_CTX* non_const_ctx = X509_STORE_CTX_new();
        memcpy(non_const_ctx, ctx, sizeof(ctx)); // args are (dest, src, size)
        X509* server_cert = X509_STORE_CTX_get_current_cert(non_const_ctx);

in file /ext/source/build-cross/_deps/libocpp-src/lib/ocpp/common/websocket/websocket_libwebsockets.cpp

Ran into this

[100%] Linking CXX executable OCPP/OCPP
/bullseye-toolchain/crosstool/bin/../lib/gcc/armv8-rpi4-linux-gnueabihf/10.3.0/../../../../armv8-rpi4-linux-gnueabihf/bin/ld.bfd: ../_deps/libevse-security-build/lib/evse_security/libevse_security.a(evse_security.cpp.o): in function `evse_security::EvseSecurity::verify_file_signature(std::filesystem::__cxx11::path const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
evse_security.cpp:(.text+0xee64): undefined reference to `evse_security::OpenSSLSupplier::digest_file_sha256(std::filesystem::__cxx11::path const&, std::vector<unsigned char, std::allocator<unsigned char> >&)'
/bullseye-toolchain/crosstool/bin/../lib/gcc/armv8-rpi4-linux-gnueabihf/10.3.0/../../../../armv8-rpi4-linux-gnueabihf/bin/ld.bfd: evse_security.cpp:(.text+0xefb0): undefined reference to `evse_security::OpenSSLSupplier::base64_decode_to_bytes(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<unsigned char, std::allocator<unsigned char> >&)'
/bullseye-toolchain/crosstool/bin/../lib/gcc/armv8-rpi4-linux-gnueabihf/10.3.0/../../../../armv8-rpi4-linux-gnueabihf/bin/ld.bfd: evse_security.cpp:(.text+0xf110): undefined reference to `evse_security::OpenSSLSupplier::x509_verify_signature(evse_security::X509Handle*, std::vector<unsigned char, std::allocator<unsigned char> > const&, std::vector<unsigned char, std::allocator<unsigned char> > const&)'
shankari commented 3 months ago

I am not sure what @faizanmir21 did; I am not able to reproduce that error. I went through my previous steps methodically, and got the cross-compile to work with approximately 1 day of work (~6-8 hours).

when I revert the `libevse-security` module to `4330ce2e28e25535dd01558edb2331891c146769`, I get ``` /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:599:21: error: 'X509_ADD_FLAG_NO_DUP' was not declared in this scope; did you mean 'X509_FLAG_NO_AUX'? 599 | int flags = X509_ADD_FLAG_NO_DUP | X509_ADD_FLAG_NO_SS; | ^~~~~~~~~~~~~~~~~~~~ | X509_FLAG_NO_AUX /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:599:44: error: 'X509_ADD_FLAG_NO_SS' was not declared in this scope; did you mean 'X509_FLAG_NO_IDS'? 599 | int flags = X509_ADD_FLAG_NO_DUP | X509_ADD_FLAG_NO_SS; | ^~~~~~~~~~~~~~~~~~~ | X509_FLAG_NO_IDS /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:602:22: error: 'X509_add_cert' was not declared in this scope; did you mean 'X509_add_ext'? 602 | if (1 != X509_add_cert(untrusted.get(), get(untrusted_cert), flags)) { | ^~~~~~~~~~~~~ | X509_add_ext make[2]: *** [_deps/libevse-security-build/lib/evse_security/CMakeFiles/evse_security.dir/build.make:188: _deps/libevse-security-build/lib/evse_security/CMakeFiles/evse_security.dir/crypto/openssl/openssl_supplier.cpp.o] Error 1 make[2]: Leaving directory '/ext/source/build-cross' make[1]: *** [CMakeFiles/Makefile2:4108: _deps/libevse-security-build/lib/evse_security/CMakeFiles/evse_security.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... ```
Reverting only `openssl_supplier.cpp` (`lib` and `include`) to 6e8372a1e8b508ac3b623f43026dce1cab292698 (the version before acc12fe5353d8090fc8cb0a84564b52ad7301e51), I get errors in `evse_security.cpp` ``` /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/certificate/x509_wrapper.cpp: In member function 'void evse_security::X509Wrapper::update_validity()': /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/certificate/x509_wrapper.cpp:80:15: error: invalid operands of types 'bool' and 'void' to binary 'operator==' 80 | if (false == CryptoSupplier::x509_get_validity(get(), valid_in, valid_to)) { | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp: In function 'bool evse_security::s_generate_key(const evse_security::KeyGenerationInfo&, evse_security::KeyHandle_ptr&, evse_security::EVP_PKEY_CTX_ptr&)': /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:261:75: warning: 'RSA* RSA_generate_key(int, long unsigned int, void (*)(int, int, void*), void*)' is deprecated [-Wdeprecated-declarations] 261 | RSA_ptr rsa_key(RSA_generate_key(bits, RSA_PRIME, nullptr, nullptr)); | ^ In file included from /bullseye-toolchain/sysroot/usr/include/openssl/e_os2.h:13, from /bullseye-toolchain/sysroot/usr/include/openssl/bio.h:13, from /bullseye-toolchain/sysroot/usr/include/openssl/x509v3.h:13, from /ext/source/build-cross/_deps/libevse-security-src/include/evse_security/detail/openssl/openssl_types.hpp:6, from /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:5: /bullseye-toolchain/sysroot/usr/include/openssl/rsa.h:235:1: note: declared here 235 | DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void | ^~~~~~~~~~~~~~~~~~ make[2]: *** [_deps/libevse-security-build/lib/evse_security/CMakeFiles/evse_security.dir/build.make:132: _deps/libevse-security-build/lib/evse_security/CMakeFiles/evse_security.dir/certificate/x509_wrapper.cpp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... [ 61%] Building CXX object _deps/everest-framework-build/everestpy/src/everest/CMakeFiles/everestpy.dir/module.cpp.o /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp: In static member function 'static bool evse_security::OpenSSLSupplier::digest_file_sha256(const std::filesystem::__cxx11::path&, std::vector&)': /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:844:10: error: invalid initialization of reference of type 'std::function&&' from expression of type 'evse_security::OpenSSLSupplier::digest_file_sha256(const std::filesystem::__cxx11::path&, std::vector&)::' 844 | }); | ^ In file included from /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:6: /ext/source/build-cross/_deps/libevse-security-src/include/evse_security/utils/evse_filesystem.hpp:28:92: note: in passing argument 3 of 'bool evse_security::filesystem_utils::process_file(const std::filesystem::__cxx11::path&, size_t, std::function&&)' 28 | std::function&& func); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~ make[2]: *** [_deps/libevse-security-build/lib/evse_security/CMakeFiles/evse_security.dir/build.make:188: _deps/libevse-security-build/lib/evse_security/CMakeFiles/evse_security.dir/crypto/openssl/openssl_supplier.cpp.o] Error 1 [ 61%] Building CXX object modules/CMakeFiles/API.dir/__/generated/modules/API/ld-ev.cpp.o [ 62%] Building CXX object _deps/everest-framework-build/everestjs/CMakeFiles/everestjs.dir/conversions.cpp.o /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/evse_security.cpp: In member function 'evse_security::GetCertificateSignRequestResult evse_security::EvseSecurity::generate_certificate_signing_request_internal(evse_security::LeafCertificateType, const evse_security::CertificateSigningRequestInfo&)': /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/evse_security.cpp:978:80: error: cannot convert 'bool' to 'evse_security::CertificateSignRequestResult' in initialization 978 | CertificateSignRequestResult csr_result = CryptoSupplier::x509_generate_csr(info, csr); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ | | | bool /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/evse_security.cpp: In static member function 'static bool evse_security::EvseSecurity::verify_file_signature(const std::filesystem::__cxx11::path&, const string&, std::string)': /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/evse_security.cpp:1471:59: error: cannot convert 'std::vector' to 'std::vector&' 1471 | if (false == CryptoSupplier::digest_file_sha256(path, sha256_digest)) { | ^~~~~~~~~~~~~ | | | std::vector In file included from /ext/source/build-cross/_deps/libevse-security-src/include/evse_security/crypto/evse_crypto.hpp:9, from /ext/source/build-cross/_deps/libevse-security-src/include/evse_security/evse_security.hpp:7, from /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/evse_security.cpp:6: /ext/source/build-cross/_deps/libevse-security-src/include/evse_security/crypto/openssl/openssl_supplier.hpp:47:82: note: initializing argument 2 of 'static bool evse_security::OpenSSLSupplier::digest_file_sha256(const std::filesystem::__cxx11::path&, std::vector&)' 47 | static bool digest_file_sha256(const fs::path& path, std::vector& out_digest); | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/evse_security.cpp:1486:82: error: cannot convert 'std::vector' to 'const std::vector&' 1486 | if (CryptoSupplier::x509_verify_signature(x509_signing_cerificate.get(), signature_decoded, sha256_digest)) { | ^~~~~~~~~~~~~~~~~ | | | std::vector In file included from /ext/source/build-cross/_deps/libevse-security-src/include/evse_security/crypto/evse_crypto.hpp:9, from /ext/source/build-cross/_deps/libevse-security-src/include/evse_security/evse_security.hpp:7, from /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/evse_security.cpp:6: /ext/source/build-cross/_deps/libevse-security-src/include/evse_security/crypto/openssl/openssl_supplier.hpp:41:89: note: initializing argument 2 of 'static bool evse_security::OpenSSLSupplier::x509_verify_signature(evse_security::X509Handle*, const std::vector&, const std::vector&)' 41 | static bool x509_verify_signature(X509Handle* handle, const std::vector& signature, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~ /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/evse_security.cpp: In member function 'evse_security::CertificateValidationResult evse_security::EvseSecurity::verify_certificate_internal(const string&, evse_security::LeafCertificateType)': /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/evse_security.cpp:1623:113: error: no matching function for call to 'evse_security::OpenSSLSupplier::x509_verify_certificate_chain(evse_security::X509Handle*, std::vector&, std::vector&, bool, const std::nullopt_t&, const std::nullopt_t&)' 1623 | untrusted_subcas, true, std::nullopt, std::nullopt); | ^ In file included from /ext/source/build-cross/_deps/libevse-security-src/include/evse_security/crypto/evse_crypto.hpp:9, from /ext/source/build-cross/_deps/libevse-security-src/include/evse_security/evse_security.hpp:7, from /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/evse_security.cpp:6: /ext/source/build-cross/_deps/libevse-security-src/include/evse_security/crypto/openssl/openssl_supplier.hpp:34:40: note: candidate: 'static evse_security::CertificateValidationResult evse_security::OpenSSLSupplier::x509_verify_certificate_chain(evse_security::X509Handle*, const std::vector&, bool, std::optional, std::optional)' 34 | static CertificateValidationResult x509_verify_certificate_chain(X509Handle* target, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /ext/source/build-cross/_deps/libevse-security-src/include/evse_security/crypto/openssl/openssl_supplier.hpp:34:40: note: candidate expects 5 arguments, 6 provided /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/evse_security.cpp:1626:118: error: no matching function for call to 'evse_security::OpenSSLSupplier::x509_verify_certificate_chain(evse_security::X509Handle*, std::vector&, std::vector&, bool, const std::nullopt_t&, std::filesystem::__cxx11::path&)' 1626 | leaf_certificate.get(), trusted_parent_certificates, untrusted_subcas, true, std::nullopt, root_store); | ^ In file included from /ext/source/build-cross/_deps/libevse-security-src/include/evse_security/crypto/evse_crypto.hpp:9, from /ext/source/build-cross/_deps/libevse-security-src/include/evse_security/evse_security.hpp:7, from /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/evse_security.cpp:6: /ext/source/build-cross/_deps/libevse-security-src/include/evse_security/crypto/openssl/openssl_supplier.hpp:34:40: note: candidate: 'static evse_security::CertificateValidationResult evse_security::OpenSSLSupplier::x509_verify_certificate_chain(evse_security::X509Handle*, const std::vector&, bool, std::optional, std::optional)' 34 | static CertificateValidationResult x509_verify_certificate_chain(X509Handle* target, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /ext/source/build-cross/_deps/libevse-security-src/include/evse_security/crypto/openssl/openssl_supplier.hpp:34:40: note: candidate expects 5 arguments, 6 provided make[2]: *** [_deps/libevse-security-build/lib/evse_security/CMakeFiles/evse_security.dir/build.make:76: _deps/libevse-security-build/lib/evse_security/CMakeFiles/evse_security.dir/evse_security.cpp.o] Error 1 make[2]: Leaving directory '/ext/source/build-cross' make[1]: *** [CMakeFiles/Makefile2:4108: _deps/libevse-security-build/lib/evse_security/CMakeFiles/evse_security.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... ```
Reverting the entire module to `6e8372a1e8b508ac3b623f43026dce1cab292698` in `dependencies.yml` generates no errors in `libevse-security` but does appear to generate errors in libocpp ``` In file included from /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/charging_station_base.hpp:9, from /ext/source/build-cross/_deps/libocpp-src/lib/ocpp/common/charging_station_base.cpp:5: /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:64:56: error: 'GetCertificateSignRequestStatus' is not a member of 'evse_security'; did you mean 'ocpp::GetCertificateSignRequestStatus'? 64 | GetCertificateSignRequestStatus to_ocpp(evse_security::GetCertificateSignRequestStatus other); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security.hpp:11, from /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/charging_station_base.hpp:8, from /ext/source/build-cross/_deps/libocpp-src/lib/ocpp/common/charging_station_base.cpp:5: /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/types.hpp:534:12: note: 'ocpp::GetCertificateSignRequestStatus' declared here 534 | enum class GetCertificateSignRequestStatus { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/charging_station_base.hpp:9, from /ext/source/build-cross/_deps/libocpp-src/lib/ocpp/common/charging_station_base.cpp:5: /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:65:65: error: 'ocpp::CaCertificateType ocpp::conversions::to_ocpp(evse_security::CaCertificateType)' redeclared as different kind of entity 65 | CaCertificateType to_ocpp(evse_security::CaCertificateType other); | ^ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:64:33: note: previous declaration 'ocpp::GetCertificateSignRequestStatus ocpp::conversions::to_ocpp' 64 | GetCertificateSignRequestStatus to_ocpp(evse_security::GetCertificateSignRequestStatus other); | ^~~~~~~ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:66:75: error: 'ocpp::CertificateSigningUseEnum ocpp::conversions::to_ocpp(evse_security::LeafCertificateType)' redeclared as different kind of entity 66 | CertificateSigningUseEnum to_ocpp(evse_security::LeafCertificateType other); | ^ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:64:33: note: previous declaration 'ocpp::GetCertificateSignRequestStatus ocpp::conversions::to_ocpp' 64 | GetCertificateSignRequestStatus to_ocpp(evse_security::GetCertificateSignRequestStatus other); | ^~~~~~~ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:67:61: error: 'ocpp::CertificateType ocpp::conversions::to_ocpp(evse_security::CertificateType)' redeclared as different kind of entity 67 | CertificateType to_ocpp(evse_security::CertificateType other); | ^ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:64:33: note: previous declaration 'ocpp::GetCertificateSignRequestStatus ocpp::conversions::to_ocpp' 64 | GetCertificateSignRequestStatus to_ocpp(evse_security::GetCertificateSignRequestStatus other); | ^~~~~~~ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:68:65: error: 'ocpp::HashAlgorithmEnumType ocpp::conversions::to_ocpp(evse_security::HashAlgorithm)' redeclared as different kind of entity 68 | HashAlgorithmEnumType to_ocpp(evse_security::HashAlgorithm other); | ^ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:64:33: note: previous declaration 'ocpp::GetCertificateSignRequestStatus ocpp::conversions::to_ocpp' 64 | GetCertificateSignRequestStatus to_ocpp(evse_security::GetCertificateSignRequestStatus other); | ^~~~~~~ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:69:26: error: conflicting declaration 'ocpp::GetCertificateInfoStatus ocpp::conversions::to_ocpp' 69 | GetCertificateInfoStatus to_ocpp(evse_security::GetCertificateInfoStatus other); | ^~~~~~~ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:64:33: note: previous declaration as 'ocpp::GetCertificateSignRequestStatus ocpp::conversions::to_ocpp' 64 | GetCertificateSignRequestStatus to_ocpp(evse_security::GetCertificateSignRequestStatus other); | ^~~~~~~ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:69:49: error: 'GetCertificateInfoStatus' is not a member of 'evse_security'; did you mean 'ocpp::GetCertificateInfoStatus'? 69 | GetCertificateInfoStatus to_ocpp(evse_security::GetCertificateInfoStatus other); | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security.hpp:11, from /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/charging_station_base.hpp:8, from /ext/source/build-cross/_deps/libocpp-src/lib/ocpp/common/charging_station_base.cpp:5: /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/types.hpp:541:12: note: 'ocpp::GetCertificateInfoStatus' declared here 541 | enum class GetCertificateInfoStatus { | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/charging_station_base.hpp:9, from /ext/source/build-cross/_deps/libocpp-src/lib/ocpp/common/charging_station_base.cpp:5: /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:70:79: error: 'ocpp::InstallCertificateResult ocpp::conversions::to_ocpp(evse_security::InstallCertificateResult)' redeclared as different kind of entity 70 | InstallCertificateResult to_ocpp(evse_security::InstallCertificateResult other); | ^ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:64:33: note: previous declaration 'ocpp::GetCertificateSignRequestStatus ocpp::conversions::to_ocpp' 64 | GetCertificateSignRequestStatus to_ocpp(evse_security::GetCertificateSignRequestStatus other); | ^~~~~~~ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:71:85: error: 'ocpp::CertificateValidationResult ocpp::conversions::to_ocpp(evse_security::CertificateValidationResult)' redeclared as different kind of entity 71 | CertificateValidationResult to_ocpp(evse_security::CertificateValidationResult other); | ^ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:64:33: note: previous declaration 'ocpp::GetCertificateSignRequestStatus ocpp::conversions::to_ocpp' 64 | GetCertificateSignRequestStatus to_ocpp(evse_security::GetCertificateSignRequestStatus other); | ^~~~~~~ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:72:77: error: 'ocpp::DeleteCertificateResult ocpp::conversions::to_ocpp(evse_security::DeleteCertificateResult)' redeclared as different kind of entity 72 | DeleteCertificateResult to_ocpp(evse_security::DeleteCertificateResult other); | ^ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:64:33: note: previous declaration 'ocpp::GetCertificateSignRequestStatus ocpp::conversions::to_ocpp' 64 | GetCertificateSignRequestStatus to_ocpp(evse_security::GetCertificateSignRequestStatus other); | ^~~~~~~ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:74:73: error: 'ocpp::CertificateHashDataType ocpp::conversions::to_ocpp(evse_security::CertificateHashData)' redeclared as different kind of entity 74 | CertificateHashDataType to_ocpp(evse_security::CertificateHashData other); | ^ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:64:33: note: previous declaration 'ocpp::GetCertificateSignRequestStatus ocpp::conversions::to_ocpp' 64 | GetCertificateSignRequestStatus to_ocpp(evse_security::GetCertificateSignRequestStatus other); | ^~~~~~~ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:75:79: error: 'ocpp::CertificateHashDataChain ocpp::conversions::to_ocpp(evse_security::CertificateHashDataChain)' redeclared as different kind of entity 75 | CertificateHashDataChain to_ocpp(evse_security::CertificateHashDataChain other); | ^ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:64:33: note: previous declaration 'ocpp::GetCertificateSignRequestStatus ocpp::conversions::to_ocpp' 64 | GetCertificateSignRequestStatus to_ocpp(evse_security::GetCertificateSignRequestStatus other); | ^~~~~~~ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:76:61: error: 'ocpp::OCSPRequestData ocpp::conversions::to_ocpp(evse_security::OCSPRequestData)' redeclared as different kind of entity 76 | OCSPRequestData to_ocpp(evse_security::OCSPRequestData other); | ^ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:64:33: note: previous declaration 'ocpp::GetCertificateSignRequestStatus ocpp::conversions::to_ocpp' 64 | GetCertificateSignRequestStatus to_ocpp(evse_security::GetCertificateSignRequestStatus other); | ^~~~~~~ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:77:17: error: conflicting declaration 'ocpp::CertificateOCSP ocpp::conversions::to_ocpp' 77 | CertificateOCSP to_ocpp(evse_security::CertificateOCSP other); | ^~~~~~~ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:64:33: note: previous declaration as 'ocpp::GetCertificateSignRequestStatus ocpp::conversions::to_ocpp' 64 | GetCertificateSignRequestStatus to_ocpp(evse_security::GetCertificateSignRequestStatus other); | ^~~~~~~ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:77:40: error: 'CertificateOCSP' is not a member of 'evse_security'; did you mean 'CertificateType'? 77 | CertificateOCSP to_ocpp(evse_security::CertificateOCSP other); | ^~~~~~~~~~~~~~~ | CertificateType /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:78:17: error: conflicting declaration 'ocpp::CertificateInfo ocpp::conversions::to_ocpp' 78 | CertificateInfo to_ocpp(evse_security::CertificateInfo other); | ^~~~~~~ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:64:33: note: previous declaration as 'ocpp::GetCertificateSignRequestStatus ocpp::conversions::to_ocpp' 64 | GetCertificateSignRequestStatus to_ocpp(evse_security::GetCertificateSignRequestStatus other); | ^~~~~~~ /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:78:40: error: 'CertificateInfo' is not a member of 'evse_security'; did you mean 'CertificateType'? 78 | CertificateInfo to_ocpp(evse_security::CertificateInfo other); | ^~~~~~~~~~~~~~~ | CertificateType /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:91:16: error: 'CertificateOCSP' in namespace 'evse_security' does not name a type; did you mean 'CertificateType'? 91 | evse_security::CertificateOCSP from_ocpp(CertificateOCSP other); | ^~~~~~~~~~~~~~~ | CertificateType /ext/source/build-cross/_deps/libocpp-src/include/ocpp/common/evse_security_impl.hpp:92:16: error: 'CertificateInfo' in namespace 'evse_security' does not name a type; did you mean 'CertificateType'? 92 | evse_security::CertificateInfo from_ocpp(CertificateInfo other); | ^~~~~~~~~~~~~~~ | CertificateType [ 82%] Linking CXX executable DCSupplySimulator/DCSupplySimulator make[2]: Entering directory '/ext/source/build-cross' make[2]: Leaving directory '/ext/source/build-cross' make[2]: Entering directory '/ext/source/build-cross' [ 82%] Building CXX object modules/CMakeFiles/PN532TokenProvider.dir/PN532TokenProvider/PN532TokenProvider.cpp.o make[2]: Leaving directory '/ext/source/build-cross' [ 82%] Built target DCSupplySimulator [ 82%] Building CXX object modules/CMakeFiles/Auth.dir/__/generated/modules/Auth/ld-ev.cpp.o [ 82%] Linking CXX executable IMDSimulator/IMDSimulator make[2]: Leaving directory '/ext/source/build-cross' [ 82%] Built target IMDSimulator [ 82%] Building CXX object _deps/libocpp-build/lib/CMakeFiles/ocpp.dir/ocpp/common/schemas.cpp.o make[2]: *** [_deps/libocpp-build/lib/CMakeFiles/ocpp.dir/build.make:90: _deps/libocpp-build/lib/CMakeFiles/ocpp.dir/ocpp/common/charging_station_base.cpp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... [ 82%] Building CXX object modules/CMakeFiles/Auth.dir/Auth/main/authImpl.cpp.o In file included from /ext/source/lib/staging/evse_security/conversions.cpp:6: /ext/source/lib/staging/evse_security/../evse_security/conversions.hpp:27:16: error: 'CertificateInfo' in namespace 'evse_security' does not name a type; did you mean 'CertificateType'? 27 | evse_security::CertificateInfo from_everest(types::evse_security::CertificateInfo other); | ^~~~~~~~~~~~~~~ | CertificateType /ext/source/lib/staging/evse_security/../evse_security/conversions.hpp:38:81: error: 'types::evse_security::GetCertificateSignRequestStatus module::conversions::to_everest' redeclared as different kind of entity 38 | types::evse_security::GetCertificateSignRequestStatus to_everest(evse_security::GetCertificateSignRequestStatus other); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /ext/source/lib/staging/evse_security/../evse_security/conversions.hpp:37:54: note: previous declaration 'types::evse_security::GetInstalledCertificatesStatus module::conversions::to_everest(evse_security::GetInstalledCertificatesStatus)' 37 | types::evse_security::GetInstalledCertificatesStatus to_everest(evse_security::GetInstalledCertificatesStatus other); | ^~~~~~~~~~ /ext/source/lib/staging/evse_security/../evse_security/conversions.hpp:38:81: error: 'GetCertificateSignRequestStatus' is not a member of 'evse_security'; did you mean 'types::evse_security::GetCertificateSignRequestStatus'? 38 | types::evse_security::GetCertificateSignRequestStatus to_everest(evse_security::GetCertificateSignRequestStatus other); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /ext/source/build-cross/generated/include/generated/interfaces/evse_security/Types.hpp:19, from /ext/source/build-cross/generated/include/generated/interfaces/evse_security/Implementation.hpp:18, from /ext/source/lib/staging/evse_security/../evse_security/conversions.hpp:7, from /ext/source/lib/staging/evse_security/conversions.cpp:6: /ext/source/build-cross/generated/include/generated/types/evse_security.hpp:510:12: note: 'types::evse_security::GetCertificateSignRequestStatus' declared here 510 | enum class GetCertificateSignRequestStatus | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /ext/source/lib/staging/evse_security/conversions.cpp:6: /ext/source/lib/staging/evse_security/../evse_security/conversions.hpp:39:74: error: 'types::evse_security::GetCertificateInfoStatus module::conversions::to_everest' redeclared as different kind of entity 39 | types::evse_security::GetCertificateInfoStatus to_everest(evse_security::GetCertificateInfoStatus other); | ^~~~~~~~~~~~~~~~~~~~~~~~ /ext/source/lib/staging/evse_security/../evse_security/conversions.hpp:37:54: note: previous declaration 'types::evse_security::GetInstalledCertificatesStatus module::conversions::to_everest(evse_security::GetInstalledCertificatesStatus)' 37 | types::evse_security::GetInstalledCertificatesStatus to_everest(evse_security::GetInstalledCertificatesStatus other); | ^~~~~~~~~~ /ext/source/lib/staging/evse_security/../evse_security/conversions.hpp:39:74: error: 'GetCertificateInfoStatus' is not a member of 'evse_security'; did you mean 'types::evse_security::GetCertificateInfoStatus'? 39 | types::evse_security::GetCertificateInfoStatus to_everest(evse_security::GetCertificateInfoStatus other); | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /ext/source/build-cross/generated/include/generated/interfaces/evse_security/Types.hpp:19, from /ext/source/build-cross/generated/include/generated/interfaces/evse_security/Implementation.hpp:18, from /ext/source/lib/staging/evse_security/../evse_security/conversions.hpp:7, from /ext/source/lib/staging/evse_security/conversions.cpp:6: /ext/source/build-cross/generated/include/generated/types/evse_security.hpp:562:12: note: 'types::evse_security::GetCertificateInfoStatus' declared here 562 | enum class GetCertificateInfoStatus | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /ext/source/lib/staging/evse_security/conversions.cpp:6: /ext/source/lib/staging/evse_security/../evse_security/conversions.hpp:46:65: error: 'types::evse_security::CertificateInfo module::conversions::to_everest' redeclared as different kind of entity 46 | types::evse_security::CertificateInfo to_everest(evse_security::CertificateInfo other); | ^~~~~~~~~~~~~~~ /ext/source/lib/staging/evse_security/../evse_security/conversions.hpp:45:43: note: previous declaration 'types::evse_security::OCSPRequestDataList module::conversions::to_everest(evse_security::OCSPRequestDataList)' 45 | types::evse_security::OCSPRequestDataList to_everest(evse_security::OCSPRequestDataList other); | ^~~~~~~~~~ /ext/source/lib/staging/evse_security/../evse_security/conversions.hpp:46:65: error: 'CertificateInfo' is not a member of 'evse_security'; did you mean 'CertificateType'? 46 | types::evse_security::CertificateInfo to_everest(evse_security::CertificateInfo other); | ^~~~~~~~~~~~~~~ | CertificateType /ext/source/lib/staging/evse_security/conversions.cpp:191:16: error: 'CertificateOCSP' in namespace 'evse_security' does not name a type; did you mean 'CertificateType'? 191 | evse_security::CertificateOCSP from_everest(types::evse_security::CertificateOCSP other) { | ^~~~~~~~~~~~~~~ | CertificateType /ext/source/lib/staging/evse_security/conversions.cpp:202:16: error: 'CertificateInfo' in namespace 'evse_security' does not name a type; did you mean 'CertificateType'? 202 | evse_security::CertificateInfo from_everest(types::evse_security::CertificateInfo other) { | ^~~~~~~~~~~~~~~ | CertificateType /ext/source/lib/staging/evse_security/conversions.cpp:366:81: error: 'types::evse_security::GetCertificateSignRequestStatus module::conversions::to_everest' redeclared as different kind of entity 366 | types::evse_security::GetCertificateSignRequestStatus to_everest(evse_security::GetCertificateSignRequestStatus other) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /ext/source/lib/staging/evse_security/conversions.cpp:6: /ext/source/lib/staging/evse_security/../evse_security/conversions.hpp:45:43: note: previous declaration 'types::evse_security::OCSPRequestDataList module::conversions::to_everest(evse_security::OCSPRequestDataList)' 45 | types::evse_security::OCSPRequestDataList to_everest(evse_security::OCSPRequestDataList other); | ^~~~~~~~~~ /ext/source/lib/staging/evse_security/conversions.cpp:366:81: error: 'GetCertificateSignRequestStatus' is not a member of 'evse_security'; did you mean 'types::evse_security::GetCertificateSignRequestStatus'? 366 | types::evse_security::GetCertificateSignRequestStatus to_everest(evse_security::GetCertificateSignRequestStatus other) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /ext/source/build-cross/generated/include/generated/interfaces/evse_security/Types.hpp:19, from /ext/source/build-cross/generated/include/generated/interfaces/evse_security/Implementation.hpp:18, from /ext/source/lib/staging/evse_security/../evse_security/conversions.hpp:7, from /ext/source/lib/staging/evse_security/conversions.cpp:6: /ext/source/build-cross/generated/include/generated/types/evse_security.hpp:510:12: note: 'types::evse_security::GetCertificateSignRequestStatus' declared here 510 | enum class GetCertificateSignRequestStatus | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /ext/source/lib/staging/evse_security/conversions.cpp:382:74: error: 'types::evse_security::GetCertificateInfoStatus module::conversions::to_everest' redeclared as different kind of entity 382 | types::evse_security::GetCertificateInfoStatus to_everest(evse_security::GetCertificateInfoStatus other) { | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /ext/source/lib/staging/evse_security/conversions.cpp:6: /ext/source/lib/staging/evse_security/../evse_security/conversions.hpp:45:43: note: previous declaration 'types::evse_security::OCSPRequestDataList module::conversions::to_everest(evse_security::OCSPRequestDataList)' 45 | types::evse_security::OCSPRequestDataList to_everest(evse_security::OCSPRequestDataList other); | ^~~~~~~~~~ /ext/source/lib/staging/evse_security/conversions.cpp:382:74: error: 'GetCertificateInfoStatus' is not a member of 'evse_security'; did you mean 'types::evse_security::GetCertificateInfoStatus'? 382 | types::evse_security::GetCertificateInfoStatus to_everest(evse_security::GetCertificateInfoStatus other) { | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /ext/source/build-cross/generated/include/generated/interfaces/evse_security/Types.hpp:19, from /ext/source/build-cross/generated/include/generated/interfaces/evse_security/Implementation.hpp:18, from /ext/source/lib/staging/evse_security/../evse_security/conversions.hpp:7, from /ext/source/lib/staging/evse_security/conversions.cpp:6: /ext/source/build-cross/generated/include/generated/types/evse_security.hpp:562:12: note: 'types::evse_security::GetCertificateInfoStatus' declared here 562 | enum class GetCertificateInfoStatus | ^~~~~~~~~~~~~~~~~~~~~~~~ /ext/source/lib/staging/evse_security/conversions.cpp:451:65: error: 'types::evse_security::CertificateInfo module::conversions::to_everest' redeclared as different kind of entity 451 | types::evse_security::CertificateInfo to_everest(evse_security::CertificateInfo other) { | ^~~~~~~~~~~~~~~ /ext/source/lib/staging/evse_security/conversions.cpp:443:43: note: previous declaration 'types::evse_security::OCSPRequestDataList module::conversions::to_everest(evse_security::OCSPRequestDataList)' 443 | types::evse_security::OCSPRequestDataList to_everest(evse_security::OCSPRequestDataList other) { | ^~~~~~~~~~ /ext/source/lib/staging/evse_security/conversions.cpp:451:65: error: 'CertificateInfo' is not a member of 'evse_security'; did you mean 'CertificateType'? 451 | types::evse_security::CertificateInfo to_everest(evse_security::CertificateInfo other) { | ^~~~~~~~~~~~~~~ | CertificateType [ 82%] Building CXX object modules/CMakeFiles/PN532TokenProvider.dir/__/generated/modules/PN532TokenProvider/ld-ev.cpp.o make[2]: *** [lib/staging/evse_security/CMakeFiles/evse_security_conversions.dir/build.make:76: lib/staging/evse_security/CMakeFiles/evse_security_conversions.dir/conversions.cpp.o] Error 1 make[2]: Leaving directory '/ext/source/build-cross' make[1]: *** [CMakeFiles/Makefile2:4459: lib/staging/evse_security/CMakeFiles/evse_security_conversions.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 82%] Building CXX object modules/CMakeFiles/PN532TokenProvider.dir/PN532TokenProvider/main/auth_token_providerImpl.cpp.o [ 82%] Building CXX object modules/CMakeFiles/Auth.dir/Auth/reservation/reservationImpl.cpp.o make[2]: Leaving directory '/ext/source/build-cross' make[1]: *** [CMakeFiles/Makefile2:4138: _deps/libocpp-build/lib/CMakeFiles/ocpp.dir/all] Error 2 [ 82%] Linking CXX executable PN532TokenProvider/PN532TokenProvider make[2]: Leaving directory '/ext/source/build-cross' [ 82%] Built target PN532TokenProvider [ 82%] Linking CXX executable Auth/Auth make[2]: Leaving directory '/ext/source/build-cross' [ 82%] Built target Auth make[1]: Leaving directory '/ext/source/build-cross' make: *** [Makefile:156: all] Error 2 make: Leaving directory '/ext/source/build-cross' ```
Going back to `4330ce2e28e25535dd01558edb2331891c146769` and changing both `openssl_supplier` and `evse_security` , we get Regular compile works ``` # make install -j6 -- Up-to-date: /ext/source/build/dist/libexec/everest/modules/TestErrorHandling/manifest.yaml -- Up-to-date: /ext/source/build/dist/etc/everest/. -- Up-to-date: /ext/source/build/dist/etc/everest/./config-test-error-history-module.yaml -- Up-to-date: /ext/source/build/dist/etc/everest/./config-test-cpp-error-handling.yaml ``` Cross-compile generates the error ``` /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp: In static member function 'static evse_security::CertificateValidationResult evse_security::OpenSSLSupplier::x509_verify_certificate_chain(evse_security::X509Handle*, const std::vector&, const std::vector&, bool, std::optional, std::optional)': /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:599:21: error: 'X509_ADD_FLAG_NO_DUP' was not declared in this scope; did you mean 'X509_FLAG_NO_AUX'? 599 | int flags = X509_ADD_FLAG_NO_DUP | X509_ADD_FLAG_NO_SS; | ^~~~~~~~~~~~~~~~~~~~ | X509_FLAG_NO_AUX /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:599:44: error: 'X509_ADD_FLAG_NO_SS' was not declared in this scope; did you mean 'X509_FLAG_NO_IDS'? 599 | int flags = X509_ADD_FLAG_NO_DUP | X509_ADD_FLAG_NO_SS; | ^~~~~~~~~~~~~~~~~~~ | X509_FLAG_NO_IDS /ext/source/build-cross/_deps/libevse-security-src/lib/evse_security/crypto/openssl/openssl_supplier.cpp:602:22: error: 'X509_add_cert' was not declared in this scope; did you mean 'X509_add_ext'? 602 | if (1 != X509_add_cert(untrusted.get(), get(untrusted_cert), flags)) { | ^~~~~~~~~~~~~ | X509_add_ext make[2]: *** [_deps/libevse-security-build/lib/evse_security/CMakeFiles/evse_security.dir/build.make:188: _deps/libevse-security-build/lib/evse_security/CMakeFiles/evse_security.dir/crypto/openssl/openssl_supplier.cpp.o] Error 1 make[2]: Leaving directory '/ext/source/build-cross' make[1]: *** [CMakeFiles/Makefile2:4108: _deps/libevse-security-build/lib/evse_security/CMakeFiles/evse_security.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... ```
Reverting only lines 593-611 from https://github.com/EVerest/libevse-security/commit/acc12fe5353d8090fc8cb0a84564b52ad7301e51#diff-9b5e7ace83962c09e4fd78bac64e78b58816ec321a0ef6ecf90c97493d1ff6c6R593 and replacing it with old line 594 gives us the const errors ``` /ext/source/build-cross/_deps/libocpp-src/lib/ocpp/common/websocket/websocket_libwebsockets.cpp:164:48: error: invalid conversion from 'const X509_STORE_CTX*' {aka 'const x509_store_ctx_st*'} to 'X509_STORE_CTX*' {aka 'x509_store_ctx_st*'} [-fpermissive] 164 | int depth = X509_STORE_CTX_get_error_depth(ctx); | ^~~ | | | const X509_STORE_CTX* {aka const x509_store_ctx_st*} In file included from /bullseye-toolchain/sysroot/usr/include/openssl/x509.h:320, from /bullseye-toolchain/sysroot/usr/include/openssl/ssl.h:20, from /ext/source/build-cross/_deps/libwebsockets-src/lib/../include/libwebsockets.h:308, from /ext/source/build-cross/_deps/libocpp-src/lib/ocpp/common/websocket/websocket_libwebsockets.cpp:8: /bullseye-toolchain/sysroot/usr/include/openssl/x509_vfy.h:495:52: note: initializing argument 1 of 'int X509_STORE_CTX_get_error_depth(X509_STORE_CTX*)' 495 | int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); | ~~~~~~~~~~~~~~~~^~~ /ext/source/build-cross/_deps/libocpp-src/lib/ocpp/common/websocket/websocket_libwebsockets.cpp:167:46: error: invalid conversion from 'const X509_STORE_CTX*' {aka 'const x509_store_ctx_st*'} to 'X509_STORE_CTX*' {aka 'x509_store_ctx_st*'} [-fpermissive] 167 | int error = X509_STORE_CTX_get_error(ctx); | ^~~ | | | const X509_STORE_CTX* {aka const x509_store_ctx_st*} In file included from /bullseye-toolchain/sysroot/usr/include/openssl/x509.h:320, from /bullseye-toolchain/sysroot/usr/include/openssl/ssl.h:20, from /ext/source/build-cross/_deps/libwebsockets-src/lib/../include/libwebsockets.h:308, from /ext/source/build-cross/_deps/libocpp-src/lib/ocpp/common/websocket/websocket_libwebsockets.cpp:8: /bullseye-toolchain/sysroot/usr/include/openssl/x509_vfy.h:493:46: note: initializing argument 1 of 'int X509_STORE_CTX_get_error(X509_STORE_CTX*)' 493 | int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); | ~~~~~~~~~~~~~~~~^~~ /ext/source/build-cross/_deps/libocpp-src/lib/ocpp/common/websocket/websocket_libwebsockets.cpp:175:61: error: invalid conversion from 'const X509_STORE_CTX*' {aka 'const x509_store_ctx_st*'} to 'X509_STORE_CTX*' {aka 'x509_store_ctx_st*'} [-fpermissive] 175 | X509* server_cert = X509_STORE_CTX_get_current_cert(ctx); | ^~~ | | | const X509_STORE_CTX* {aka const x509_store_ctx_st*} In file included from /bullseye-toolchain/sysroot/usr/include/openssl/x509.h:320, from /bullseye-toolchain/sysroot/usr/include/openssl/ssl.h:20, from /ext/source/build-cross/_deps/libwebsockets-src/lib/../include/libwebsockets.h:308, from /ext/source/build-cross/_deps/libocpp-src/lib/ocpp/common/websocket/websocket_libwebsockets.cpp:8: /bullseye-toolchain/sysroot/usr/include/openssl/x509_vfy.h:497:55: note: initializing argument 1 of 'X509* X509_STORE_CTX_get_current_cert(X509_STORE_CTX*)' 497 | X509 *X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); | ~~~~~~~~~~~~~~~~^~~ [ 89%] Building CXX object _deps/libocpp-build/lib/CMakeFiles/ocpp.dir/ocpp/v16/messages/CertificateSigned.cpp.o ```
Fixing the const issue per https://github.com/EVerest/everest-demo/issues/51#issuecomment-2166951509 worked! ``` [100%] Building CXX object modules/CMakeFiles/OCPP201.dir/OCPP201/ocpp_generic/ocppImpl.cpp.o make[2]: Leaving directory '/ext/source/build-cross' [100%] Built target OCPP [100%] Linking CXX executable OCPP201/OCPP201 make[2]: Leaving directory '/ext/source/build-cross' [100%] Built target OCPP201 make[1]: Leaving directory '/ext/source/build-cross' make: Leaving directory '/ext/source/build-cross' ```

Image with cross-compile set up: https://github.com/US-JOET/everest-demo/pkgs/container/everest-demo%2Fmanager/255301468?tag=cross-compile-charin-e2e-demo

faizanmir21 commented 3 months ago

Build cross-compile with the above image. Copied and sent to local machine.

docker cp <container_id>:/ext/source/build-cross ~/Downloads

shankari commented 3 months ago

great! so are we now able to launch everest on the uMWC?

faizanmir21 commented 3 months ago

Sent the files to the uMWC charger rsync -a build-cross/dist/mnt/user_data/opt/everest/* everest@192.168.1.3:/mnt/user_data/opt/everest Tried loading config file sudo /opt/everest/bin/manager --conf ./opt/everest/etc/everest/config-sil-ocpp201-pnc.yaml

2024-08-15 22:40:25.518996 [ERRO] manager         void Everest::Config::load_and_validate_manifest(const string&, const json&) :: Failed to load and parse manifest file /opt/everest/libexec/everest/modules/JsEvManager/manifest.yaml: File 'manifest.(yaml|json)' does not exist
2024-08-15 22:40:25.524874 [ERRO] manager         int boot(const boost::program_options::variables_map&) :: Failed to load and validate config!
2024-08-15 22:40:25.525066 [CRIT] manager         int boot(const boost::program_options::variables_map&) :: Caught top level boost::exception:
/root/.cache/CPM/everest-framework/ce5ee983c9abaf1cea1f6f917c927b4a61d4acbb/everest-framework/lib/config.cpp(262): Throw in function void Everest::Config::load_and_validate_manifest(const string&, const json&)
Dynamic exception type: boost::wrapexcept<Everest::EverestConfigError>
std::exception::what: Failed to load and parse manifest file /opt/everest/libexec/everest/modules/JsEvManager/manifest.yaml: File 'manifest.(yaml|json)' does not exist
[boost::log::v2_mt_posix::current_scope_info_tag*] = Everest::Config::Config(std::shared_ptr<Everest::RuntimeSettings>, bool)

Copied config-sil-ocpp201-pnc.yaml file from charin-e2e-demo branch of US-JOET/everest-demo Loaded new config file but ran into the same error

2024-08-15 23:20:23.545244 [ERRO] manager         void Everest::Config::load_and_validate_manifest(const string&, const json&) :: Failed to load and parse manifest file /opt/everest/libexec/everest/modules/JsEvManager/manifest.yaml: File 'manifest.(yaml|json)' does not exist
2024-08-15 23:20:23.551141 [ERRO] manager         int boot(const boost::program_options::variables_map&) :: Failed to load and validate config!
2024-08-15 23:20:23.551304 [CRIT] manager         int boot(const boost::program_options::variables_map&) :: Caught top level boost::exception:
/root/.cache/CPM/everest-framework/ce5ee983c9abaf1cea1f6f917c927b4a61d4acbb/everest-framework/lib/config.cpp(262): Throw in function void Everest::Config::load_and_validate_manifest(const string&, const json&)
Dynamic exception type: boost::wrapexcept<Everest::EverestConfigError>
std::exception::what: Failed to load and parse manifest file /opt/everest/libexec/everest/modules/JsEvManager/manifest.yaml: File 'manifest.(yaml|json)' does not exist
[boost::log::v2_mt_posix::current_scope_info_tag*] = Everest::Config::Config(std::shared_ptr<Everest::RuntimeSettings>, bool)

The error says the manifest.(yaml | json) does not exist but I am able to locate it here /opt/everest/libexec/everest/modules/JsEvManager/manifest.yaml