Skip to main content
Topic: Failed to find OpenSSL development headers. (Read 4321 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Failed to find OpenSSL development headers.

Folks,

I am trying to compile a rust program after upgrading openssl to
Code: [Select]
 openssl 3.0.7-2 
. The same program was compiling without any issue before the upgrade. Now it says, it could not find openssl development headers. Below is the trace

Code: [Select]
 --- stderr
  thread 'main' panicked at '
  Header expansion error:
  Error { kind: ToolExecError, message: "Command \"cc\" \"-O0\" \"-ffunction-sections\" \"-fdata-sections\" \"-fPIC\" \"-g\" \"-fno-omit-frame-pointer\" \"-m64\" \"-I\" \"/usr/include\" \"-Wall\" \"-Wextra\" \"-E\" \"build/expando.c\" with args \"cc\" did not execute successfully (status code exit status: 1)." }

  Failed to find OpenSSL development headers.

  You can try fixing this setting the `OPENSSL_DIR` environment variable
  pointing to your OpenSSL installation or installing OpenSSL headers package
  specific to your distribution:

      # On Ubuntu
      sudo apt-get install libssl-dev
      # On Arch Linux
      sudo pacman -S openssl
      # On Fedora
      sudo dnf install openssl-devel

  See rust-openssl README for more information:

      https://github.com/sfackler/rust-openssl#linux
  ', /home/russellb/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.60/build/main.rs:141:13
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

All I can understand from the error trace is that
Code: [Select]
 openssl-sys
could not able to find the openssl development headers present in the system. It asks to setup the path. I did set up the path to
Code: [Select]
/usr/include/openssl
however it didn't pick up. I am hoping to get a suggestion here. Is this the issue with the latest openssl upgrade? Any help is much appreciated.
Andromedan

Re: Failed to find OpenSSL development headers.

Reply #1
I have the same problem with python. This is a pretty serious issue, my getmail setup depends on it and can't work without it. Here's what the error I get when I run getmail after the upgrade:
Code: [Select]
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
Traceback (most recent call last):
  File "/usr/bin/getmail", line 59, in <module>
    from getmailcore import __version__, retrievers, destinations, filters, \
  File "/usr/lib/python2.7/site-packages/getmailcore/retrievers.py", line 45, in <module>
    from getmailcore._retrieverbases import *
  File "/usr/lib/python2.7/site-packages/getmailcore/_retrieverbases.py", line 317, in <module>
    class POP3_SSL_EXTENDED(poplib.POP3_SSL):
AttributeError: 'module' object has no attribute 'POP3_SSL'

Re: Failed to find OpenSSL development headers.

Reply #2
I'm not sure if that's a problem related to openssl since on python3 those hash functions exist:
Code: [Select]
# /usr/lib/python3.10/hashlib.py
...
__always_supported = ('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512',
                      'blake2b', 'blake2s',
                      'sha3_224', 'sha3_256', 'sha3_384', 'sha3_512',
                      'shake_128', 'shake_256')

importing them also works without a problem.

Re: Failed to find OpenSSL development headers.

Reply #3
I have the same problem with python. This is a pretty serious issue, my getmail setup depends on it and can't work without it. Here's what the error I get when I run getmail after the upgrade:
Code: [Select]
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 147, in <module>
You should probably migrate whatever you're using to python3. python2 isn't even in the repos anymore.

Re: Failed to find OpenSSL development headers.

Reply #4
I was able to solve my problem after updating today. Unfortunately, I did both a system and an AUR update so I'm not sure what solved it. It might have been the python2 AUR package. But yeah, I will listen to your recommendation and probably use a more modern tool.

Sorry if my issue wasn't directly related to OP's problem, I didn't mean to hijack the thread.

Re: Failed to find OpenSSL development headers.

Reply #5
Any suggestions on the original problem?
Andromedan

Re: Failed to find OpenSSL development headers.

Reply #6
in my system "openssl 3" broke many things. for now I recommend installing "openssl 1.1" it's on system repo.

if you have no problem, I'm guessing they fixed "openssl 3"

edit: sorry about misinformation.  the openssl has no problem

Re: Failed to find OpenSSL development headers.

Reply #7

if you have no problem, I'm guessing they fixed "openssl 3"


There is nothing to fix on our end with openssl3.

Reason stuff broke might be AUR package, you have to rebuild these.
Some packages might not support openssl3, as in the case for mumble, and there are pretty sure more that require openssl-1.1.

Re: Failed to find OpenSSL development headers.

Reply #8
A very cryptic and hard to debug issue with openssl3 that bit me was an AUR package (dell-command-configure) which put its own path in /opt on top of the ld.so.conf hierarchy. That package comes with its own libssl.so, which obviously broke the entire boot and hibernate/resume processes.

Daily reminder that if you use even a single third-party package on rolling distros you're on you own.

Re: Failed to find OpenSSL development headers.

Reply #9

There is nothing to fix on our end with openssl3.

Reason stuff broke might be AUR package, you have to rebuild these.
Some packages might not support openssl3, as in the case for mumble, and there are pretty sure more that require openssl-1.1.

I have no AUR package installed in my system. And now I installed
Code: [Select]
openssl-1.1
, however, the error still remain. It is an error when trying to compile
Code: [Select]
openssl-syn
crate.

Code: [Select]
  --- stderr
  thread 'main' panicked at '
  Header expansion error:
  Error { kind: ToolExecError, message: "Command \"cc\" \"-O0\" \"-ffunction-sections\" \"-fdata-sections\" \"-fPIC\" \"-g\" \"-fno-omit-frame-pointer\" \"-m64\" \"-I\" \"/usr/include\" \"-Wall\" \"-Wextra\" \"-E\" \"build/expando.c\" with args \"cc\" did not execute successfully (status code exit status: 1)." }

  Failed to find OpenSSL development headers.

  You can try fixing this setting the `OPENSSL_DIR` environment variable
  pointing to your OpenSSL installation or installing OpenSSL headers package
  specific to your distribution:

      # On Ubuntu
      sudo apt-get install libssl-dev
      # On Arch Linux
      sudo pacman -S openssl
      # On Fedora
      sudo dnf install openssl-devel

  See rust-openssl README for more information:

      https://github.com/sfackler/rust-openssl#linux
  ', /home/artik/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.60/build/main.rs:141:13
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

Even after installing
Code: [Select]
openssl-1.1
the same error. I now understand that it is to do with some non-standard location of openssl-dev headers. Any idea/suggestion how to debug this?
Andromedan

 

Re: Failed to find OpenSSL development headers.

Reply #10
be aware the openssl-1.1 runs by different command

Code: [Select]
$ openssl version
OpenSSL 3.0.7 1 Nov 2022 (Library: OpenSSL 3.0.7 1 Nov 2022)


$ openssl-1.1 version
OpenSSL 1.1.1s  1 Nov 2022

and opensl-1.1 library is located at

Code: [Select]
/usr/include/openssl-1.1/openssl/