• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
RetroPie forum home
  • Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login

Compiles fine manually, fails to compile in RetroPie script

Scheduled Pinned Locked Moved Ideas and Development
xash3dscriptmodulescompile
13 Posts 4 Posters 1.3k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z
    zerojay
    last edited by 15 Sept 2020, 05:02

    Hi, I'm currently attempting to write a port for xash3d-fwgs, a newer version of the engine for Half-Life. Unfortunately, I'm having a strange issue where running the steps manually results in a compiled build that functions, but running them through a RetroPie scriptmodule fails. I suspect that what is going on is RetroPie is adding its own CFLAGS and this is causing the script's detection to fail. Here's the in-progress version of the script module:

    rp_module_id="xash3d-fwgs"
    rp_module_desc="xash3d-fwgs - Half-Life Engine Port"
    rp_module_help="Please add your full version xash3d-fwgs files to $romdir/ports/$md_id/ to play."
    rp_module_section="exp"
    rp_module_flags="!mali !x86"
    
    function depends_xash3d-fwgs() {
        getDepends libsdl2-dev libfontconfig1-dev libfreetype6-dev
    }
    
    function sources_xash3d-fwgs() {
        gitPullOrClone "$md_build" https://github.com/FWGS/xash3d-fwgs.git
    }
    
    function build_xash3d-fwgs() {
         ./waf configure -T release
         ./waf build
        md_ret_require=(
            "$md_build/build/game_launch/xash3d"
            "$md_build/build/engine/libxash.so"
        )
    }
    
    function install_xash3d-fwgs() {
        ./waf install
    }
    
    function configure_xash3d-fwgs() {
    # Work not started on configure, ignore.
    }
    

    Building with this script results in the following:

    [  3/258] Compiling public/xash3d_mathlib.c
    [  4/258] Compiling public/crtlib.c
    In file included from ../public/crtlib.h:20,
                     from ../public/crclib.c:17:
    ../public/build.h:188:4: error: #error "Unknown ARM"
       #error "Unknown ARM"
    

    Instructions for building manually found here under Building: https://github.com/FWGS/xash3d-fwgs

    Looking into build/compile_commands.json in my manual compile, I see the following:

     "arguments": [
          "/usr/bin/gcc",
          "-g",
          "-fvisibility=hidden",
          "-O3",
          "-fdiagnostics-color=always",
          "-Werror=return-type",
          "-Werror=parentheses",
          "-Werror=vla",
           ...
    

    Looking at the build/compile_commands.json of the RetroPie build, I see the following:

      {
        "arguments": [
          "/usr/bin/gcc",
          "-march=armv8-a+crc",
          "-mtune=cortex-a72",
          "-mfpu=neon-fp-armv8",
          "-mfloat-abi=hard",
          "-O2",
          "-g",
          "-fvisibility=hidden",
          "-O3",
          "-fdiagnostics-color=always",
          "-Werror=return-type",
          "-Werror=parentheses",
          "-Werror=vla",
          ...
    

    Looking at the piece of code for figuring out the ARM stuff, from public/build.h:

    #elif defined __arm__ || defined _M_ARM
            #if defined _M_ARM
                    // msvc can only armv7 ?
                    #define XASH_ARM 7
            #elif __ARM_ARCH == 7 || __ARM_ARCH_7__
                    #define XASH_ARM 7
            #elif __ARM_ARCH == 6 || __ARM_ARCH_6__ || __ARM_ARCH_6J__
                    #define XASH_ARM 6
            #elif __ARM_ARCH == 5 || __ARM_ARCH_5__
                    #define XASH_ARM 5
            #elif __ARM_ARCH == 4 || __ARM_ARCH_4__
                    #define XASH_ARM 4
            #else
                    #error "Unknown ARM"
            #endif
    
            ...
    
            #if defined __SOFTFP__ || __ARM_PCS_VFP == 0
                    #define XASH_ARM_SOFTFP 1
            #else // __SOFTFP__
                    #define XASH_ARM_HARDFP 1
    
           ...
    #if XASH_ARM == 7
            #define XASH_ARMv7 1
    #elif XASH_ARM == 6
            #define XASH_ARMv6 1
    #elif XASH_ARM == 5
            #define XASH_ARMv5 1
    #elif XASH_ARM == 4
            #define XASH_ARMv4 1
    #endif
    

    I'm not too sure how to continue here. I attempted to add CFLAGS="" before the ./waf calls in build and it did indeed remove the flags that RetroPie seems to be adding however you can see that it's only worked for a few files, not all of them.

    Any ideas/advice would be most appreciated.

    1 Reply Last reply Reply Quote 0
    • M
      mitu Global Moderator
      last edited by 15 Sept 2020, 05:22

      That's because -march=armv8-a+crc switches __ARM_ARCH to 8, while the defaults for the compiler sets __ARM_ARCH to 6. The header you referenced doesn't know about the newer __ARM_ARCH variant.

      # RetroPie flags
      $ echo | gcc -march=armv8-a+crc -dM -E - | grep -i '__ARM_ARCH '
      #define __ARM_ARCH 8
      
      # no flags
      $ echo | gcc -dM -E - | grep -i '__ARM_ARCH '
      #define __ARM_ARCH 6
      
      Z 1 Reply Last reply 15 Sept 2020, 06:09 Reply Quote 1
      • Z
        zerojay @mitu
        last edited by 15 Sept 2020, 06:09

        @mitu Thank you, I've sent a pull request upstream with the fix.

        K 1 Reply Last reply 3 Oct 2020, 18:24 Reply Quote 0
        • K
          kactius @zerojay
          last edited by 3 Oct 2020, 18:24

          @zerojay You pull was accepted

          Z 1 Reply Last reply 4 Oct 2020, 02:06 Reply Quote 0
          • Z
            zerojay @kactius
            last edited by 4 Oct 2020, 02:06

            @kactius said in Compiles fine manually, fails to compile in RetroPie script:

            @zerojay You pull was accepted

            Yep, thanks.

            1 Reply Last reply Reply Quote 0
            • K
              kactius
              last edited by kactius 14 Oct 2020, 11:03

              Hi
              I update extras script and test xash3d-fwgs
              Could not successfully build xash3d-fwgs - xash3d-fwgs - Half-Life Engine Port (home/pi/RetroPie-Setup/rmp/build/xash3d-fwgs/xash3d-fwgs/build/game_launch/Xash3D not found)...

              Really the folder is empty sftp://retropie/home/pi/RetroPie-Setup/tmp/build/xash3d-fwgs/xash3d-fwgs/build/game_launch/ empty

              If you need logs, please ask me

              Z 1 Reply Last reply 15 Oct 2020, 21:10 Reply Quote 0
              • Z
                zerojay @kactius
                last edited by 15 Oct 2020, 21:10

                @kactius said in Compiles fine manually, fails to compile in RetroPie script:

                Hi
                I update extras script and test xash3d-fwgs
                Could not successfully build xash3d-fwgs - xash3d-fwgs - Half-Life Engine Port (home/pi/RetroPie-Setup/rmp/build/xash3d-fwgs/xash3d-fwgs/build/game_launch/Xash3D not found)...

                Really the folder is empty sftp://retropie/home/pi/RetroPie-Setup/tmp/build/xash3d-fwgs/xash3d-fwgs/build/game_launch/ empty

                If you need logs, please ask me

                Yeah, post the logs please.

                K 1 Reply Last reply 17 Oct 2020, 21:51 Reply Quote 0
                • K
                  kactius @zerojay
                  last edited by 17 Oct 2020, 21:51

                  @zerojay
                  /home/pi/RetroPie-Setup/logs/rps_2020-10-14_123218.log.gz
                  https://pastebin.com/wAh1AfQr

                  If you need more logs, say me patch to other logs

                  Z 1 Reply Last reply 18 Oct 2020, 08:36 Reply Quote 0
                  • Z
                    zerojay @kactius
                    last edited by 18 Oct 2020, 08:36

                    @kactius said in Compiles fine manually, fails to compile in RetroPie script:

                    @zerojay
                    /home/pi/RetroPie-Setup/logs/rps_2020-10-14_123218.log.gz
                    https://pastebin.com/wAh1AfQr

                    If you need more logs, say me patch to other logs

                    Nothing I can do about that, you'll need to ask upstream.

                    K 1 Reply Last reply 25 Mar 2021, 21:36 Reply Quote 0
                    • K
                      kactius @zerojay
                      last edited by kactius 25 Mar 2021, 21:36

                      @zerojay
                      Hi sorry to reflow this threat, pi3b+ now is compile fine.
                      Install source xash3d and next install source xash3d-fwgs
                      link log

                      I still have to put the game files to test.

                      ExarKunIvE 1 Reply Last reply 27 Mar 2021, 04:56 Reply Quote 0
                      • ExarKunIvE
                        ExarKunIv @kactius
                        last edited by 27 Mar 2021, 04:56

                        @kactius yes it was fixed on Wednesday. I came across it not working so I was working with the dev over there on fwgs and we got it all straightened out. Just hope that it stays that way this time

                        RPi3B+ / 200GB/ RetroPie v4.5.14, RPi4 Model B 4gb / 256gb / RetroPie 4.8.2
                        RPi5 4gb / 512gb / RetroPie 4.8.9 -Basic
                        Maintainer of RetroPie-Extra .

                        K 1 Reply Last reply 29 Mar 2021, 00:51 Reply Quote 0
                        • K
                          kactius @ExarKunIv
                          last edited by kactius 29 Mar 2021, 00:51

                          @exarkuniv said in Compiles fine manually, fails to compile in RetroPie script:

                          @kactius yes it was fixed on Wednesday. I came across it not working so I was working with the dev over there on fwgs and we got it all straightened out. Just hope that it stays that way this time

                          Oh! Very thanks.
                          fwgs is working.
                          I paste the game files in this moment some ¿textures? don't look good in pi 3 b+ pi3.
                          Found rendener gl: OpenGL
                          Found renderer soft: Sofitware Loading renderer: gl -> libref_gl.so
                          Trying safe opengl mode O
                          bpp 32
                          Sys Warn Error: Can't initialize libref_gl.so renderer
                          Loading renderer: gl -> libref_gl.so

                          ExarKunIvE 1 Reply Last reply 29 Mar 2021, 13:03 Reply Quote 0
                          • ExarKunIvE
                            ExarKunIv @kactius
                            last edited by 29 Mar 2021, 13:03

                            @kactius i think that,s happening cuz the pi3 does not support opengl
                            i have the old halflife port on my pi3 so i cant test it on that since i have it working fine.

                            and right now im working with my pi4

                            RPi3B+ / 200GB/ RetroPie v4.5.14, RPi4 Model B 4gb / 256gb / RetroPie 4.8.2
                            RPi5 4gb / 512gb / RetroPie 4.8.9 -Basic
                            Maintainer of RetroPie-Extra .

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post

                            Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                            Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.

                              [[user:consent.lead]]
                              [[user:consent.not_received]]