Compiled on Ubuntu grpc

        Official website grpc compilation step has been very full, but if the first compiler will still encounter some minor problems, but at least if you want to compile the file have less than so many steps. The main problem summarize and compile encounter major steps need to use.

        Before using Linux compiler, the first to be confirmed by apt install update update command.

        1) We then need to install git:

         apt install git


        2) Before compiling we need to download and install command: autoreconf, and in order to support it needed some relevant stuff. If it is not installed by the compiler will be reported when a lot of mistakes lead to failure.

        命令为: sudo apt-get install autoconf automake libtool

                       sudo apt-get install libffi-dev

        After executing the above command, we can begin to download the compiled grpc ( Note: This is version 1.10 compiled grpc in Ubuntu14.04 Server Edition compiles successfully, in the Ubuntu16.04 compile error will fail )

        If you encounter an error, please refer to: https://blog.csdn.net/x356982611/article/details/70856470


        3) Next, we began compiling here is relatively simple, the main steps

        1. Download grpc:

            git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc

        2. Go grpc directory ( this directory to find according to their own circumstances, I do not know if you can command: Which grpc )

            cd grpc

        3. Because grpc down the clone project contains a submodule, but it will not take the initiative to download, so we need to use the command

             git submodule update --init

        4. Start compile and install grpc, execute the command:

            (1) the make command

            (2) execute the command sudo make install


        If you do not accidentally get here, you grpc has been compiled successfully. Then we begin to download and install protobuf.

       1. Run

            cd grpc/third_party/protobuf

         Enter at GRPC protobuf directory

        2. Run the compiler

           ./autogen.sh && ./configure && make

       3. Run the installation

           sudo make install


        This we can start to compile happily write your own proto files.

        Command is:

 protoc --objc_out=./test/ --grpc_out=./test/ --plugin=protoc-gen-grpc=/root/grpc/bins/opt/grpc_objective_c_plugin test.proto

        --objc_out compiled for your target language, if you do not know how to write can be performed protoc see what language how to write.

        --grpc_out compiler target language for you grpc file, mainly service and clien generation method.

        --plugin invoke the compiler plug-ins for you, otherwise this must not generate grpc files.

       Finally, you need to compile a plus proto file.



           

          

        

Published 48 original articles · won praise 17 · views 50000 +

Guess you like

Origin blog.csdn.net/aixinaxc/article/details/79912823