环境变量问题:SSH打开终端可以看到;而ssh root@xx “cmd“看不到

问题:

在/etc/profile中配置了

export PKG_CONFIG_PATH=/usr/lib64/pkgconfig

但是在ssh root@192.168.0.168 "cd /root/my_proj; make;"时,总是提示

Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found

/usr/include/glib-2.0/glib.h:30:10: fatal error: glib/galloca.h: No such file or directory
 #include <glib/galloca.h>
          ^~~~~~~~~~~~~~~~
compilation terminated.

而直接通过SSH登录打开控制台窗口进行编译,就没有这个问题。

最终发现原因:ssh root@192.168.0.168 "执行的命令“ 这种方式不引导/etc/profile文件

解决方法:在 ~/.bashrc中添加export PKG_CONFIG_PATH=/usr/lib64/pkgconfig

快速验证:(注意$符号前面需要转义字符 \ )

ssh root@192.168.0.168 "echo \$PKG_CONFIG_PATH;"

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值