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

can't make hash_extender on mac os 10.11 #4

Open
DogeWatch opened this issue May 10, 2016 · 2 comments
Open

can't make hash_extender on mac os 10.11 #4

DogeWatch opened this issue May 10, 2016 · 2 comments

Comments

@DogeWatch
Copy link

➜ hash_extender git:(master) ✗ make
[CC] buffer.o
[CC] formats.o
[CC] hash_extender.o
[CC] hash_extender_engine.o
[CC] test.o
[CC] util.o
[LD] hash_extender
Undefined symbols for architecture x86_64:
"_WHIRLPOOL_Final", referenced from:
_whirlpool_hash in hash_extender_engine.o
"_WHIRLPOOL_Init", referenced from:
_whirlpool_hash in hash_extender_engine.o
"_WHIRLPOOL_Update", referenced from:
_whirlpool_hash in hash_extender_engine.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [hash_extender] Error 1

how can I fix it

@iagox86
Copy link
Owner

iagox86 commented May 16, 2016

Hey, just wanted to reply and let you know that this is on my radar.

I don't have any Apple devices that I can really use, besides borrowing
from a friend, so if any devs with Apple experience are following, help
would be great. :)

If not, I'll attempt a fix in the next week or two!

Ron

On Mon, May 9, 2016 at 10:44 PM, DogeWatch notifications@github.com wrote:

➜ hash_extender git:(master) ✗ make
[CC] buffer.o
[CC] formats.o
[CC] hash_extender.o
[CC] hash_extender_engine.o
[CC] test.o
[CC] util.o
[LD] hash_extender
Undefined symbols for architecture x86_64:
"_WHIRLPOOL_Final", referenced from:
_whirlpool_hash in hash_extender_engine.o
"_WHIRLPOOL_Init", referenced from:
_whirlpool_hash in hash_extender_engine.o
"_WHIRLPOOL_Update", referenced from:
_whirlpool_hash in hash_extender_engine.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
make: *** [hash_extender] Error 1

how can I fix it


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#4

@creativecoder
Copy link

In case it's helpful, here's a Makefile I was able to use to compile hash_extender on an M1 Mac.

Be sure to install openssl with Homebrew first (brew install openssl), if you don't already have it in /opt/homebrew/opt/openssl/

# Checks if /usr/include/openssl/whrlpool.h exists, and set a define if it
# doesn't.
INCLUDE_OPENSSL		:= /opt/homebrew/include/openssl
INCLUDE_WHIRLPOOL	:= whrlpool.h
ifneq ($(shell ls $(INCLUDE_OPENSSL)/$(INCLUDE_WHIRLPOOL) 2>/dev/null), $(INCLUDE_OPENSSL)/$(INCLUDE_WHIRLPOOL))
WHIRLPOOL	:= -DDISABLE_WHIRLPOOL
endif

# Capture the operating system name for use by the preprocessor.
OS		:= $(shell uname | tr '/[[:lower:]]' '_[[:upper:]]')

# These are the specifications of the toolchain
CC		:= gcc
CFLAGS		:= -std=c89 -g -oS -Wall -Werror -Wno-deprecated -I/opt/homebrew/opt/openssl/include
CPPFLAGS	:= -D_DEFAULT_SOURCE -D$(OS) $(WHIRLPOOL)
ifeq ($(OS),DARWIN)
    LDFLAGS		:= -lssl -lcrypto -L/opt/homebrew/opt/openssl/lib/
else
    LDFLAGS		:= -lssl -lcrypto
endif

BIN_MAIN	:= hash_extender
BIN_TEST	:= hash_extender_test
BINS		:= $(BIN_MAIN) $(BIN_TEST)

SRCS		:= $(wildcard *.c)
OBJS		:= $(patsubst %.c,%.o,$(SRCS))
OBJS_MAIN	:= $(filter-out $(BIN_TEST).o,$(OBJS))
OBJS_TEST	:= $(filter-out $(BIN_MAIN).o,$(OBJS))

all: $(BINS)

$(BIN_MAIN): $(OBJS_MAIN)
	@echo [LD] $@
	@$(CC) $(CFLAGS) -o $(BIN_MAIN) $(OBJS_MAIN) $(LDFLAGS)

$(BIN_TEST): $(OBJS_TEST)
	@echo [LD] $@
	@$(CC) $(CFLAGS) -o $(BIN_TEST) $(OBJS_TEST) $(LDFLAGS)

%.o: %.c
	@echo [CC] $@
	@$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<

clean:
	@echo [RM] \*.o
	@rm -f $(OBJS)
	@echo [RM] $(BIN_MAIN)
	@rm -f $(BIN_MAIN)
	@echo [RM] $(BIN_TEST)
	@rm -f $(BIN_TEST)

The differences are

  • Changing /usr/include/openssl to /opt/homebrew/include/openssl
  • Adding -I/opt/homebrew/opt/openssl/include to CFLAGS

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

3 participants