-
Notifications
You must be signed in to change notification settings - Fork 53
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
Bug: history lib not found, even though it is there #155
Comments
Hello @asharpe-git 👋, The I use HomeBrew on macOS 15.2, so let me first explain how that builds calc: The HomeBrew code is controlled in # Handle the case where macOS is being used with HomeBrew
# # and using the readline, history, and ncurses libraries.
# #
ifneq ($(HOMEBREW_PREFIX),)
READLINE_LIB:= -L${HOMEBREW_PREFIX}/opt/readline/lib -lreadline
READLINE_INCLUDE:= -I${HOMEBREW_PREFIX}/opt/readline/include
endif # ($(HOMEBREW_PREFIX),) This works because HomeBrew sets the following environment variable: export HOMEBREW_PREFIX=/opt/homebrew This results in: cc -DCALC_SRC -DCUSTOM -Wall -Wextra -pedantic -UUNBAN -fPIC -O3 -g3 -Wno-strict-prototypes -DUSE_READLINE -I/opt/homebrew/opt/readline/include \
-c hist.c
...
cc calc.o -Wl,-dead_strip -Wl,-dead_strip_dylibs libcalc.2.15.1.0.dylib libcustcalc.2.15.1.0.dylib \
-L/opt/homebrew/opt/readline/lib -lreadline -lhistory -lncurses -o calc I'm guessing that somehow you compiled So I'm guessing that setting So I'm guessing that this might work for you:
If that is the case, you could compile calc more "automatically" by adding to the borrow of READLINE_LIB:= -L/opt/local/lib -lreadline QUESTIONIs there an equivalent environment variable to If there is, then a similar set of lines could be added to |
Hi Landon! Yes, you are absolutely correct, your make invocation with READLINE_LIB worked. Macports doesn't put anything like a home directory for it, all it does is put the following in your .bash_profile:
I'd expect that if there was such a thing, it would have put it there, too. I took a quick look at some of the Macports doc, here: https://guide.macports.org/#installing.shell , but that is unhelpful. I guess they just expect you to use DYLD_LIBRARY_PATH or some such. Thanks again for your help. After using calc for something like 40 years, even though I can use a browser, I still find it quicker to use. |
Auto detecting macports readlineHello @asharpe-git and @pmetzger, As a followup to this issue and to GH-issuecomment-2585679510 plus GH-issuecomment-2585899967: We wish to modify Please apply the follow patch to diff --git a/Makefile.config b/Makefile.config
index 4af112c..88d9815 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -1137,6 +1137,16 @@ READLINE_INCLUDE=
ifneq ($(HOMEBREW_PREFIX),)
READLINE_LIB:= -L${HOMEBREW_PREFIX}/opt/readline/lib -lreadline
READLINE_INCLUDE:= -I${HOMEBREW_PREFIX}/opt/readline/include
+
+# If not HomeBrew, then try to detect macports and/or using /opt/local/{lib,include}
+#
+else # perhaps macports and/or using /opt/local/{lib,include} ?
+ifneq ($(wildcard /opt/local/lib/*),)
+READLINE_LIB:= -L/opt/local/lib -lreadline
+endif
+ifneq ($(wildcard /opt/local/incliude/*),)
+READLINE_INCLUDE:= -I/opt/local/include
+endif
endif # ($(HOMEBREW_PREFIX),)
# If $PAGER is not set, use this program to display a help file Does that work for folks with macports and macports readline installed? I did under our "macports simulation". Thanks! UPDATE 0Comments, suggestions and corrections welcome. |
Calc bug report template version: 1.3 2022-11-27
Describe the bug
Using Mac Sequoia 15.2, M3 processor. Installed readline with macports. Compiled calc-2.15.1.0 with all the default options, and I get a link error at the end of the build:
cc -dynamiclib -undefined dynamic_lookup -install_name /usr/local/lib/libcalc.2.15.1.0.dylib -current_version 2.15.1 addop.o assocfunc.o blkcpy.o block.o byteswap.o codegen.o comfunc.o commath.o config.o const.o custom.o errtbl.o file.o func.o hash.o help.o hist.o input.o jump.o label.o lib_calc.o lib_util.o listfunc.o matfunc.o math_error.o obj.o opcodes.o pix.o poly.o prime.o qfunc.o qio.o qmath.o qmod.o qtrans.o quickhash.o seed.o sha1.o size.o str.o strl.o symbol.o token.o value.o version.o zfunc.o zio.o zmath.o zmod.o zmul.o zprime.o zrand.o zrandom.o libcustcalc.2.15.1.0.dylib
-lreadline -lhistory -lncurses -o libcalc.2.15.1.0.dylib
ld: library 'history' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libcalc.2.15.1.0.dylib] Error 1
$ ls -l /opt/local/lib/libhist*
-rwxr-xr-x 1 root admin 73912 Jan 11 20:46 /opt/local/lib/libhistory.8.2.dylib
lrwxr-xr-x 1 root admin 20 Jan 11 20:46 /opt/local/lib/libhistory.8.dylib -> libhistory.8.2.dylib
-rw-r--r-- 1 root admin 46928 Jan 11 20:46 /opt/local/lib/libhistory.a
lrwxr-xr-x 1 root admin 20 Jan 11 20:46 /opt/local/lib/libhistory.dylib -> libhistory.8.2.dylib
To Reproduce
Do what I did above
How you started calc
n/a
Calc commands and their output
Or if you cannot compile calc: The make command you used try and compile calc
and all error and warning messages produced during that action. If long, consider
attaching a file.
make 2>&1 | tee make.out
Referring to the information for step 1 above, indicate where the problem is to be found
Expected behavior
A clear and concise description of what you expected to happen.
Attach debug.out
IMPORTANT: Please run
make debug
and then attach thedebug.out
file.Attached as debug.txt, since github doesn't allow .out
debug.txt
Screen shots
If applicable, attach screen shots to help explain your problem.
Execution environment (please complete the following information):
OS: MacOS
E.g., macOS, FreeBSD, Linux, Windows 11, etc.
OS version: Mac Sequoia 15.2, M3 processor.
E.g., Preferred: give the output of
uname -a
or if no uname command, a description of the OS version/release you are using
OS distribution: Sequoia 15.2
E.g., macOS 13.0.1, contents of /etc/redhat-release, or /etc/os-release, etc.
Calc Version 2.15.1.0
E.g., output of calc -v
or if you cannot compile calc, the version you downloaded and from where it came from
Shell and shell version
E.g., bash, zsh, power shell, etc.
and the version of the shell you are using, if known
$ echo $BASH_VERSION
3.2.57(1)-release
$
Calc mods
If you have modified the calc source for some reason, please description what you modified.
Please consider attaching a patch (diff -u) between an official calc release and the source
you are using.
Patch
If you have a recommended code patch to address the problem, please attach your file
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: