GithubHelp home page GithubHelp logo

Building Protobuf on Windows about libarcus HOT 9 OPEN

ultimaker avatar ultimaker commented on July 30, 2024
Building Protobuf on Windows

from libarcus.

Comments (9)

sedwards2009 avatar sedwards2009 commented on July 30, 2024 6

Steps on Windows look roughly like this:

  • Download and carefully unzip it somewhere else and add a "-mingw" suffix to the directory name. https://github.com/google/protobuf/archive/v3.0.0-beta-2.tar.gz
  • mkdir install_dir
  • mkdir cmake_build
  • cd cmake_build
  • cmake -DCMAKE_INSTALL_PREFIX=../install_dir -DCMAKE_INSTALL_LIBDIR=lib -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_CXX_FLAGS="-std=c++11" -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" ../cmake
  • mingw32-make
  • mingw32-make install

from libarcus.

Ghostkeeper avatar Ghostkeeper commented on July 30, 2024

For some reason, Protobuf's repository recommends building Protobuf in the msys environment. I don't find that necessary (any more). They have a perfectly functional CMake script.

I suggest downloading CMake (cmake.org), opening up the cmake-gui, then navigating it to /cmake/ for the source directory (choose any build directory you like). You can select native MinGW bindings. Then click configure and generate. Next, navigate a terminal (just a normal one, not an msys terminal) to your build directory,the one you entered in CMake, and type mingw32-make. It should build itself.

from libarcus.

awhiemstra avatar awhiemstra commented on July 30, 2024

Yeah, on Windows you definitely want to use protobuf's cmake build system as it work way better. We use the CMake scripts for building as part of cura-build and I have not had any issues with it so far.

from libarcus.

caucycaucy avatar caucycaucy commented on July 30, 2024

Hi Ghostkeeper, awhiemstra and sedwards2009,

Really appreciation for your reply. I have tried Ghostkeeper and awhiemstra's methods, but it doesn't work for me. Sorry for my stupid.
So I tried sedwards2009's method, but in step

  • cmake -DCMAKE_INSTALL_PREFIX=../install_dir -DCMAKE_INSTALL_LIBDIR=lib -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_CXX_FLAGS="-std=c++11" -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" ../cmake

    I got some message:
    C:\SlicerSoftware\Cura\protobuf-master\cmake_build>cmake -DCMAKE_INSTALL_PREFIX=../install_dir -DCMAKE_INSTALL_LIBDIR=lib -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_CXX_FLAGS="-std=c++11" -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" ../cmake
    CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/CMakeMinGWFindMake.cmake:22 (message):
    sh.exe was found in your PATH, here:
    C:/MinGW/msys/1.0/bin/sh.exe
    For MinGW make to work correctly sh.exe must NOT be in your path.
    Run cmake from a shell that does not have sh.exe in your PATH.
    If you want to use a UNIX shell, then use MSYS Makefiles.
    Call Stack (most recent call first):
    CMakeLists.txt:5 (project)
    CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
    CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
    -- Configuring incomplete, errors occurred!

I really don't know what that mean, so I tried that step again, and this time it produce message:

-- The C compiler identification is GNU 4.9.3
-- The CXX compiler identification is GNU 4.9.3
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Could NOT find ZLIB (missing: ZLIB_INCLUDE_DIR)
-- Configuring done
-- Generating done
-- Build files have been written to: C:/SlicerSoftware/Cura/protobuf-master/cmake_build

So I tried the next step "mingw32-make", but I got an error message:
c:\mingw\include\math.h: In function 'float hypotf(float, float)':
c:\mingw\include\math.h:635:30: error: '_hypot' was not declared in this scope
{ return (float)(_hypot (x, y)); }

People said it's a bug of MinGW. I am really confused about that. Can you guys give me further information?
Thanks.

Ding

from libarcus.

sedwards2009 avatar sedwards2009 commented on July 30, 2024

I used the compiler version from http://mingw-w64.org/doku.php/download/mingw-builds, the version more mingw and less msys2.

from libarcus.

caucycaucy avatar caucycaucy commented on July 30, 2024

Thanks all.
Sorry, I've relied on MS VisualStudio tools too much.
Today, I used CMake ui to build protobuf again. I choose the compiler as Visual Studio 2010 in CMake and take reference of README.md (in dir C:\SlicerSoftware\Cura\protobuf-master\cmake). After several steps, I've built the protobuf. The building ouput is in C:\SlicerSoftware\Cura\install, and the "install" contain sub dirs "bin", "include" and "lib". It looks good.
Since protobuf can be built by CMake, so I tried to build libArcus using CMake too. The libArcs is in
"C:\SlicerSoftware\Cura\libArcus-master". But using the CMake ui, and define
the source code as "C:/SlicerSoftware/Cura/libArcus-master",
define the binaries as "C:/SlicerSoftware/Cura/libArcus-master/build",
and choose MS VS2010,
after clicking "Configure", I got error message in CMake ui:

CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find Protobuf (missing: PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR)
(Required is at least version "3.0.0")
Call Stack (most recent call first):
C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindProtobuf.cmake:308 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:13 (find_package)

How to fix it?
Thanks in advance.

Ding

from libarcus.

Ghostkeeper avatar Ghostkeeper commented on July 30, 2024

You've built Protobuf somewhere on your computer, but when building libArcus, it doesn't know where to find the Protobuf binaries and headers for some reason.

In the CMake GUI there should be two variables which it indicates are missing (you might have to activate advanced mode): PROTOBUF_LIBRARY and PROTOBUF_INCLUDE_DIR.

For PROTOBUF_LIBRARY, look in the "lib" folder of C:\SlicerSoftware\Cura\install. That should contain either a .dll or .a file of Protobuf (also Protobuf-lite and possibly a Debug variant, but ignore those).

For PROTOBUF_INCLUDE_DIR, point it to that "include" folder in your install directory. It should contain a folder marked "google", which has a subfolder marked "protobuf".

from libarcus.

caucycaucy avatar caucycaucy commented on July 30, 2024

Hi Ghostkeeper,

Thanks for your information. I've reinstalled MSYS2, MinGW-64, and some other libs. Finally I've built the protobuf, the protobuf's libs and includes showed in "C:\msys32\usr\local". Then, I try to built libArcs, but when I use command "cmake ..", I got the following error information.

$ cmake ..
-- Could NOT find PROTOBUF (missing: PROTOBUF_LIBRARY)
Traceback (most recent call last):
File "C:/msys32/local/libArcus-master/cmake/FindSIP.py", line 8, in import sipconfig
ImportError: No module named 'sipconfig'
CMake Error at cmake/FindSIP.cmake:58 (MESSAGE):
Could not find SIP Call Stack (most recent call first):
CMakeLists.txt:22 (find_package)
-- Configuring incomplete, errors occurred!
See also "C:/msys32/local/libArcus-master/build/CMakeFiles/CMakeOutput.log".

I've searched your another thread about "sip.h". Your suggestion is to install sip package. But when I tried to use command "pacman -S sip-dev", I get nothing. I also tried
"pacman -S python-sipconfig",
"pacman -S python-sip-dev",
but nothing works for me.

I am new to CMake and MinGW.
Any suggestion is welcome.
Thanks in advance.

Ding

from libarcus.

Ghostkeeper avatar Ghostkeeper commented on July 30, 2024

What I meant is this:
Advanced button
Libraries and Include

from libarcus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.