Golang Environment CentOS 7

Source: Internet
Author: User
Tags install go

Install, configure, upgrade, and uninstall 82682171 Linux go

78525639 CentOS installation Golang, protobuf

https://www.cnblogs.com/mrblue/p/8891789.html CentOS7 Install GO environment

https://www.cnblogs.com/pyyu/p/8032257.html Go language Commentary goroot, Gopath, GOBIN

HTTPS://HK.SAOWEN.COM/A/0974F14EBEAACEFC2D4EA7193121F6FAF8304388ACC206E1781D42781D3883AF Golang using the Protobuf tutorial

53788067 Golang How to cross-compile in Mac, Linux, Windows

1 Golang Support cross-compilation, on one platform to generate another platform executable program, recently used, very useful, here is a memo. 2 3 Linux and Windows 64-bit executables are compiled under Mac4 5Cgo_enabled=0Goos=linux goarch=AMD64 Go build main.go6Cgo_enabled=0Goos=windows goarch=AMD64 Go build main.go127 8 Linux under Compile Mac and Windows 64-bit executable program9 Ten  One  ACgo_enabled=0Goos=darwin goarch=AMD64 Go build main.go -Cgo_enabled=0Goos=windows goarch=AMD64 Go build main.go12 -  the Windows compiles Mac and Linux 64-bit executables -  -  -  +SET cgo_enabled=0 -SET goos=Darwin +SET goarch=AMD64 A Go build main.go at  -SET cgo_enabled=0 -SET goos=Linux -SET goarch=AMD64 - Go build main.go123456789 -  in GOOS: The operating system of the target platform (Darwin, FreeBSD, Linux, Windows) -Goarch: The architecture of the target platform (386, AMD64, arm) to cross-compilation does not support CGO so to disable it +  -The above command compiles --bit executable program, you should of course also use386Compile +-bit executable program the Many blogs have mentioned the need to increase support for other platforms first, but I skipped that step, the commands listed above will be successful, and I'll get the results I want, so that the step should be non-mandatory, or the Go version I'm using has default support for all platforms.  *  $---------------------Panax Notoginseng  -This article from the Rock District of Csdn blog, full-text address please click: https://blog.csdn.net/panshiqu/article/details/53788067?utm_source=copy

1 Description:2Protobuf has been fully migrated to GitHub, address: https://Github.com/google/protobuf3Direct Download 2.6.1 Version: https://Github.com/google/protobuf/archive/v2.6.1.zip4 5 turn Linux soon on the various path variables of Linux is not particularly familiar with the online read a few tutorials did not mention the addition of Library_path path, resulting in a custom installation path when the link failed, write an installation tutorial yourself, also counted as a deepening impression, I hope to help you. 6 7 8 9 default installation:Ten  One  A  -$wget https://Github.com/google/protobuf/archive/v2.6.1.zip -$unzip protobuf-2.6.1. zip the$CD protobuf-2.6.1123 -  -The code downloaded from GitHub needs to be executed first.autogen.sh Generating Configure Files - Note autogen.sh need Gtest package, default is from googletest.googlecode.com download, domestic need FQ to access, many people ask Autogen.sh run failed, here I add + Modify the autogen.sh - put this paragraph: +  A  at  -Echo"Google Test not present. Fetching gtest-1.5.0 from the web ..." -Curl http://googletest.googlecode.com/files/gtest-1.5.0.tar.bz2 | tar jx -MV gtest-1.5.0gtest123 -  - modified to: in  -  to  +wget https://github.com/google/googletest/archive/release-1.5.0.tar.gz -Tar xzvf release-1.5.0. tar.gz theMV googletest-release-1.5.0gtest123 *  $ And then execute the autogen.sh so you don't get an error.Panax Notoginseng  -  the  +$ ./Configure A $ Make the $ make Check + $ make Install -  $ I'm using a CentOS system. $/usr/local/bin -/usr/local/Lib, -/usr/local/include the is also one of the system default paths, so you can use PROTOBUF in this step -$ protoc-i=./--cpp_out=./Test.protoWuyiTo the directory where your Test.proto file is located use the command protoc-i=./--cpp_out=./generate C + +version of the protocol file the Everything OK if you go back in the current directory see. h and. cc Files 12345678910111213 -  Wu  -  About Custom Installation path: -PROTOBUF is installed by default on/usr/Local Directory AYou can modify the installation directory through the./configure--prefix=Command +Although I am the root user but feel that the default installation is too scattered, so the unified installation in/usr/local/Protobuf under the  -$./configure--prefix=/usr/local/Protobuf $ $ Make the $ make Check the $ make Install the  theThis step has not been installed, in the/etc/profile or user directory ~/. Bash_profile - Add the following: in ####### Add protobuf lib path ######## the # (Dynamic Library search path) when you find a dynamic link library in a program load run, specify a path other than the system default path theExport Ld_library_path= $LD _library_path:/usr/local/protobuf/lib/ About # (Static library search path) specifies the path to find shared libraries when locating a dynamic link library during a program compilation theExport Library_path= $LIBRARY _path:/usr/local/protobuf/lib/ the #执行程序搜索路径 theExport path= $PATH:/usr/local/protobuf/bin/ + #c程序头文件搜索路径 -Export C_include_path= $C _include_path:/usr/local/protobuf/include/ the#c + +Program header File search pathBayiExport Cplus_include_path= $CPLUS _include_path:/usr/local/protobuf/include/ the#pkg-Config path theExport pkg_config_path=/usr/local/protobuf/lib/pkgconfig/ - ###################################### -  the All right, goog luck123456789101112131415161718192021222324252627 . the  theCompile if there are no symbols and link errors found please remember to add the link option-Lprotobuf the and verify that your static library path is in effect -  the $ echo $LIBRARY _path the  the---------------------94  theThis article from Jackytse_ 's CSDN blog, full-text address click: https://blog.csdn.net/xiexievv/article/details/47396725?utm_source=copy

HTTPS://HK.SAOWEN.COM/A/0974F14EBEAACEFC2D4EA7193121F6FAF8304388ACC206E1781D42781D3883AF Golang using the Protobuf tutorial

Golang Environment CentOS 7

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.