I see this as well on Monterey on x86_64 if I already have tk installed with the +x11 variant and I do not use trace mode. The solution would be to use trace mode:
sudo port -t install tk +quartz
I guess the problem is that -L
flags are in the wrong order: -L/opt/local/lib
precedes -L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_x11_tk/tk/work/tk8.6.13/unix
on the link line, thus -ltk8.6
refers to the existing installed copy of libtk8.6.dylib, not the one that was just built.
/usr/bin/clang -O2 -pipe -Os -arch arm64 -pipe -isystem/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_x11_tk/tk/work/tk8.6.13 -L/opt/local/lib -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -arch arm64 -headerpad_max_install_names -Wl,-search_paths_first tkAppInit.o -L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_x11_tk/tk/work/tk8.6.13/unix -ltk8.6 \
-L/opt/local/lib -ltcl8.6 -lpthread -framework CoreFoundation -framework Cocoa -framework Carbon -framework IOKit -framework QuartzCore -framework UniformTypeIdentifiers -lz -lpthread -framework CoreFoundation -sectcreate __TEXT __info_plist Wish-Info.plist -sectcreate __TEXT __credits_html Credits.html -o wish