This topic contains 10 replies, has 0 voices, and was last updated by  Raven 9 years, 11 months ago.

  • Author
    Posts
  • #6026

    Raven
    Participant

    I’m trying to compile V41 on FreeBSD 7, and after some fiddling, it configured properly.
    But there seems to be a slight problem with FreeBSDs libs/headers.
    The build stops at the network part with the following output:

    /usr/include/net/if.h:284: error: field ‘ifru_addr’ has incomplete type
    /usr/include/net/if.h:285: error: field ‘ifru_dstaddr’ has incomplete type
    /usr/include/net/if.h:286: error: field ‘ifru_broadaddr’ has incomplete type
    /usr/include/net/if.h:318: error: field ‘ifra_addr’ has incomplete type
    /usr/include/net/if.h:319: error: field ‘ifra_broadaddr’ has incomplete type
    /usr/include/net/if.h:320: error: field ‘ifra_mask’ has incomplete type
    /usr/include/net/if.h:418: error: field ‘addr’ has incomplete type
    /usr/include/net/if.h:419: error: field ‘dstaddr’ has incomplete type

    Is there a workaround, patch or something ?

    #46489

    cbx550f
    Participant

    I don’t have FreeBSD installed anymore…

    If you scroll up more, is there many errors above that? (I’m suspecting so). If so, post the top one, as it should help.

    cbx

    #46490

    Raven
    Participant

    As far as I can see, this is the first error.
    I scrolled up a few lines, this is the output until it stops:

    echo ‘./’`../net/NetServerUDPDestination.cpp
    mv -f .deps/NetServerUDPDestination.Tpo .deps/NetServerUDPDestination.Po
    g++ -DPACKAGE_NAME=”” -DPACKAGE_TARNAME=”” -DPACKAGE_VERSION=”” -D
    PACKAGE_STRING=”” -DPACKAGE_BUGREPORT=”” -DPACKAGE=”scorched3d” -D
    VERSION=”41″ -DHAVE_OGG=1 -DHAVE_VSNPRINTF=1 -DHAVE_SNPRINTF=1 -DHAVE_
    VASPRINTF=1 -DHAVE_ASPRINTF=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHA
    VE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -D
    HAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1
    -DHAVE_UNISTD_H=1 -I. -I../porting -I.. -I/usr/local/include -I/usr/
    local/include -I/usr/local/include/freetype2 -I/usr/local/include -I/u
    sr/local/include/SDL -I/usr/local/include -D_GNU_SOURCE=1 -D_REENTRANT –
    I/usr/X11R6/include -I/usr/X11R6 -I/usr/local/include -g -O2 -DS3D_DOCD
    IR=”/usr/local/games/scorched3d/share/documentation” -DS3D_DATADIR=”/
    usr/local/games/scorched3d/share” -DS3D_BINDIR=”/usr/local/games/scorc
    hed3d/bin” -MT SecureID.o -MD -MP -MF .deps/SecureID.Tpo -c -o SecureID
    .o `test -f ‘../net/SecureID.cpp’ || echo ‘./’`../net/SecureID.cpp
    In file included from ../net/SecureID.cpp:4:
    /usr/include/net/if.h:284: error: field ‘ifru_addr’ has incomplete type
    /usr/include/net/if.h:285: error: field ‘ifru_dstaddr’ has incomplete ty
    pe
    /usr/include/net/if.h:286: error: field ‘ifru_broadaddr’ has incomplete
    type
    /usr/include/net/if.h:318: error: field ‘ifra_addr’ has incomplete type
    /usr/include/net/if.h:319: error: field ‘ifra_broadaddr’ has incomplete
    type
    /usr/include/net/if.h:320: error: field ‘ifra_mask’ has incomplete type
    /usr/include/net/if.h:418: error: field ‘addr’ has incomplete type
    /usr/include/net/if.h:419: error: field ‘dstaddr’ has incomplete type
    ../net/SecureID.cpp: In member function ‘std::string SecureID::GetPrivat
    eKey()’:
    ../net/SecureID.cpp:41: error: ‘AF_INET’ was not declared in this scope
    ../net/SecureID.cpp:41: error: ‘SOCK_DGRAM’ was not declared in this sco
    pe
    ../net/SecureID.cpp:41: error: ‘socket’ was not declared in this scope
    ../net/SecureID.cpp:72: error: ‘SIOCGIFHWADDR’ was not declared in this
    scope
    ../net/SecureID.cpp:80: error: ‘struct ifreq’ has no member named ‘ifr_h
    waddr’
    gmake[2]: *** [SecureID.o] Error 1
    gmake[2]: Leaving directory `/usr/home/raven/temp/scorched/src/scorchedc

    gmake[1]: *** [all-recursive] Error 1
    gmake[1]: Leaving directory `/usr/home/raven/temp/scorched/src’
    gmake: *** [all-recursive] Error 1

    If you really want to search the whole output, I attached a text file.

    PS
    I’m a Honda mechanic – do you still own that 550 ? 😀

    #46491

    cbx550f
    Participant

    Like I said, I can’t really test, but try adding:

    #include

    To src/net/SecureID.h before line 4 (before the include )

    PS
    I’m a Honda mechanic – do you still own that 550 ? 😀

    Somehow missed this comment last time…. Yup, I do. (It’s right beside me here in the basement!)

    #46492

    Raven
    Participant

    We’re making progress, now it stops here:

    || echo ‘./’`../net/SecureID.cpp
    ../net/SecureID.cpp: In member function ‘std::string SecureID::GetPrivateKey()’:
    ../net/SecureID.cpp:73: error: ‘SIOCGIFHWADDR’ was not declared in this scope
    ../net/SecureID.cpp:81: error: ‘struct ifreq’ has no member named ‘ifr_hwaddr’
    gmake[2]: *** [SecureID.o] Error 1

    I googled a bit and found that SIOCGIFHWADDR is Linux specific.
    Removing the section works local, but Network games (naturally) crash.
    Maybe we could use the old v40.1 method ???

    Damn, I really should learn how to C . .

    #46493

    cbx550f
    Participant

    Good to hear… reading up on this… hope to have something soon.

    #46494

    cbx550f
    Participant

    Since I cannot test this, I’d like to try a quick hack….

    At around line 77 of net/SecureID.cpp, change it so that it is like the following snippet:


    strcpy (dev.ifr_name, InterfaceName.c_str()); //select from the name
    # ifdef SIOCGIFHWADDR // HERE
    if (ioctl(sock, SIOCGIFHWADDR, &dev) < 0) //get the interface data
    {
    close(sock);
    return ""; //cannot list the interfaces
    }

    for (int i=0; i<6; i++)
    {
    Key += (((unsigned int)dev.ifr_hwaddr.sa_data)&255);
    if (i != 5) Key += ':';
    }
    close(sock);

    return Key;
    }

    # elif // HERE
    Key = "00:00:00:00:00:00"; //HERE
    return Key; // HERE
    #endif

    std::string SecureID::MakeID(std::string ServerAddress)

    The lines to add are marked with the comment //HERE 😉

    Not a permanent solution, but it (or something similar!) should get you going.

    #46495

    Brain Damage
    Participant

    whoops, that’s my faulty code i guess 😳

    i checked a bit the freeBSD kernel docs & i looked at some examples; try replacing the file with the one i attached, should work without workarounds

    (sorry i don’t have BSD either, so i can’t test 🙁 )

    #46496

    cbx550f
    Participant

    Looks like you looked at the same thing I did, BD, I have the pretty much the exact code here, but I thought I’d take it smaller steps as I cannot test. 😉
    (Read: I wanted to be damned sure I was correct in doing the ifdef there 😉 )

    Good work. 🙂

    #46497

    Raven
    Participant

    We’re getting closer.
    CBXs method gives just a few (small) errors:


    /net/SecureID.cpp’ || echo ‘./’`../net/SecureID.cpp
    ../net/SecureID.cpp:90:57: error: #if with no expression
    ../net/SecureID.cpp:19:1: error: unterminated #else
    ../net/SecureID.cpp: In member function ‘std::string SecureID::GetPrivateKey()’:
    ../net/SecureID.cpp:96: error: a function-definition is not allowed here before ‘{‘ token
    ../net/SecureID.cpp:112: error: expected `}’ at end of input
    gmake[2]: *** [SecureID.o] Error 1



    The compiler didn’t like DBs fix very much:


    /usr/local/games/scorched3d/bin” -MT SecureID.o -MD -MP -MF .deps/SecureID.Tpo -c -o SecureID.o `test -f ‘../net/SecureID.cpp’ || echo ‘./’`../net/SecureID.cpp
    ../net/SecureID.cpp:149:2: error: #endif without #if
    ../net/SecureID.cpp: In member function ‘std::string SecureID::GetPrivateKey()’:
    ../net/SecureID.cpp:56: error: aggregate ‘ifreq dev’ has incomplete type and cannot be defined
    ../net/SecureID.cpp:57: error: invalid use of incomplete type ‘struct if_nameindex’
    ../net/SecureID.cpp:57: error: forward declaration of ‘struct if_nameindex’
    ../net/SecureID.cpp:68: error: invalid use of incomplete type ‘struct if_nameindex’
    ../net/SecureID.cpp:57: error: forward declaration of ‘struct if_nameindex’
    ../net/SecureID.cpp:68: error: invalid use of incomplete type ‘struct if_nameindex’
    ../net/SecureID.cpp:57: error: forward declaration of ‘struct if_nameindex’
    ../net/SecureID.cpp:71: error: ‘if_freenameindex’ was not declared in this scope
    ../net/SecureID.cpp:74: error: invalid use of incomplete type ‘struct if_nameindex’
    ../net/SecureID.cpp:57: error: forward declaration of ‘struct if_nameindex’
    ../net/SecureID.cpp:74: error: invalid use of incomplete type ‘struct if_nameindex’
    ../net/SecureID.cpp:57: error: forward declaration of ‘struct if_nameindex’
    ../net/SecureID.cpp:78: error: ‘if_freenameindex’ was not declared in this scope
    ../net/SecureID.cpp:119: error: invalid conversion from ‘void*’ to ‘unsigned char*’
    ../net/SecureID.cpp: At global scope:
    ../net/SecureID.cpp:144: error: redefinition of ‘std::string SecureID::GetPrivateKey()’
    ../net/SecureID.cpp:47: error: ‘std::string SecureID::GetPrivateKey()’ previously defined here
    ../net/SecureID.cpp:152: error: redefinition of ‘std::string SecureID::GetPrivateKey()’
    ../net/SecureID.cpp:47: error: ‘std::string SecureID::GetPrivateKey()’ previously defined here
    ../net/SecureID.cpp: In member function ‘std::string SecureID::GetPrivateKey()’:
    ../net/SecureID.cpp:158: error: cannot convert ‘std::basic_string<char, std::char_traits, std::allocator >(((const std::basic_string<char, std::char_traits, std::allocator >&)((const std::basic_string<char, std::char_traits, std::allocator >*)(& Key))))’ from type ‘std::string’ to type ‘std::basic_string<char, std::char_traits, std::allocator >&’
    gmake[2]: *** [SecureID.o] Error 1



    I‘m using gcc 4.2.1, if that’s of any help.

    #46498

    cbx550f
    Participant

    Oops, I was being sloppy. At around line 90, where it has the “# elif”, change that segment to:

    # else                                                  // Ugly temporary hack for BSD
    Key = "00:00:00:00:00:00";
    return Key;
    # endif
    #endif

    Not only did I use elif instead of else, I also forgot the endif. 😳

    BD’s way is the right way, and is ultimately where we’d like to go.

    #46499

    Raven
    Participant

    Didn’t work.
    Then I noticed that sections between lines starting with “#
    have brackets around them.
    So I thought , maybe, we need some more.


    # else
    {
    Key = “00:00:00:00:00:00”;
    return Key;
    }
    # endif
    #endif


    . . and it worked. 😯

    Your hack might be ugly, ( I haven’t the foggiest )
    but I went online without difficulties.

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.