dougu5886 2014-10-09 13:01
浏览 56
已采纳

在Mac下使用nsf的“哥特式”(tcl / tk go绑定)库进行铅

I have been using nsf's "gothic" (tcl/tk go binding) libary under Linux for a while now : it works very well and is very convenient for adding a tcl/tck-based graphical interface to a Go application (more or less what Tkinter is to Python).

https://github.com/nsf/gothic

However, I experienced a few problems installing it under Mac.

In an attempt to solve that problem, I made the following modifications to my Mac development environment:

  • Installed the latest version of Xcode.

  • Removed "port" (port of the Linux tools for Mac) entirely and installed it from scratch to the latest version.

  • Upgraded to the latest stable version of Go.

Now at least I can install "gothic" under Mac and it compiles without complaining.

I had to make the following changes to the interpreter.go file, so that the header directives point to the correct library location:

#cgo !tcl85 LDFLAGS: -L/opt/local/lib
#cgo !tcl85 LDFLAGS: -ltcl8.6 -ltk8.6
#cgo !tcl85 CFLAGS:  -I/opt/local/include/tcl8.6
#cgo darwin tcl85 CFLAGS: -I/opt/local/include
#cgo darwin tcl85 CFLAGS: -I/opt/local/include/tcl8.6

instead of the original:

#cgo !tcl85 LDFLAGS: -ltcl8.6 -ltk8.6
#cgo !tcl85 CFLAGS: -I/usr/include/tcl8.6
#cgo tcl85 LDFLAGS: -ltcl8.5 -ltk8.5
#cgo tcl85 CFLAGS: -I/usr/include/tcl8.5
#cgo darwin tcl85 CFLAGS: -I/opt/X11/include

So that is points to the correct libraries.

The current situation is that the examples do compile, without any warnings or error messages.

The problem is that the resulting executables only run correctly randomly, form time to time, but most of the time just "hangs" (displays an empty white rectangle where the interface should be) the execution of the program blocks.

In nsf's code the last statement which gets executed apparently (when the executable gets stuck) is the call to Tk_Mainloop().

This is as far as I have come in trying to figure out what is going wrong.

So obviously, it is not a Go (golang) to Tcl binding problem.

It looks as if the "connection" between Tcl and Tk sometimes works and sometimes not in that context (whereas it works perfectly under Linux).

Has anybody had more success in using "gothic" on a mac (or possibly more experience with using tcl/tk bindings under mac) ?

If yes, would be very grateful for some help on how to proceed.

Thanks,

  • 写回答

1条回答 默认 最新

  • donglu8344812 2015-01-30 11:19
    关注

    in the meantime installed :

    Nsf.s gothic (tcl/tk to Golang binding) library appers to work correctly on Mac now !

    So the assumption that the problem was linked to the (late) implementation of X11.app was correct !

    Serge

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行