Apache Thrift Install for C++ to create executables



  • I'm finding a lot of different Apache Thrift install instructions online and they don't all match up. Is there a recommended set of instructions on how to install Apache Thrift for the intention of creating executables that interact with ANVEL? Either in Windows or Linux based OS?



  • @CollinDavenport said in Apache Thrift Install for C++ to create executables:

    I'm finding a lot of different Apache Thrift install instructions online and they don't all match up. Is there a recommended set of instructions on how to install Apache Thrift for the intention of creating executables that interact with ANVEL? Either in Windows or Linux based OS?

    @CollinDavenport,

    Good question - thrift 0.10 should be available for either installation on Windows or compiling from source on Linux, here: https://archive.apache.org/dist/thrift/0.10.0/. Individual Linux distros may have prebuilt packages available, but not necessarily thrift 0.10.

    If you do compile from source, note that thrift depends on boost, so you'll have to build that as well. The official instructions are here: https://thrift.apache.org/docs/BuildingFromSource

    Once you get thrift installed, follow the C++ Usage Instructions to start working with the External API.

    Hopefully that helps.

    Regards,
    ANVEL Support



  • I've run through the install instructions on Linux a few times but whenever I try to compile the HelloAPI it fails with the error below. I have not been able to find a specific solution for this on the the Thrift forums. Has the ANVEL team run into this issue? Or know what step in the install I missed or need to complete?

    HelloAPI.cpp:5:34: fatal error: thrift/cxxfunctional.h: No such file or directory
    #include <thrift/cxxfunctional.h>
    ^
    compilation terminated.
    In file included from AnvelControlService.h:12:0,
    from AnvelControlService.cpp:7:
    AnvelIf_types.h:17:34: fatal error: thrift/cxxfunctional.h: No such file or directory
    #include <thrift/cxxfunctional.h>
    ^
    compilation terminated.
    In file included from AnvelIf_types.cpp:7:0:
    AnvelIf_types.h:17:34: fatal error: thrift/cxxfunctional.h: No such file or directory
    #include <thrift/cxxfunctional.h>
    ^
    compilation terminated.
    In file included from ApiExtras.cpp:1:0:
    AnvelIf_types.h:17:34: fatal error: thrift/cxxfunctional.h: No such file or directory
    #include <thrift/cxxfunctional.h>
    ^



  • The issue with cxxfunctional.h was due to the newer thrift versions not having cxxfunctional.h. However, whenever I compile using the recommended commands on the External API page it does not create a Windows compatible .exe. I've tried using several 32bit and 64bit mingw commands(which have worked on simple programs) ,but every time I use it it creates what seems to be path issues for thrift header files even though they exist on my machine. Is there a recommended command for creating a Windows ready executable? Or is there a certain way I need to run it on Windows?



  • @CollinDavenport said in Apache Thrift Install for C++ to create executables:

    The issue with cxxfunctional.h was due to the newer thrift versions not having cxxfunctional.h. However, whenever I compile using the recommended commands on the External API page it does not create a Windows compatible .exe. I've tried using several 32bit and 64bit mingw commands(which have worked on simple programs) ,but every time I use it it creates what seems to be path issues for thrift header files even though they exist on my machine. Is there a recommended command for creating a Windows ready executable? Or is there a certain way I need to run it on Windows?

    @CollinDavenport,

    We'll take a look into this issue. Just to confirm - you're using thrift 0.10?

    Thanks,
    ANVEL Support



  • Yes I am using 0.10 now.



  • @CollinDavenport said in Apache Thrift Install for C++ to create executables:

    Yes I am using 0.10 now.

    @CollinDavenport,

    Our developers haven't run into this issue while working with C++. Can you send us the exact error messages that you're receiving when trying to compile? Have you double checked that you have the API directory included in your compiler's path? For example (on Windows): "C:\Program Files\Quantum Signal, LLC\ANVEL 2.5 Academic\API\cpp\src"

    Regards,
    ANVEL Support



  • I can compile if I use the command without "i686-w64-mingw32-" (or its equivalents) as long as I use g++ instead of gcc, but it does not create an executable that is usable in Windows. When I try to compile it to the correct bit format it gives the error below. I am compiling in the API\cpp\src directory.

    /THRIFT/Anvel/API/cpp/src$ i686-w64-mingw32-gcc HelloAPI.cpp AnvelControlService.cpp AnvelIf_types.cpp ApiExtras.cpp -o HelloAPI.exe -lthrift
    In file included from HelloAPI.cpp:2:0:
    Thrift.h:23:45: fatal error: thrift/transport/PlatformSocket.h: No such file or directory
    #include <thrift/transport/PlatformSocket.h>
    ^
    compilation terminated.
    In file included from AnvelControlService.cpp:7:0:
    AnvelControlService.h:10:39: fatal error: thrift/TDispatchProcessor.h: No such file or directory
    #include <thrift/TDispatchProcessor.h>
    ^
    compilation terminated.
    In file included from AnvelIf_types.cpp:7:0:
    AnvelIf_types.h:12:27: fatal error: thrift/Thrift.h: No such file or directory
    #include <thrift/Thrift.h>
    ^
    compilation terminated.
    In file included from ApiExtras.cpp:1:0:
    AnvelIf_types.h:12:27: fatal error: thrift/Thrift.h: No such file or directory
    #include <thrift/Thrift.h>
    ^
    compilation terminated.



  • @CollinDavenport said in Apache Thrift Install for C++ to create executables:

    I can compile if I use the command without "i686-w64-mingw32-" (or its equivalents) as long as I use g++ instead of gcc, but it does not create an executable that is usable in Windows. When I try to compile it to the correct bit format it gives the error below. I am compiling in the API\cpp\src directory.

    /THRIFT/Anvel/API/cpp/src$ i686-w64-mingw32-gcc HelloAPI.cpp AnvelControlService.cpp AnvelIf_types.cpp ApiExtras.cpp -o HelloAPI.exe -lthrift
    In file included from HelloAPI.cpp:2:0:
    Thrift.h:23:45: fatal error: thrift/transport/PlatformSocket.h: No such file or directory
    #include <thrift/transport/PlatformSocket.h>
    ^
    compilation terminated.
    In file included from AnvelControlService.cpp:7:0:
    AnvelControlService.h:10:39: fatal error: thrift/TDispatchProcessor.h: No such file or directory
    #include <thrift/TDispatchProcessor.h>
    ^
    compilation terminated.
    In file included from AnvelIf_types.cpp:7:0:
    AnvelIf_types.h:12:27: fatal error: thrift/Thrift.h: No such file or directory
    #include <thrift/Thrift.h>
    ^
    compilation terminated.
    In file included from ApiExtras.cpp:1:0:
    AnvelIf_types.h:12:27: fatal error: thrift/Thrift.h: No such file or directory
    #include <thrift/Thrift.h>
    ^
    compilation terminated.

    @CollinDavenport,

    Our developers have been looking into this issue further, and are experiencing some of the hardships that you're talking about getting this compiling on Windows. Part of the solution will be improving our documentation, which will have to wait for the 3.0 release in May. However, in the meantime, we'd recommend trying to compile your code in Visual Studio 2015 (a free community edition is offered), which should work.

    Regards,
    ANVEL Support



  • @CollinDavenport,

    Although we still recommend using Visual Studio, you may also have some success if you include the path to the thrift headers when trying to build your executable, like this:

    gcc HelloAPI.cpp AnvelControlService.cpp AnvelIf_types.cpp ApiExtras.cpp -o HelloAPI -lthrift -I/path/to/thrift/headers

    (that's capital i)

    Regards,
    ANVEL Support



  • Were your developers able to compile once you added the path? It did not work for me, if they did how deep did the ~path/to/thrift~ go?

    Also I've had trouble building Apache Thrift from source for Visual Studio. Terminal based Linux has a much easier set up process with better documentation.



  • For all those who are interested we were able to find an alternative to thrift in creating executables. This is a relatively new development for python to convert a .py to a .exe. It has worked on creating scripted simulations as executables relatively painless. I have included the links to the pages below.

    http://nitratine.pythonanywhere.com/projects/auto-py-to-exe
    https://github.com/brentvollebregt/auto-py-to-exe


Log in to reply
 

Looks like your connection to ANVEL Forum was lost, please wait while we try to reconnect.