Menu

3.4 Does Not Compile on Fedora 9

Help
2008-05-29
2013-04-23
  • Mike Hughes

    Mike Hughes - 2008-05-29

    The first error you get is:

    [  1%] Building CXX object libH/CMakeFiles/H.dir/FileEventWatcher.o
    cc1plus: warnings being treated as errors
    /home/mh/Archives/Software/PowerMate/gizmod-3.4/libH/FileEventWatcher.cpp: In member function ‘void H::FileEventWatcher::handleEventsOnFile(pollfd&)’:
    /home/mh/Archives/Software/PowerMate/gizmod-3.4/libH/FileEventWatcher.cpp:456: error: suggest explicit braces to avoid ambiguous ‘else’
    make[2]: *** [libH/CMakeFiles/H.dir/FileEventWatcher.o] Error 1
    make[1]: *** [libH/CMakeFiles/H.dir/all] Error 2
    make: *** [all] Error 2

    This is an:

    if...
       if...
       else...;

    structure which I don't consider to be an error but I obliged it by adding the braces which brought the compilation further along.  Then I got:

    [ 17%] Building CXX object libH/CMakeFiles/H.dir/Util.o
    In file included from /home/mh/Archives/Software/PowerMate/gizmod-3.4/libH/Util.cpp:30:
    /home/mh/Archives/Software/PowerMate/gizmod-3.4/libH/Util.hpp: In function ‘Functor H::for_all(Object&, Functor)’:
    /home/mh/Archives/Software/PowerMate/gizmod-3.4/libH/Util.hpp:66: error: ‘for_each’ is not a member of ‘std’
    make[2]: *** [libH/CMakeFiles/H.dir/Util.o] Error 1
    make[1]: *** [libH/CMakeFiles/H.dir/all] Error 2
    make: *** [all] Error 2

    The code is:

    /**
    * \brief  Apply function f to all elements in Object o
    * \param  object The object to apply functor to
    * \param  functor The function that modifies each object
    * \return result of std::for_each (unary_function)
    *
    * This is essentially a short cut for std::for_each
    **/
    template<class Object, class Functor>
    inline Functor for_all(Object & object, Functor functor) {
        return std::for_each(object.begin(), object.end(), functor);
    }

    I assume that this is a library incompatibility but it is getting a little deeper into the program than I want to get at the moment.  Can anyone suggest an easy work-around?  I already have the legacy C and C++ libraries installed.

    The old (Fedora 7) binary does not work with the newer versions of the "Boost" package.

    By the way, I sure am happy to see some comments in this code.  It is most refreshing!

    Mike

     
    • domster

      domster - 2008-06-07

      Same problem here.

      Dom

       
    • Mike Hughes

      Mike Hughes - 2008-07-19

      There are three issues WRT compiling "gizmod" on Fedora 9 and probably other recent distributions:

      1. The file "gizmod/cmake/Modules/DefineCompilerFlags.cmake" sets the "-Werror" compiler flag which causes warnings to be treated as errors and terminate the build.  Unfortunately, the newer C++ compilers generate lots of warnings with the current code and at least one comes from an included system file which you probably do not want to change. Clearing the warnings would be a noble enterprise but the flag needs to be removed for the moment. It is the last bit in the file.

      2. The newer compiler libraries define the "INT_MAX" constant in the "limits.h" header which is not included in the "libGizmod/Alsa.cpp" or "libGizmod/Alsa.hpp" files. The patch is as follows:

      ***************
      *** 34,39 ****
      --- 34,40 ----
        #include <boost/mem_fn.hpp>
        #include <boost/bind.hpp>
        #include <string>
      + #include <limits.h>
       
        using namespace std;
        using namespace boost;
      ****************

      3. In the Boost 1.34 library, the function "for_each()" no longer appears to be part of the "std" namespace.  In the file "libH/Util.hpp", this reference has to be removed and the header "<boost/mpl/for_each.hpp>" included explicitly. The patch is as follows:

      ***************
      *** 36,41 ****
      --- 36,43 ----
        #include "Debug.hpp"
        #include <cstdlib>
        #include <iostream>
      + #include <boost/mpl/for_each.hpp>
      +
       
        //////////////////////////////////////////////////////////////////////////////
        // Namespace
      ***************
      *** 63,69 ****
        **/
        template<class Object, class Functor>
        inline Functor for_all(Object & object, Functor functor) {
      !     return std::for_each(object.begin(), object.end(), functor);
        }
       
        /**
      --- 65,71 ----
        **/
        template<class Object, class Functor>
        inline Functor for_all(Object & object, Functor functor) {
      !     return for_each(object.begin(), object.end(), functor);
        }
       
        /**
      ***************

      This is probably not backwards compatible and there may be a better way to handle it.

      It does appear to run properly on Fedora 9 with these changes.

      Mike

       
    • Fredrik Rambris

      Fredrik Rambris - 2008-08-05

      I have made the changes outlined above but get this error after a few files

      [ 57%] Building CXX object libGizmod/CMakeFiles/Gizmod.dir/GizmoEventCPUUsage.o
      In file included from /home/boost/Data/Unpack/gizmod-3.4/libGizmod/GizmoEventCPUUsage.hpp:43,
                       from /home/boost/Data/Unpack/gizmod-3.4/libGizmod/GizmoEventCPUUsage.cpp:29:
      /usr/include/boost/serialization/vector.hpp:126: error: redefinition of 'struct boost::serialization::implementation_level<std::vector<long int, std::allocator<long int> > >'
      /usr/include/boost/serialization/vector.hpp:126: error: previous definition of 'struct boost::serialization::implementation_level<std::vector<long int, std::allocator<long int> > >'
      /usr/include/boost/serialization/vector.hpp:126: error: redefinition of 'struct boost::serialization::implementation_level<std::vector<long unsigned int, std::allocator<long unsigned int> > >'
      /usr/include/boost/serialization/vector.hpp:126: error: previous definition of 'struct boost::serialization::implementation_level<std::vector<long unsigned int, std::allocator<long unsigned int> > >'
      make[2]: *** [libGizmod/CMakeFiles/Gizmod.dir/GizmoEventCPUUsage.o] Error 1
      make[1]: *** [libGizmod/CMakeFiles/Gizmod.dir/all] Error 2
      make: *** [all] Error 2

       
    • Mike Hughes

      Mike Hughes - 2008-08-20

      Fredrik

      Sorry for the delay; I was not checking this forum closely since no one had responded here or to my post on the developers mailing list.

      The are two things I can think of:

      1.  I am using the version of Boost which comes with Fedora 9.  It could be different from the current developer's version. The most likely difference would be in the way the libraries are installed in the directory tree.

      2.  My patch files may be defective.  The first part of the file "libH/Util.hpp" should end up looking like this:

      ----------%<----------------------

      #ifndef __Util_h
      #define __Util_h

      #if HAVE_CONFIG_H
      #include "config.h"
      #endif

      #include "Debug.hpp"
      #include <cstdlib>
      #include <iostream>
      #include <boost/mpl/for_each.hpp>

      //////////////////////////////////////////////////////////////////////////////
      // Namespace
      ///////////////////////////////////////

      namespace H {

      //////////////////////////////////////////////////////////////////////////////
      // Global Algorithms
      ///////////////////////////////////////
         
      /**
      * \def    foreach
      * \brief  rename BOOST_FOREACH to foreach for nice readability
      **/
      #define foreach BOOST_FOREACH
             
      /**
      * \brief  Apply function f to all elements in Object o
      * \param  object The object to apply functor to
      * \param  functor The function that modifies each object
      * \return result of std::for_each (unary_function)
      *
      * This is essentially a short cut for std::for_each
      **/
      template<class Object, class Functor>
      inline Functor for_all(Object & object, Functor functor) {
          return for_each(object.begin(), object.end(), functor);
      }

      --------%<---------------------

      Note the last "#include..." and the next to last line of the segment, "  return for_each(...".

      As I noted, this is probably a dirty change but it has worked for me so far.  If you are involved with the Boost project, you may be able to tell me a better way to get the reference,

      return std::for_each(...

      to work properly.

      Mike

       
      • Fredrik Rambris

        Fredrik Rambris - 2008-08-24

        Thanks for the reply but I still get the same error. I run Fedora 9 x86_64

        boost-devel-1.34.1-15.fc9.x86_64
        boost-1.34.1-15.fc9.x86_64
        cmake-2.4.8-2.fc9.x86_64
        libgcc-4.3.0-8.x86_64
        gcc-4.3.0-8.x86_64
        gcc-c++-4.3.0-8.x86_64
        libgcc-4.3.0-8.i386

         
    • Jonathan Wiersma

      Hi Fredrik: 

      I had a similar problem and I had to set the following env variable when calling cmake to get it to compile in archlinux on x86_64.

      CXXFLAGS="-DBOOST_NO_INTRINSIC_INT64_T"

      Looking online it looks like this works around a bug in boost.

       
      • Fredrik Rambris

        Fredrik Rambris - 2008-09-09

        Yep, got it to work with
        CXXFLAGS="-DBOOST_NO_INTRINSIC_INT64_T" cmake

        the libs were installed to /usr/lib instead of /usr/lib64 but that was quickly fixed

         
    • Jonathan Wiersma

      Incase it's of use to anyone, here is how I'm working around these issues on archlinux:

      http://aur.archlinux.org/packages/gizmod/gizmod/gizmod.patch

      The patch:
      - Changes warnings from -Wall -Werror to -w so it will continue through warnings and not display them
      - includes limits.h in libGizmod/Alsa.cpp
      - includes the <algorithm> library in libH/Util.hpp for vector serialization

      To install the patched code, have a look at the build() function in this file:

      http://aur.archlinux.org/packages/gizmod/gizmod/PKGBUILD

      You can ignore the archlinuix stuff above the build() function.

      The build function:
      - Applies the patch above
      - sets CXXFLAGS=-DBOOST_NO_INTRINSIC_INT64_T for x86_64 systems (to work around the problem Fredrik is having)
      - calls cmake with the '-Wno-dev' flag to avoid printing some warnings and sets archlinux-specific directories (you may want to change these for a different distro)
      - runs make
      - runs make install (you may need to change DESTDIR depending on your distro/packaging system)
      - There is some extra stuff at the end to set-up udev rules on archlinux that can be ignored

       
  • Cefn Hoile

    Cefn Hoile - 2010-10-01

    I have the same issue on Ubuntu Lucid as documented in this thread…
    https://bugs.launchpad.net/ubuntu/+source/gizmod/+bug/645058

    The package in the Ubuntu distribution seems to be entirely broken, since it cannot execute at all…
    Unable to Initialize Gizmod :: User Script dir  does NOT exist or permissions are wrong!
    GizmoDaemon Shut Down.        

    This seems surprising as the package must have been put together by someone, but it couldn't possibly have worked as far as I can see. There is no /usr/etc/ directory.

    However, it's also impossible to build from source following the instructions on the wiki (but using the Ubuntu source), so I wonder if someone can suggest what boost package is missing, or what else might create the error (identical to the above)…

    Building CXX object libH/CMakeFiles/H.dir/Util.o
    In file included from /home/cefn/gizmod/gizmod-3.4/libH/Util.cpp:29:
    /home/cefn/gizmod/gizmod-3.4/libH/Util.hpp: In function ‘Functor H::for_all(Object&, Functor)’:
    /home/cefn/gizmod/gizmod-3.4/libH/Util.hpp:66: error: ‘for_each’ is not a member of ‘std’
    make: ***  Error 1
    make: ***  Error 2
    make: ***  Error 2

     

Log in to post a comment.