Describe the bug

Unable to compile redis with a specific openssl version(1.1.1l) in Linux

To reproduce

  • docker run -it ubuntu:xenial /bin/bash
  • Download and compile openssl version 1.1.1l with prefix /root/openssl
  • In redis' base dir make BUILD_TLS=yes OPENSSL_PREFIX=/root/openssl

output:

...
MAKE hiredis
cd hiredis && make static USE_SSL=1
make[3]: Entering directory '/root/redis-unstable/deps/hiredis'
cc -std=c99 -pedantic -c -O3 -fPIC  -DHIREDIS_TEST_SSL -Wall -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -g -ggdb alloc.c
cc -std=c99 -pedantic -c -O3 -fPIC  -DHIREDIS_TEST_SSL -Wall -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -g -ggdb net.c
cc -std=c99 -pedantic -c -O3 -fPIC  -DHIREDIS_TEST_SSL -Wall -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -g -ggdb hiredis.c
cc -std=c99 -pedantic -c -O3 -fPIC  -DHIREDIS_TEST_SSL -Wall -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -g -ggdb sds.c
cc -std=c99 -pedantic -c -O3 -fPIC  -DHIREDIS_TEST_SSL -Wall -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -g -ggdb async.c
cc -std=c99 -pedantic -c -O3 -fPIC  -DHIREDIS_TEST_SSL -Wall -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -g -ggdb read.c
cc -std=c99 -pedantic -c -O3 -fPIC  -DHIREDIS_TEST_SSL -Wall -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -g -ggdb sockcompat.c
ar rcs libhiredis.a alloc.o net.o hiredis.o sds.o async.o read.o sockcompat.o
cc -std=c99 -pedantic -c -O3 -fPIC  -DHIREDIS_TEST_SSL -Wall -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -g -ggdb ssl.c
ssl.c:45:25: fatal error: openssl/ssl.h: No such file or directory
compilation terminated.
Makefile:223: recipe for target 'ssl.o' failed
make[3]: *** [ssl.o] Error 1
make[3]: Leaving directory '/root/redis-unstable/deps/hiredis'
Makefile:50: recipe for target 'hiredis' failed
make[2]: *** [hiredis] Error 2
make[2]: Leaving directory '/root/redis-unstable/deps'

Expected behavior

make BUILD_TLS=yes OPENSSL_PREFIX=/root/openssl Compiles and links with the specified openssl lib, NOT the system wide openssl.

Additional information

I'm trying to support TLS1.3 on ubuntu:xenial.

Comment From: yuniersoad

@yossigo I created https://github.com/redis/redis/pull/9567 to fix this, please review. Not sure if anything else is required in src/Makefile to make it work for all platforms (tested Linux & Macos)