flexprop icon indicating copy to clipboard operation
flexprop copied to clipboard

flexprop failing to run, stating tcl-tk library not loaded (again:) for flexprop 6.9.10 on MacOS 15.2

Open dgately opened this issue 11 months ago • 3 comments
trafficstars

As has happened in the past, exec'imng flexprop from built sources, I receive: "Library not loaded" errors for tcl-tk, because it expects tcl-tk8.6. This has been an issue on MacOS in the past as well, but was fixed with the addition of tcltk8.6 in flexprop sources...

  1. Homebrew now installs 9.0.0_1 versions of tcl-tk, the flexprop Makefile expects version 8.6. In the flexprop Makefile:
ifeq ($(OS),macosx)
# These are locations as specified by Homebrew
BREW_TK_PREFIX := $(shell brew --prefix tcl-tk)
NATIVETK_INC =-I$(BREW_TK_PREFIX)/include -I$(BREW_TK_PREFIX)/include/tcl-tk
NATIVETK_LIBS=-L$(BREW_TK_PREFIX)/lib -ltk8.6 -ltcl8.6 -lz -lpthread -lm
endif  
  1. In the past, I thought that tcl-tk 8.6 versions were included with flexprop sources (especially for MacOS). But, how does flexprop access the included 8.6 version if the Makefile is pointing to these homebrew directories?

I'm sure I'm missing something, but I'm not able to debug this issue (other than building a tcl-tk8.6 variant and placing its include & lib directories in the brew directories. That might work?)... And, yes I updated brew's tcl-tk for a totally separate project that required the latest versions.

What exec'ing flexprop displays:

% ./flexprop 
% ./flexprop 
dyld[60829]: Library not loaded: /opt/homebrew/opt/tcl-tk/lib/libtk8.6.dylib
  Referenced from: <943128DD-B60D-3E6B-97D4-DE8F7FA15473> /Users/altergator/flexprop/flexprop
  Reason: tried: '/opt/homebrew/opt/tcl-tk/lib/libtk8.6.dylib' (no such file),
'/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/tcl-tk/lib/libtk8.6.dylib' (no such file),
'/opt/homebrew/opt/tcl-tk/lib/libtk8.6.dylib' (no such file),
'/opt/homebrew/Cellar/tcl-tk/9.0.0_1/lib/libtk8.6.dylib' (no such file),
'/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/tcl-tk/9.0.0_1/lib/libtk8.6.dylib' (no such file),
'/opt/homebrew/Cellar/tcl-tk/9.0.0_1/lib/libtk8.6.dylib' (no such file)
zsh: abort      ./flexprop

dgately avatar Dec 16 '24 18:12 dgately

I think you should be able to use the libraries and binary that ship in the MACOSX directory? The binary itself shouldn't need to be rebuilt because it never changes -- it's basically just a standard tcl/tk interpreter set up to automatically load the flexprop scripts.

totalspectrum avatar Dec 17 '24 16:12 totalspectrum

I guess I'm asking why does flexprop look for the tcl & tk libs in "/opt/homebrew/opt/tcl-tk/lib/"? Why does it look for any homebrew-installed libs?

dgately avatar Dec 24 '24 00:12 dgately

I honestly don't know what the best solution is for building the flexprop binary yourself on MacOS. I guess I would suggest editing the Makefile to point to the correct directory for the tcl-tk libraries you have. My Mac Mini is extremely ancient, and these days I do the builds by cross-compiling on a Linux machine.

OTOH building the flexprop binary itself isn't really necessary -- there's nothing flexprop specific in that binary, as I said that one is basically just the Tcl/Tk interpreter with a small patch to read flexprop.tcl automatically. So you could just copy the MACOSX/flexprop.mac file and use that in place of whatever binary you end up building. All the flexprop GUI stuff is in the .tcl files in the src/ directory, and that's the stuff that changes with new releases.

I did some kind of hack to flexprop.mac so that it looks for the libraries relative to the current executable:

mac-mini:MACOSX ersmith$ otool -L ./flexprop.mac 
./flexprop.mac:
	@executable_path/tcl_library/libtk8.6.dylib (compatibility version 8.6.0, current version 8.6.11)
	@executable_path/tcl_library/libtcl8.6.dylib (compatibility version 8.6.0, current version 8.6.11)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)

I don't remember off-hand how I accomplished this.

totalspectrum avatar Jan 06 '25 16:01 totalspectrum

You can close the issue. Seems to use the correct path to the tcl liobs now.

dgately avatar Apr 23 '25 23:04 dgately