vapier / pcalc

command line util for doing hex/dec/oct/bin math quickly

Home Page:https://vapier.github.io/pcalc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

linking on macOS fails: lexer lib is -ll instead of -lfl

Gairlochan opened this issue · comments

Just thought I'd let you know it compiles fine on OS X if you change line 14 of the makefile from:
LDLIBS += -lm lfl
to:
LDLIBS += -lm ll

Hello, just bumped into this... if you're willing to use GNU extensions, here's a permanent fix:

UNAME = $(shell uname -s)

ifeq ($(UNAME),Darwin)
	LDLIBS   += -lm -ll
else
	LDLIBS   += -lm -lfl
endif

Here's the modified Makefile.

does macOS use flex and bison by default ? or are you changing those as well ?

it's a bit odd if macOS provided flex but not -lfl.

I have /usr/bin/flex (version flex 2.5.35 Apple(flex-31)). Don't have a vanilla macOS to check right now. I am assuming it is part of the Xcode command line tools that one installs with xcode-select --install.

No bison by default. Compile from GNU source or install with homebrew or macports.

As for the oddness, I don't have the mileage to answer. MacOS being of BSD descent, I would assume this to be historical in the System V vs. BSD race of the 80s (i.e. lex and yacc vs flex and Berkeley yacc).

the fix was embarrassingly easier to pull off. just force it to a compile-time constant and don't link anything in at all.