cjo*_*318 7 c compilation nim-lang
我写了一个Nim程序,
echo("Hello.")
Run Code Online (Sandbox Code Playgroud)
然后我试着为Linux机器交叉编译,
nim c --cpu:i386 --os:linux -c hello.nim
Run Code Online (Sandbox Code Playgroud)
这产生了以下输出:
config/nim.cfg(45, 2) Hint: added path: '/Users/connor/.babel/pkgs/' [Path]
config/nim.cfg(46, 2) Hint: added path: '/Users/connor/.nimble/pkgs/' [Path]
Hint: used config file '/usr/local/lib/nim-0.10.2/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: hello [Processing]
Hint: operation successful (8753 lines compiled; 0.140 sec total; 14.148MB)[SuccessX]
Run Code Online (Sandbox Code Playgroud)
此时我更改了nimcache/目录并尝试执行:
gcc hello.c -o hello.o
Run Code Online (Sandbox Code Playgroud)
但这给了我一个错误:
hello.c:5:10: fatal error: 'nimbase.h' file not found
#include "nimbase.h"
^
1 error generated.
Run Code Online (Sandbox Code Playgroud)
我想,"没什么大不了的,我只会找到nimbase.h并放在nimcache那里的目录中",但在那之后我得到了一个新的错误,
In file included from hello.c:5:
./nimbase.h:385:28: error: 'assert_numbits' declared as an array with a
negative size
...sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8 ? 1 : -1];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Run Code Online (Sandbox Code Playgroud)
我不确定我应该怎么做.我曾尝试使用该--genScript选项,但这导致了类似的错误.我正在运行OS X Yosemite.
谢谢!
更新:
我不确定该--cpu:选项支持多少架构,但我在What What Nim实用博客文章中找到了一个(部分?)列表.我最后打电话给
nim c --cpu:amd64 --os:linux -c hello.nim
Run Code Online (Sandbox Code Playgroud)
这防止了我在Linux机器上编译时看到的错误.如果您使用的是Linux或OS X,请不要确定您可以调用的CPU架构,
less /proc/cpuinfo
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1645 次 |
| 最近记录: |