Menu

#969 Build errors related to SD path variables in application.cpp

2.2.3
closed
nobody
None
defect
major
Build system
2.2.1
fixed
2022-03-07
2017-05-09
No

I'm trying to create an up-to-date Speed Dreams (SD) package for Gentoo Linux, as the latest version of SD in the official repositories of Gentoo is the outdated 1.4.0 version. Presently I have this ebuild:

# Distributed under the terms of the GNU General Public License v2

EAPI=6
inherit cmake-utils autotools eutils versionator

REVISION="6404"
DESCRIPTION="A fork of the famous open racing car simulator TORCS"
HOMEPAGE="http://speed-dreams.sourceforge.net/"
SRC_URI="mirror://sourceforge/speed-dreams/${PN}-src-base-${PV}-r$REVISION.tar.xz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="xrandr"

RDEPEND="virtual/opengl
    virtual/glu
    media-libs/freealut
    media-libs/freeglut
    >=media-libs/libpng-1.2.40:0
    media-libs/openal
    sys-libs/zlib
    x11-libs/libX11
    x11-libs/libXxf86vm
    xrandr? ( x11-libs/libXrandr )"
DEPEND="${RDEPEND}
    dev-games/openscenegraph
    >=media-libs/plib-1.8.3
    x11-libs/libICE
    x11-libs/libSM
    x11-libs/libXext
    x11-libs/libXi
    x11-libs/libXt
    x11-libs/libXmu
    x11-libs/libXrender
    x11-proto/xproto
    xrandr? ( x11-proto/randrproto )"

S=${WORKDIR}

src_prepare() {
    MAKEOPTS="${MAKEOPTS} -j1"

    cmake-utils_src_prepare
}

src_configure() {
    mkdir $D/etc/speed-dreams
    local mycmakeargs=(
        -DCMAKE_BUILD_TYPEE=Release
        -DRELEASE_COMPILE_FLAGS=""
        -DCMAKE_SKIP_RPATH=ON
        -SD_LOCALDIR:STRING=/etc/speed-dreams
    )

    cmake-utils_src_configure
}

src_install() {
    emake DESTDIR="${D}" install datainstall

    dodoc CHANGES.txt README.txt

    newicon icon.svg ${PN}.svg
    make_desktop_entry ${PN} "Speed Dreams"
}

where mkdir $D/etc/speed-dreams and -SD_LOCALDIR:STRING=/etc/speed-dreams are lines I deliberately added to try and fix this error. The build error I get is:

[  0%] Building CXX object src/libs/tgf/CMakeFiles/tgf_static.dir/application.cpp.o
cd /var/tmp/portage/games-sports/speed-dreams-2.2.1/work/speed-dreams-2.2.1_build/src/libs/tgf && /usr/bin/x86_64-pc-linux-gnu-g++ -DGL_GLEXT_PROTOTYPES -DHAVE_CONFIG_H -DSDL_JOYSTICK -DSHM -DSPEED_DREAMS -DTHIRD_PARTY_EXPAT -DTRACE_LEVEL=5 -DTRACE_OUT -DUNLOAD_SSGGRAPH -DUSE_RANDR_EXT -D_DEFAULT_SOURCE -I/usr/include/SDL2 -I/var/tmp/portage/games-sports/speed-dreams-2.2.1/work/src/libs/portability   -DNDEBUG -O2 -pipe -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers   -o CMakeFiles/tgf_static.dir/application.cpp.o -c /var/tmp/portage/games-sports/speed-dreams-2.2.1/work/src/libs/tgf/application.cpp
/var/tmp/portage/games-sports/speed-dreams-2.2.1/work/src/libs/tgf/application.cpp: In member function ‘virtual void GfApplication::initialize(bool, int, char**)’:
/var/tmp/portage/games-sports/speed-dreams-2.2.1/work/src/libs/tgf/application.cpp:115:28: error: expected ‘)’ before ‘SD_LOCALDIR’
   ("            (default=" SD_LOCALDIR ")");
                            ^~~~~~~~~~~
/var/tmp/portage/games-sports/speed-dreams-2.2.1/work/src/libs/tgf/application.cpp:119:28: error: expected ‘)’ before ‘SD_LIBDIR’
   ("            (default=" SD_LIBDIR ")");
                            ^~~~~~~~~
/var/tmp/portage/games-sports/speed-dreams-2.2.1/work/src/libs/tgf/application.cpp:123:28: error: expected ‘)’ before ‘SD_BINDIR’
   ("            (default=" SD_BINDIR ")");
                            ^~~~~~~~~
/var/tmp/portage/games-sports/speed-dreams-2.2.1/work/src/libs/tgf/application.cpp:127:28: error: expected ‘)’ before ‘SD_DATADIR’
   ("            (default=" SD_DATADIR ")");
                            ^~~~~~~~~~
/var/tmp/portage/games-sports/speed-dreams-2.2.1/work/src/libs/tgf/application.cpp: In member function ‘bool GfApplication::parseOptions()’:
/var/tmp/portage/games-sports/speed-dreams-2.2.1/work/src/libs/tgf/application.cpp:423:31: error: ‘SD_LOCALDIR’ was not declared in this scope
   pszLocalDir = GfSetLocalDir(SD_LOCALDIR);
                               ^~~~~~~~~~~
/var/tmp/portage/games-sports/speed-dreams-2.2.1/work/src/libs/tgf/application.cpp:425:27: error: ‘SD_LIBDIR’ was not declared in this scope
   pszLibDir = GfSetLibDir(SD_LIBDIR);
                           ^~~~~~~~~
/var/tmp/portage/games-sports/speed-dreams-2.2.1/work/src/libs/tgf/application.cpp:427:27: error: ‘SD_BINDIR’ was not declared in this scope
   pszBinDir = GfSetBinDir(SD_BINDIR);
                           ^~~~~~~~~
/var/tmp/portage/games-sports/speed-dreams-2.2.1/work/src/libs/tgf/application.cpp:429:29: error: ‘SD_DATADIR’ was not declared in this scope
   pszDataDir = GfSetDataDir(SD_DATADIR);
                             ^~~~~~~~~~
/var/tmp/portage/games-sports/speed-dreams-2.2.1/work/src/libs/tgf/application.cpp:440:29: error: ‘SD_DATADIR_SRC’ was not declared in this scope
   pszDataDir = GfSetDataDir(SD_DATADIR_SRC);
                             ^~~~~~~~~~~~~~
make[2]: *** [src/libs/tgf/CMakeFiles/tgf_static.dir/build.make:63: src/libs/tgf/CMakeFiles/tgf_static.dir/application.cpp.o] Error 1
make[2]: Leaving directory '/var/tmp/portage/games-sports/speed-dreams-2.2.1/work/speed-dreams-2.2.1_build'
make[1]: *** [CMakeFiles/Makefile2:381: src/libs/tgf/CMakeFiles/tgf_static.dir/all] Error 2
make[1]: Leaving directory '/var/tmp/portage/games-sports/speed-dreams-2.2.1/work/speed-dreams-2.2.1_build'
make: *** [Makefile:152: all] Error 2

My version of cmake is 3.8.1 and my version of GCC is 6.3.0. Any ideas what the problem might be here? I'd fix this issue myself if I could, but my knowledge of C++ is mostly limited to writing math programs.

Discussion

  • Bertaux Xavier

    Bertaux Xavier - 2017-05-09

    Hi Brenton,

    In dependency, you forgot SDL. Freeglut is not necessary now since SD 2.1.0.
    SDL 2.0 is better than SDL 1.2.15 but work with both.

    Cheers
    Xavier

     
  • Brenton Horne

    Brenton Horne - 2017-05-09

    Sorry should have mentioned I had fixed that issue with subsequent edits to my ebuild here is my ebuild now:

    # Distributed under the terms of the GNU General Public License v2
    
    EAPI=6
    inherit cmake-utils autotools eutils versionator
    
    REVISION="6404"
    DESCRIPTION="A fork of the famous open racing car simulator TORCS"
    HOMEPAGE="http://speed-dreams.sourceforge.net/"
    SRC_URI="mirror://sourceforge/speed-dreams/${PN}-src-base-${PV}-r$REVISION.tar.xz"
    
    LICENSE="GPL-2"
    SLOT="0"
    KEYWORDS=""
    #"~amd64 ~x86"
    IUSE="xrandr"
    
    RDEPEND="virtual/opengl
        virtual/glu
        >=media-libs/libpng-1.2.40:0
        media-libs/openal
        sys-libs/zlib
        x11-libs/libX11
        x11-libs/libXxf86vm
        media-libs/libogg
        media-libs/libsdl2
        media-libs/freetype
        net-misc/curl
        virtual/jpeg
        xrandr? ( x11-libs/libXrandr )"
    DEPEND="${RDEPEND}
        dev-games/openscenegraph
        >=media-libs/plib-1.8.3
        x11-libs/libICE
        x11-libs/libSM
        x11-libs/libXext
        x11-libs/libXi
        x11-libs/libXt
        x11-libs/libXmu
        x11-libs/libXrender
        x11-proto/xproto
        xrandr? ( x11-proto/randrproto )"
    
    S=${WORKDIR}
    src_prepare() {
        MAKEOPTS="${MAKEOPTS} -j1"
    
        cmake-utils_src_prepare
    }
    
    src_configure() {
        mkdir $D/etc/speed-dreams
        local mycmakeargs=(
            -DCMAKE_BUILD_TYPEE=Release
            -DRELEASE_COMPILE_FLAGS=""
            -DCMAKE_SKIP_RPATH=ON
            -SD_LOCALDIR:STRING=/etc/speed-dreams
        )
    
        cmake-utils_src_configure
    }
    
    src_install() {
        emake DESTDIR="${D}" install datainstall
    
        dodoc CHANGES.txt README.txt
    
        newicon icon.svg ${PN}.svg
        make_desktop_entry ${PN} "Speed Dreams"
    }
    

    but the build still fails. By "fixed that issue" I don't mean the build errors I mean your dependency issues you mentioned. Turns out that I already had those dependencies installed (before I made subsequent edits to the ebuild fixing dependency issues you just mentioned) so it shouldn't have mattered anyway to the build.

     

    Last edit: Brenton Horne 2017-05-09
  • Bertaux Xavier

    Bertaux Xavier - 2017-05-09

    I look this tonight, but I have not sure that config files and LOCALDIR in /etc work.

    Cheers

     
  • Brenton Horne

    Brenton Horne - 2017-05-09

    I choose /etc because a package should not include files in the home directory, will setting it to $HOME/.speed-dreams cause the package to include files in the home directory?

    EDIT: I just tried editing the ebuild to use the $HOME directory instead and the build still failed with the exact same error.

     

    Last edit: Brenton Horne 2017-05-09
  • beaglejoe

    beaglejoe - 2019-07-21

    Sorry for late response.

    Two things that I noticed:
    First:
    In the code below,
    -DCMAKE_BUILD_TYPEE=Release ( has too many Es)
    should be,
    -DCMAKE_BUILD_TYPE=Release

     src_configure() {
        mkdir $D/etc/speed-dreams
        local mycmakeargs=(
            -DCMAKE_BUILD_TYPEE=Release
            -DRELEASE_COMPILE_FLAGS=""
            -DCMAKE_SKIP_RPATH=ON
            -SD_LOCALDIR:STRING=/etc/speed-dreams
        )
    

    Second:

    [  0%] Building CXX object src/libs/tgf/CMakeFiles/tgf_static.dir/application.cpp.o
    

    The tgf_static.dir indicates that you are trying to build static libraries of the speed-dreams libs.
    (should be tgf.dir).
    Check the CMake variable BUILD_SHARED_LIBS

    Cheers

     
  • beaglejoe

    beaglejoe - 2022-01-27
    • status: new --> closed
    • Milestone: to be defined --> 2.3.0
    • Resolution: --> fixed
     

Log in to post a comment.