Building vim IDE --golang in archlinux

1. install the vundle plug-in;

2. Install VIM go;

3. Install YouCompleteMe with the largest head;

Use git clone to install YouCompleteMe offline. The steps are as follows:

cd ~/.vim/bundle

Then execute

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

Change the owner of the YouCompleteMe directory to the current user (bysu)

sudo chown -R bysu:bysu YouCompleteMe

Then execute

git submodule update --init --recursive  

The above errors are usually reported because the default value of curl's postBuffer is too small and git clone's speed is too slow, which may be limited. Now we post solutions for these two aspects.

The default value of postBuffer is too small:

Here, I have configured the value of postBuffer to 500M, which is enough for me. You can configure the postBuffer value to the appropriate size according to the size of the file you need to download.

git config --global http.postBuffer 524288000

This is already configured. If you are not sure, you can view the postBuffer according to the following command.

   git config --list
--------
Copyright notice: This is the original article of CSDN blogger "Jane.zhong", which follows CC 4.0 BY-SA copyright agreement. Please attach the original source link and this notice for reprint.
Original link: https://blog.csdn.net/dzhongjie/article/details/81152983

git clone is too slow

1. Find the ip address corresponding to the domain name and modify the hosts file

First, execute pacman -Sy dnsutils to install dnsutils without prompting that there is no nslookup command. ifconfig,route in net tools, nslookup,dig in dnsutils, ftp,telnet in inetutils, ip command in 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

At the end of the article, add the following two lines, and the following two lines respectively correspond to the content of the bottom color part found above. Then restart the network service. The command to restart the network service on archlinux is found, but the prompt is wrong. Anyway, I restarted it directly.

After solving the problem of slow git clone, you can directly download the relevant files to the corresponding directory through git clone

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

Continue execution

git submodule update --init --recursive 

If you can't, try it several times. After you finish, install it

Install before compiling: cmake gcc

sudo pacman -Sy cmake gcc

After installation, start the following compilation

cd ~/.vim/bundle/YouCompleteMe
./install.py
##########If support is needed golang########
./install.py  --go-completer
##########If you need to support multiple languages at the same time, such as: golang,java,C########
./install.py  --go-completer --java-completer --clangd-completer

##########If all languages currently supported by the plug-in are required########
./install.py --all

After I started compiling, I was stuck at 45%. I thought it was because of the poor performance of raspberry pie. The next day, it was still 45%. I planned to keep it for three days and three nights. Who knows if I reported an error in an hour or two. At this time, I think it's good news to even report a mistake - it doesn't matter if you report a mistake, just in case there's no mistake if you get stuck there.

[ 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.

The search found that the raspberry pie was out of memory, causing an error.

Solution: by adding swap exchange partition

sudo fdisk -l
#########After the above command is executed, the output is as follows#################
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 view according to the above command
sudo chmod 0600 /var/cache/swap/swap0
sudo mkswap /var/cache/swap/swap0 
sudo swapon /var/cache/swap/swap0


However, this does not automatically mount the swap partition when the system restarts, so we need to modify the fstab
Modify the / etc/fstab file and add the following:


/var/cache/swap/swap0    none    swap    sw      0 0
In this way, the swap file will be mounted automatically every time you restart

--------
Copyright notice: This is the original article of CSDN blogger "little \\\\\\\\\\\.
Link to the original text: https://blog.csdn.net/little'spupid'child/article/details/79188015

Recompile again. This time it's 100%. It's a success.

[ 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.

Ha ha ha ha, Kung Fu is not inferior to those who want it! Wait for "ERROR: the build failed."? Failed to build!!!!

By searching

CMake Error: The source directory "/ home / bysu /. VIM / bundle / youcompleteme / third party / ycmd / third party / cregex" does not appear to contain cmakelists.txt

Solution: RM - RF ~ /. VIM / plugged / youcompleteme / third party / ycmd / third party / cregex

Run git submodule update --init --recursive

Then you can. / install.py -- go completer -- clang completer
--------
Copyright notice: This is the original article of CSDN blogger "Lingzhou BXVII", following CC 4.0 BY-SA copyright agreement. Please attach the original source link and this notice for reprint.
Original link: https://blog.csdn.net/weixin_/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

Tags: git vim sudo github

Posted on Wed, 18 Mar 2020 12:12:27 -0400 by Nulletz