www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to make clang use a different tk framework version on MacOS?

reply tastyminerals <tastyminerals gmail.com> writes:
My tkd GUI app started getting compiled with an outdated 8.5 Tk 
framework version which gets shipped with command line tools: 
`xcode-select --install`. As a result, the UI doesn't display 
icons and is laggy. When you run the compiled tk app, you get a 
notorious warning:

```
DEPRECATION WARNING: The system version of Tk is deprecated and 
may be removed in a future release. Please don't rely on it. Set 
TK_SILENCE_DEPRECATION=1 to suppress this warning.
```

This didn't happen before but here is why it probably started to 
occur.

I've recently been playing with uninstalling the MacPorts in 
favour of homebrew and in the process I had to remove tk8.6 
library which was installed once by MacPorts. I wasn't aware that 
command line tools come with their own version of tk which is 
8.5. Somehow, after moving to homebrew, I rebuilt the app and saw 
new warnings that never appeared before:
```
../../../../.dub/packages/tkd-1.1.13/tkd/source/tkd/image/png.d(83,7):
Deprecation: Function `tkd.image.image.Image.embedBase64Data!("lock.png",
EmbeddedPng!"lock.png").embedBase64Data` of type ` system
EmbeddedPng!"lock.png"()` is not accessible from module `png`
```

I tried coming back to MacPorts, reinstalling the command line 
tools reinstalling the tkd and dub dependencies but nothing 
worked so far. Maybe someone here has experience how to make 
clang go and link against the tk 8.6 version installed by 
MacPorts instead of 8.5. That would be of great help.
Sep 20 2021
parent tastyminerals <tastyminerals gmail.com> writes:
On Monday, 20 September 2021 at 21:58:27 UTC, tastyminerals wrote:
 My tkd GUI app started getting compiled with an outdated 8.5 Tk 
 framework version which gets shipped with command line tools: 
 `xcode-select --install`. As a result, the UI doesn't display 
 icons and is laggy. When you run the compiled tk app, you get a 
 notorious warning:

 ```
 DEPRECATION WARNING: The system version of Tk is deprecated and 
 may be removed in a future release. Please don't rely on it. 
 Set TK_SILENCE_DEPRECATION=1 to suppress this warning.
 ```

 This didn't happen before but here is why it probably started 
 to occur.

 I've recently been playing with uninstalling the MacPorts in 
 favour of homebrew and in the process I had to remove tk8.6 
 library which was installed once by MacPorts. I wasn't aware 
 that command line tools come with their own version of tk which 
 is 8.5. Somehow, after moving to homebrew, I rebuilt the app 
 and saw new warnings that never appeared before:
 ```
 ../../../../.dub/packages/tkd-1.1.13/tkd/source/tkd/image/png.d(83,7):
Deprecation: Function `tkd.image.image.Image.embedBase64Data!("lock.png",
EmbeddedPng!"lock.png").embedBase64Data` of type ` system
EmbeddedPng!"lock.png"()` is not accessible from module `png`
 ```

 I tried coming back to MacPorts, reinstalling the command line 
 tools reinstalling the tkd and dub dependencies but nothing 
 worked so far. Maybe someone here has experience how to make 
 clang go and link against the tk 8.6 version installed by 
 MacPorts instead of 8.5. That would be of great help.
If anyone bumps into this issue. The reason why it happened was because I uninstalled Mac Ports and lost `pkgconfig` package. When this package is installed on the system, dub uses it to resolve the necessary flags and links with `-L-ltk8.6 -L-ltkstub8.6 -L-ltcl8.6 -L-ltclstub8.6` instead of `8.5`. Keep in mind that in order for your tkd app to work on Mac OS, you need to install quartz type of tk: `sudo port install tk +quartz`. After that your should be able to run the app.
Sep 22 2021