No longer able to build snap: fatal error on openssl/conf.h

I am no longer able to build a snap that I successfully built just a week ago, without any significant changes in the corresponding part of the code. It fails because it cannot find a C++ include file from boost library. I have no issues building the application locally. Here’s what I get from snapcraft:

In file included from /usr/include/boost/asio/ssl/context_base.hpp:19,
                 from /usr/include/boost/asio/ssl/context.hpp:23,
                 from /usr/include/boost/asio/ssl.hpp:18,
                 from ./ServerProvider.cpp:24:
/usr/include/boost/asio/ssl/detail/openssl_types.hpp:23:10: fatal error: openssl/conf.h: No such file or directory
   23 | #include <openssl/conf.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.

Nothing was changed in yaml file, I am including the same build packages and stage packages as before and by base version is the same, core20. Essentially nothing was modified in .yaml other than snap version:

      - g++
      - make
      - libboost-program-options-dev
      - libboost-system-dev   # ssl
      - libsdl2-dev
      - libsdl2-ttf-dev
      - libsdl2-image-dev
      - libsdl2-mixer-dev
      - libsdl2-net-dev
      - openssl               # ssl
      - libsdl2-2.0-0
      - libsdl2-ttf-2.0-0
      - libsdl2-image-2.0-0
      - libsdl2-mixer-2.0-0
      - libsdl2-net-2.0-0
      - libgl1-mesa-dri
      - libglu1-mesa
      - libgl1-mesa-glx
      - libpulse0
      - libasound2
      - libboost-program-options1.71.0
      - libboost-system1.71.0     # ssl
      - libssl-dev                # ssl

Is this possible that something got broken with boost ssl on your end?

P.S. I just reverted all my changes to the week-ago version. snapcraft fails to build with the same error, so I know it’s something on snapcraft’s end. Please fix it.

Problem solved. All I had to do is to replace - openssl in build-packages part with - libssl-dev (already present in stage-packages of the .yaml). The compiler error is gone and snap builds. Why this was not causing any issues until today is beyond me.

1 Like