doujia5863 2014-12-14 22:47
浏览 619
已采纳

无法在Win7上干净地设置GOOS环境变量

I am trying to use golangs cross compilation feature to compile on my machine (windows 7) to switch between compiling for linux and amd64.

I set up everything properly and created the enviroment variables

GOARCH = amd64
GOOS = linux

My problem occurs whenever I try to switch between platforms by changing GOOS to either linux or amd64. I use Console 2 to manage my standart cmd, cygwin console and git console. After changing GOOS with:

xset GOOS=amd64

different consoles show different values for the variable e.g:

//git bash
echo $GOOS
linux
//cmd
echo %GOOS%
amd64

This happens even after restarting all consoles. Additionally I am suddenly unable to access parts of my system! Trying to access my "Advanced System settings" in my System properties returns now a warning:

"%windir%\system32\systempropertiesadvanced.exe" could not be found.

which sounds to my like win7 suddenly can't handle its own environment variables anymore.

This also means that I can't change the variables through the windows GUI anymore.

On top of all that the "go" command is no longer bound and I am unable to build anything with go.

My only solution this far is to restart my entire system every time I change a variable. After a restart the variable is changed an everything works fine until I want to change GOOS again.

I would be very happy about any kind of input, I am new to go and assume that I am missing something obvious.

Thanks in advance

  • 写回答

1条回答 默认 最新

  • dounao4179 2014-12-15 20:42
    关注

    Perhaps you should check your environment variables, especially it's length.

    If your environment variables hit the maximum size, windows can't access the env variables properly so it leads to your error message.

    Further information:
    Environment Variables
    What happens with Path System Variable is too long?

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

报告相同问题?

悬赏问题

  • ¥15 arduino控制ps2手柄一直报错
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥85 maple软件,solve求反函数,出现rootof怎么办?
  • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿