在 Ubuntu 10.04 上设置有效的 D2.x 工具链(使用 gtkd)
我已经玩了几天 D,并且对此感到非常兴奋,直到我尝试让 gtkd 工作。我现在已经浪费了三天的大部分时间来尝试进行工作设置,并且开始变得(阅读;很久以前)有点沮丧。我想知道在我放弃之前是否有人可以提供帮助。我在网上找到的很多信息都已经过时了,所以我不确定我的想法是否正确。
剩下的内容只是我到目前为止所尝试的,如果您有快速解决方案,您可能不需要阅读它,所以请随意跳到... [跳到此处]
因此,首先我需要知道探戈实际上是否可以与 D2.0 一起使用,我相信最初不是这样,但现在 D2.x 可以让您可以同时使用探戈和福波斯。如果这不是真的,那么我想我已经在第一个障碍上摔倒了,这是不可能的。
到目前为止我所采取的步骤。
- 我从 ubuntu 存储库安装了 gdc
- 我从存储库安装了 libtango-headers (注意,只有标头,没有可用的库,所以这没有太大帮助)
- 我手动安装了 dsss
这个设置将编译 D 但当我开始安装 gtkd (使用 dsss 时) ),它编译了,但在尝试使用它编译任何内容时,我遇到了各种错误(与探戈相关)。好吧,正如我所提到的,我没有这些库,所以这不应该是意外的。我尝试手动安装 tango 库,但仍然遇到大量错误,最后求助于 dsss net install tango ,它警告我无法返回 phobos(这让我感到困惑的是,正如我所提到的,我认为两者可以一起使用)无论如何,我继续进行,它完全搞砸了我的设置。我现在无法编译任何D。
抱歉,我无法更明确地说明我在最后一节中遇到的错误,老实说我不记得了。
无论如何,我删除了已安装的所有内容。并重新开始。
- 我从存储库安装了 gdc
- 我手动安装了 dsss
我现在读到最新的探戈不能与 gdc 一起使用(不确定这是否属实),所以我
- 得到了 dmd 的 deb 并安装了它。
- 手动安装最新的探戈(库和标头)。
- 用dsss安装了gtkd
现在我无法让dsss识别dmd,所以只能使用gdc。然而,这并没有找到探戈。如果我直接使用 dmd,它会找到 tango 和 gtkd,但我会收到有关 volatile
语句被弃用的错误。这在 D2.x 中显然是正确的,这让我回到“甚至支持探戈”。
天哪,我很困惑!
[跳至此处]
如果有人可以给我有关如何设置工作设置的分步说明,我将永远感激不已!
谢谢,T。
更新:“我们就在那里!”
所以我从 http://www.digitalmars.com/d/download.html 并提取到我的主目录并执行 export PATH = $PATH: ~/dmd2/linux/bin
(感谢 dsimcha)。
忘记了dsss
。按照 http://www.dsource.org/ 上的说明获取 gtkd 的 svn 版本项目/gtkd/wiki/UsingSubversion。编辑 GNUmakefile
将前缀更改为 /home/me/dmd2/linux
并执行 make install
。
编辑~/dmd2/linux/bin/dmd.conf
,以便包含路径../include
(gtkD库放在../lib< /code> 所以我不需要编辑库路径)。
现在最终要使用 gtkD 进行编译,我需要链接 libgtkd 和 libdl,这是由 dmd mydprog.d -L-lgtkd -L-ldl 完成的(感谢 jpf)。
I've been playing around with D for a few days and was getting quite excited about it until, that is, I tried to get gtkd working. I've now wasted the best part of 3 days trying to get a working setup and am beginning to get (read; long ago got) a bit demoralised. I was wondering if anyone can help before I give up. A lot of the information I can find online is outdated so I'm not sure if I'm even right in thinking this is even possible.
The rest of this is just about what I've tried so far and you may not need to read it if you have a quick solution, so feel free to jump to ... [Jump to here]
So, firstly I need to know, is tango actually available for use with D2.0, I believe that it wasn't originally but now D2.x is such that you can use tango and phobos alongside each other. If this isn't true, then I guess I've fallen at the first hurdle and this is a non-starter.
The steps I've taken so far.
- I installed gdc from the ubuntu repositories
- I installed libtango-headers from the repos (note, headers only, no libs available, so that's not much help)
- I manually installed dsss
This setup would compile D but when I came to installing gtkd (with dsss), it compiled but I got all sorts of errors (relating to tango) when trying to compile anything using it. Well, as I've mention I didn't have the libs so this shouldn't have been unexpected. I tried to install the tango libs manually but still got loads of errors and in the end resorted to a dsss net install tango
which warned me that I wouldn't be able to go back to phobos (something which confused me as as I have mentioned I thought the two could be used alongside each other) anyway, I proceeded and it completely screwed my setup. I couldn't compile any D now.
Sorry I couldn't be more explicit about what errors I got in that last section, I honestly don't remember.
Anyway, I removed everything I had installed. And started afresh.
- I installed gdc from repos
- I installed dsss manually
I now read that the latest tango doesn't work with gdc (not sure if this is true) so I
- Got the deb for dmd and installed that.
- Installed the latested tango (libs and headers) manually.
- Installed gtkd with dsss
Now I can't get dsss to recognize dmd, so can only use gdc with it. That however doesn't find tango. If I use dmd directly it finds tango and gtkd but I get errors about volatile
statements being deprecated. Something which is apparently true in D2.x, which brings me back to "is tango even supported".
Gosh I'm confused!
[Jump to here]
If anyone can give me step by step instructions on how to get a working setup set up, I'd be forever grateful!
Thanks, T.
Update: "We're there!"
So I downloaded dmd.2.049.zip from http://www.digitalmars.com/d/download.html and extracted to my home directory and did a export PATH = $PATH:~/dmd2/linux/bin
(thanks to dsimcha).
Forgot about dsss
. Got the svn version of gtkd as per the instructions at http://www.dsource.org/projects/gtkd/wiki/UsingSubversion. Edited GNUmakefile
to change the prefix to /home/me/dmd2/linux
and did a make install
.
Edited ~/dmd2/linux/bin/dmd.conf
so the include paths included ../include
(the gtkD libs are put in ../lib
so I didn't need to edited the library paths).
Now finally to compile with gtkD I needed to link against libgtkd and libdl, this was done by, dmd mydprog.d -L-lgtkd -L-ldl
(thanks to jpf).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Tango 不适用于 D2。很久以前就进行了一些移植工作,但是遇到了困难,目前还不清楚这是否会真正完成。 OTOH 用于 D2 的 Phobos 比用于 D1 的 Phobos 好得多,因此缺少 Tango 并不像听起来那么糟糕。
GDC 支持 D2 的旧版本。 gtkD 绝对不可能用它来编译。您应该使用参考 DMD 编译器。
通常,在 Linux 上设置 DMD 的正确方法是将 dmd.2.0xx.zip 解压到您的主目录中,然后执行
export PATH = $PATH:~/dmd2/linux/bin
确保 DMD 可执行文件位于您的路径中。然后一切都应该可以正常工作(使用 DMD2 和 Phobos)。Tango does not work with D2. There was some effort a long time ago towards porting it, but this kind of hit a wall and it's unclear whether this is ever actually going to be finished. OTOH Phobos for D2 is much better than Phobos for D1, so lack of Tango is not as bad as it sounds.
GDC supports an ancient version of D2. There's absolutely no chance of gtkD compiling with it. You should use the reference DMD compiler.
Generally the proper way to set up DMD on Linux is to simply unzip dmd.2.0xx.zip into your home directory and do an
export PATH = $PATH:~/dmd2/linux/bin
to make sure the DMD executable is in your path. Then everything should work (with DMD2 and Phobos).如果您希望 dmd 将参数传递给链接器,则必须在它们前面加上 -L 前缀。
我认为对于 gtkd,您需要链接到 gtkd 库和 libdl。
If you want dmd to pass arguments to the linker you have to prefix them with -L.
I think for gtkd you need to link to the gtkd library and libdl.