Reputation: 153
I am working on a cryptography project and everything seemed to be running smoothly. Our professor provided us with the skeleton (makefile included). Now however I get this error:
gcc -O2 -Wall -c ske.c -o ske.o
In file included from ske.c:1:
./ske.h:4:10: fatal error: 'openssl/aes.h' file not found
#include <openssl/aes.h>
^~~~~~~~~~~~~~~
1 error generated.
make: *** [ske.o] Error 1
I've tried adding
CPPFLAGS="-I/usr/local/opt/openssl/include"
to the makefile and have installed and uninstalled openssl. Furthermore, the error is not limited to the aes.h header file, I've seen sha.h and a couple of others. Here is my makefile:
SOURCES := $(wildcard *.c)
OBJECTS := $(SOURCES:.c=.o)
HEADERS := $(wildcard *.h)
TARGETS := kem-enc
TSOURCE := $(wildcard tests/*.c)
TESTS := $(TSOURCE:.c=)
COMMON := -O2 -Wall
CFLAGS := $(CFLAGS) $(COMMON)
CC := gcc
LDADD := -lcrypto -lssl -lgmp
LD := $(CC)
LDFLAGS := -L/usr/local/opt/openssl/lib
DEFS :=
ifeq ($(shell uname),Linux)
DEFS += -DLINUX
endif
IMPL := ske.o rsa.o kem-enc.o
ifdef skel
IMPL := $(IMPL:.o=-skel.o)
endif
all : $(TARGETS)
.PHONY : all
# {{{ for debugging
debug : CFLAGS += -g -DDEBUG=1
debug : $(TARGETS) $(TESTS)
.PHONY : debug
# }}}
$(OBJECTS) : %.o : %.c $(HEADERS)
$(CC) $(CFLAGS) -c $< -o $@
$(TARGETS) : $(IMPL) prf.o
$(LD) $(LDFLAGS) -o $@ $^ $(LDADD)
tests : $(TESTS)
.PHONY : tests
$(TESTS) : % : %.o $(filter-out kem-enc.o,$(IMPL)) prf.o
$(LD) $(LDFLAGS) -o $@ $^ $(LDADD)
.PHONY : clean
clean :
rm -f $(OBJECTS) $(TARGETS) $(TESTS) $(TSOURCE:.c=.o)
I am running Mac OS Mojave. Does anyone have any idea how to fix this??
Upvotes: 1
Views: 961
Reputation: 153
Got it working. Here's what I did.
-lopenssl
flag from LDADD
.-I/usr/local/opt/openssl/include
to CFlAGS
after the text that was already there.Now it works!!
Upvotes: 1