Skip to contentSkip to conversation

Using openssl functions in another package

Buildroot David Van Arnem 2 participants 2 messages Nov 20, 2015

lore
Share & tools
lore
#0 lore raw

Hi all,

I have a custom package (source in C) that uses some of OpenSSL's SHA functions to perform hashing. I can build successfully outside of the buildroot tree by both including the SHA header file in the C source with:

#include <openssl/sha.h>

and then adding the crypto library in the CC command:

$(CC) -lcrypto -o prog prog.c

However, when I try to build the package in buildroot, using the same CC command in the Makefile, I get the following error:

prog.c: fatal error: openssl/sha.h: No such file or directory

I have enabled the openssl package in my buildroot configuration, and set up my custom package's Config.in to depend on it:

depends on BR2_PACKAGE_OPENSSL

My target is a MicroBlaze (little endian, single core) processor. What else might I need to do to use the OpenSSL SHA functions correctly and avoid this error?

Signature · 2 lines
Thanks,
David
#1 lore raw
Quoted 11 lines · David Van Arnem

Hi all,

I have a custom package (source in C) that uses some of OpenSSL's SHA functions to perform hashing. I can build successfully outside of the buildroot tree by both including the SHA header file in the C source with:

#include <openssl/sha.h>

and then adding the crypto library in the CC command:

$(CC) -lcrypto -o prog prog.c

In general, instead of explicitly passing -lcrypto it is better to use
pkg-config to get the flags:

$(CC) pkg-config --cflags libcrypto --libs libcrypto -o prog prog.c

Quoted 10 lines

However, when I try to build the package in buildroot, using the same CC command in the Makefile, I get the following error:

prog.c: fatal error: openssl/sha.h: No such file or directory

I have enabled the openssl package in my buildroot configuration, and set up my custom package's Config.in to depend on it:

depends on BR2_PACKAGE_OPENSSL

Did you also add a dependency on openssl in the package.mk file? Do you pass
the correct CC in the package.mk file? Is the header properly installed in output/staging/usr/include/openssl?

Regards,
Arnout

Quoted 4 lines

My target is a MicroBlaze (little endian, single core) processor. What else might I need to do to use the OpenSSL SHA functions correctly and avoid this error?

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF