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

Selecting Homebrew version of Tk on macOS #18

Open
poldy opened this issue Dec 23, 2022 · 0 comments
Open

Selecting Homebrew version of Tk on macOS #18

poldy opened this issue Dec 23, 2022 · 0 comments

Comments

@poldy
Copy link

poldy commented Dec 23, 2022

On macOS, when I installed using "opam install labltk" this linked against Apple's version of Tk which honestly isn't very good.

To use the better version I installed using "brew install tcl-tk", I had to run "opam uninstall labltk" again (which probably left its dependencies in place), then the following commands in a git clone of this repo (these are a slightly-extended version of what "opam show --raw labltk" gave):

./configure -use-findlib -verbose -installbindir $HOME/.opam/5.0.0+flambda/bin -tkdefs -I/opt/homebrew/opt/tcl-tk/include -tklibs -L/opt/homebrew/opt/tcl-tk/lib -tk-no-x11
make library opt
make install

This worked, but I was wondering if there was a nicer way to do this with some options to opam?

If it helps, you can set PKG_CONFIG_PATH=/opt/homebrew/opt/tcl-tk/lib/pkgconfig:$PKG_CONFIG_PATH then pkg-config --cflags tk gives the required value for -tkdefs above; and pkg-config --libs tk give the equivalent of LDFLAGS in make (i.e. library search directory for -tklibs and required libraries).

ecky-l added a commit to ecky-l/labltk that referenced this issue Sep 6, 2023
…ment (if set)

This is useful for compiling against a non-default Tk when the flags -tkdefs/-tklibs cannot
be set explicitly for some reason. I.e. when installing via opam (and in particular on macOS
with a homebrew installation of tcl-tk).

For instance, do:
$ export TK_DEFS='-I/usr/local/Cellar/tcl-tk/8.6.13_5/include/tcl-tk'
$ export TK_LIBS='-L/usr/local/Cellar/tcl-tk/8.6.13_5/lib -ltk8.6 -ltkstub8.6 -ltcl8.6 -ltclstub8.6'

before
$ opam install labltk

See also garrigue#18
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

1 participant