Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenSSL Not Detected #98

Open
tekktonic opened this issue Dec 28, 2020 · 4 comments
Open

OpenSSL Not Detected #98

tekktonic opened this issue Dec 28, 2020 · 4 comments

Comments

@tekktonic
Copy link

Debian Testing (11), openssl 1.1.1i-1 is installed (normal and dev packages)

The makefile says that it can't find any suitable SSL library, it doesn't give any helpful info beyond that (is there a way to get the makefile to be noisier?)

Building with cmake includes a fio_tls_openssl.o file in the archive, so I assume that it works correctly there.

@boazsegev
Copy link
Owner

Hi @tekktonic ,

Thank you for opening this issue and for your interest win facil.io.

The TLS/SSL verification tests attempts to compile and run a small piece of C code in the make file. If you have OpenSSL 1.1.x and this fails that the most likely explanation is that OpenSSL is missing from either LIBRARY_PATH (library files) or CPATH (header / include files).

If you use pkg-config, these locations *should be added automatically by the makefile - but I don't have pkg-config, so I don't remember testing this codepath (it's there for my linux machine, but I think OpenSSL is in the LIBRARY_PATH on that one)...

... You can review the final CFLAGS and LINKER_FLAGS values using make vars.

If this doesn't help, you can get a more detailed error message by erasing the error print redirection in the makefile's test functions by deleting the 2> /dev/null on lines 199-200 of the makefile.

Good luck! And if you discover anything that would be fun to incorporate, please let me know.

Kindly,
Boaz.

@tekktonic
Copy link
Author

tekktonic commented Dec 28, 2020

Well that was a pretty quick find. gcc can be picky about the order of ldflags. This diff fixes it:

diff --git a/makefile b/makefile
index 3fbcfcf4..ea1cdac3 100644
--- a/makefile
+++ b/makefile
@@ -196,8 +196,8 @@ OBJS_DEPENDENCY:=$(LIB_OBJS:.o=.d) $(MAIN_OBJS:.o=.d)
 # TRY_COMPILE_AND_RUN returns the program's shell code as string.
 #############################################################################
 
-TRY_COMPILE=$(shell printf $(1) | $(CC) $(INCLUDE_STR) $(LDFLAGS) $(2) -xc -o /dev/null - >> /dev/null 2> /dev/null ; echo $$? 2> /dev/null)
-TRY_COMPILE_AND_RUN=$(shell printf $(1) | $(CC) $(2) -xc -o ./___fio_tmp_test_ - 2> /dev/null ; ./___fio_tmp_test_ >> /dev/null 2> /dev/null; echo $$?; rm ./___fio_tmp_test_ 2> /dev/null)
+TRY_COMPILE=$(shell printf $(1) | $(CC) $(INCLUDE_STR) -xc -o /dev/null - $(2) $(LDFLAGS) >> /dev/null 2> /dev/null ; echo $$? 2> /dev/null)
+TRY_COMPILE_AND_RUN=$(shell printf $(1) | $(CC) -xc -o ./___fio_tmp_test_ - $(2) 2> /dev/null ; ./___fio_tmp_test_ >> /dev/null 2> /dev/null; echo $$?; rm ./___fio_tmp_test_ 2> /dev/null)
 EMPTY:=
 
 #############################################################################

I can open it as a pr if you prefer, I just didn't want to go through the trouble of forking, applying the change on my fork, and opening it when the diff is trivial.

@boazsegev
Copy link
Owner

Thanks! I'll add this in :)

@tekktonic
Copy link
Author

Sure thing! I realized after I commented that I missed the line below, so make sure you grab the version now (2 lines changed) :)

boazsegev added a commit to facil-io/cstl that referenced this issue Dec 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants