dongye7231 2015-08-20 10:01
浏览 1511
已采纳

Go 1.5+:错误-导入运行时:不使用cgo或SWIG时不允许C源文件

My program was building perfectly with go 1.4.2. After installing go 1.5, I am getting following error.

imports runtime: C source files not allowed when not using cgo or SWIG: atomic_amd64x.c defs.c float.c heapdump.c lfstack.c malloc.c mcache.c mcentral.c mem_linux.c mfixalloc.c mgc0.c mheap.c msize.c os_linux.c panic.c parfor.c proc.c runtime.c signal.c signal_amd64x.c signal_unix.c stack.c string.c sys_x86.c vdso_linux_amd64.c

The error is not program dependent. Even a "Hello world" programs is throwing the same error.

  • 写回答

4条回答 默认 最新

  • dongshang5862 2015-08-20 10:03
    关注

    Remove Old 1.4.x go installation and then install go 1.5.

    I faced the same problem after installing go 1.5. The issue is that I installed go 1.5 at the same place of 1.4.2. Go 1.5 does not use C anymore and if old C installation files are present it throws the error as you are shown.

    if you want the old installation to be present as well then install 1.5 to some other location and set GOROOT to that location.

    Hope it helps.

    Edit 1: For Linux Users:

    if you downloaded go1.5*.tar.gz then you did this:

    tar -C /usr/local/ -xvf go1.5.linux-amd64.tar.gz

    Your old folder C files are not deleted, so the correct process is:

    First: You should delete you old go folder.

    sudo rm -rf /usr/local/go/

    Second: Then run

    tar -C /usr/local/ -xvf go1.5.x.linux-amd64.tar.gz

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入