树莓派(archlinux)中搭建vim IDE --golang

3 月,跳不动了?>>> hot3.png

本文永久更新地址: https://my.oschina.net/bysu/blog/3197723

1.安装vundle插件;

2.安装vim-go;

3.安装最为头大的YouCompleteMe;

通过git clone 来离线安装YouCompleteMe。步骤如下:

cd ~/.vim/bundle

然后执行

git clone https://gitee.com/Random_Coder/YouCompleteMe.git

把YouCompleteMe目录的所有者改为当前用户(bysu)

sudo chown -R bysu:bysu YouCompleteMe

然后执行

git submodule update --init --recursive  

树莓派(archlinux)中搭建vim IDE --golang_第1张图片

报上面的错一般是因为curl的postBuffer的默认值太小和git clone速度太慢,可能被限制了,现在贴出这两方面的解决方案。

postBuffer的默认值太小:

在这里,笔者把postBuffer的值配置成500M,对笔者来说已经够了。可以根据你需要下载的文件大小,将postBuffer值配置成合适的大小。

git config --global http.postBuffer 524288000

   这样已经配置好了,如果你不确定,可以根据以下命令查看postBuffer。

   git config --list
————————————————
版权声明:本文为CSDN博主「Jane.zhong」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/dzhongjie/article/details/81152983

git clone速度太慢

1、查找域名对应的ip地址,并修改hosts文件

先执行 pacman -Sy dnsutils 安装dnsutils,要不会提示没有nslookup命令。 ifconfig,route在net-tools中,nslookup,dig在dnsutils中,ftp,telnet等在inetutils中,ip命令在iproute2中;netcfg

nslookup github.global.ssl.fastly.Net
Server:  127.0.0.53
Address: 127.0.0.53#53

Non-authoritative answer:
Name: github.global.ssl.fastly.Net
Address: 151.101.229.194

nslookup github.com
Server:  127.0.0.53
Address: 127.0.0.53#53

Non-authoritative answer:
Name: github.com
Address: 13.229.188.59

sudo vim /etc/hosts

在文末加上下面两行,下面分别对应上面查出来标了底色部分的内容。然后重启网络服务,archlinux上重启网络服务的命令找到了,但是提示不对,反正我是直接重启了的。

树莓派(archlinux)中搭建vim IDE --golang_第2张图片

解决掉git clone慢的问题后,可以直接通过git clone把相关文件下到对应的目录

cd /home/bysu/.vim/bundle/YouCompleteMe/third_party
git clone https://github.com/Valloric/ycmd

继续执行

git submodule update --init --recursive 

不行就多试几次,搞完之后,要安装

编译之前先安装: cmake   gcc

sudo pacman -Sy cmake gcc

安装完后,开始执行下面进行编译

cd ~/.vim/bundle/YouCompleteMe
./install.py
##########如果需要支持golang########
./install.py  --go-completer
##########如果需要同时支持多种语言如:golang,java,C########
./install.py  --go-completer --java-completer --clangd-completer

##########如果需要插件当前支持的所有语言########
./install.py --all

开始编译之后,我被卡在了45%那个地方,我以为是树莓派性能太差了的原因,第二天起来还是在45%,打算留个三天三夜,谁知道过一两个小时就报错了。这个时候连报错都觉得是好消息——报错没关系,就怕卡在那里又没错误。

[ 42%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex_raw_buffer.cpp.o
[ 45%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex_traits_defaults.cpp.o
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[3]: *** [BoostParts/CMakeFiles/BoostParts.dir/build.make:232: BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/instances.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/tmp/ycm_build_galdq8zl'
make[2]: *** [CMakeFiles/Makefile2:115: BoostParts/CMakeFiles/BoostParts.dir/all] Error 2
make[2]: Leaving directory '/tmp/ycm_build_galdq8zl'
make[1]: *** [CMakeFiles/Makefile2:149: ycm/CMakeFiles/ycm_core.dir/rule] Error 2
make[1]: Leaving directory '/tmp/ycm_build_galdq8zl'
make: *** [Makefile:131: ycm_core] Error 2
ERROR: the build failed.

NOTE: it is *highly* unlikely that this is a bug but rather
that this is a problem with the configuration of your system
or a missing dependency. Please carefully read CONTRIBUTING.md
and if you're sure that it is a bug, please raise an issue on the
issue tracker, including the entire output of this script
and the invocation line used to run it.

搜索发现是因为树莓派内存不足引起报错。

解决方案: 通过增加swap交换分区来解决

sudo fdisk -l
#########上面命令执行后,输出如下#################
Disk /dev/mmcblk0: 29.74 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa1b33fd1

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1        2048   206847   204800  100M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      206848 62333951 62127104 29.6G 83 Linux


#########################


sudo mkdir -p /var/cache/swap/
sudo dd if=/dev/mmcblk0 of=/var/cache/swap/swap0 bs=1M count=512   #/dev/mmcblk0根据上面命令查看
sudo chmod 0600 /var/cache/swap/swap0
sudo mkswap /var/cache/swap/swap0 
sudo swapon /var/cache/swap/swap0


但是这样并不能在系统重启的时候自动挂载交换分区, 这样我们就需要修改 fstab.
修改 /etc/fstab 文件, 新增如下内容:


/var/cache/swap/swap0    none    swap    sw      0 0
这样每次重启的时候就会自动挂载swap文件了

————————————————
版权声明:本文为CSDN博主「little_stupid_child」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/little_stupid_child/article/details/79188015

再重新编译,这次100%了,总算成功了。

[ 88%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Result.cpp.o
[ 90%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Utils.cpp.o
[ 92%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Word.cpp.o
[ 95%] Building CXX object ycm/CMakeFiles/ycm_core.dir/versioning.cpp.o
[ 97%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ycm_core.cpp.o
[100%] Linking CXX shared library /home/bysu/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.so
make[3]: Leaving directory '/tmp/ycm_build_u4swi38l'
[100%] Built target ycm_core
make[2]: Leaving directory '/tmp/ycm_build_u4swi38l'
make[1]: Leaving directory '/tmp/ycm_build_u4swi38l'
CMake Error: The source directory "/home/bysu/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/cregex" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
ERROR: the build failed.

哈哈哈,功夫不负有心人啊!慢着“ERROR: the build failed.”是什么鬼?竟然构建失败了!!!!

通过搜索

CMake Error: The source directory "/home/bysu/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/cregex" does not appear to contain CMakeLists.txt.发现这是因为 ~/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/cregex/ 的内部文件没有clone下来

解决方案:rm -rf ~/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/cregex    (即删除掉)

                   再运行git submodule update --init --recursive

然后就可以  ./install.py --go-completer  --clang-completer  成功编译了
————————————————
版权声明:本文为CSDN博主「铃舟BXVII」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_41912158/article/details/88371350
-- Generating done
-- Build files have been written to: /tmp/regex_build_znc86h74
make[1]: Entering directory '/tmp/regex_build_znc86h74'
make[2]: Entering directory '/tmp/regex_build_znc86h74'
make[3]: Entering directory '/tmp/regex_build_znc86h74'
Scanning dependencies of target _regex
make[3]: Leaving directory '/tmp/regex_build_znc86h74'
make[3]: Entering directory '/tmp/regex_build_znc86h74'
[ 66%] Building C object CMakeFiles/_regex.dir/regex_3/_regex.c.o
[ 66%] Building C object CMakeFiles/_regex.dir/regex_3/_regex_unicode.c.o
[100%] Linking C shared library /home/bysu/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/cregex/regex_3/_regex.so
make[3]: Leaving directory '/tmp/regex_build_znc86h74'
[100%] Built target _regex
make[2]: Leaving directory '/tmp/regex_build_znc86h74'
make[1]: Leaving directory '/tmp/regex_build_znc86h74'
go: downloading golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7

 

你可能感兴趣的:(树莓派(archlinux)中搭建vim IDE --golang)