Issue #4 open

Build error on Mac OS X 10.7

erlloyd
created an issue

When attempting to build on Mac OS X 10.7, I get the following error:

=Glide=

CXX _obj/Main.o

In file included from ../../src/wrapper/glide.h:42,

             from ../../src/rdp.h:48,

             from ../../src/Util.h:41,

             from ../../src/Main.cpp:37:

../../src/wrapper/3dfx.h:101:4: warning: #warning define FX_ENTRY & FX_CALL for your compiler

{standard input}:1498:suffix or operands invalid for `bswap'

make: * [_obj/Main.o] Error 1

cp: mupen64plus-video-glide64/projects/unix/*.dylib: No such file or directory


Any ideas? The main mupen64plus packages built successfully (after updating the sdk root to point to 10.7)

Comments (7)

  1. erlloyd reporter

    I have some more specific information. The problem appears to be the following block of code:

    asm volatile ("bswap %[cur]"
               : [cur] "=g"(cur)
               : "[cur]"(~*(data++))
               );
    

    On lines 647-650 of Main.cpp. If I comment out these lines the entire build succeeds. Any thoughts on why this would be problematic for Mac OS X 10.7?

  2. wahrhaft repo owner
    • changed status to open

    Can you tell me if your OSX is a 32-bit or 64-bit version? If it's 64-bit, do you know if you are building Glide64 in 32-bit or 64-bit mode? What does running "gcc -v" in a terminal print out?

    The fact that it is getting hung up on the assembly code leads me to believe it's running into some sort of issue where the two modes are getting mixed up.

  3. erlloyd reporter

    That very well could be. I'm running 64-bit OSX 10.7. I also have a program that forces the OS to run the 64-bit kernel. I wonder if that's the issue. I'll try with the 32-bit kernel and see what happens.

    How do I configure if I am building Glide64 in 32 or 64 bit mode?

    Also, here is my gcc -v output:

    Using built-in specs.
    Target: i686-apple-darwin11
    Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
    Thread model: posix
    gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
    
  4. erlloyd reporter

    After trying a few more things, I am still unable to get it to compile. I've tried both 32 and 64-bit builds on the 32-bit kernel with no luck.

    Any ideas?

  5. Anonymous

    As a workaround, I disabled assembly in the Main.cpp file (#define NO_ASM 1 at the top) and it works properly.

  6. npepinpe

    How bad would it be to replace the assembly code with:

    asm volatile ("bswap %1"
          : "=r"(cur)
          : "r"(~*(data++))
    );
    

    As far as I understood, this performs the requested code:

    // cur = ~*(data++), byteswapped
    

    I'll admit that I'm not extremely proficient with Assembly, or even the inline syntax, so I might be wrong.

    I used this as a guide: GCC-Inline-Assembly-HOWTO

  7. npepinpe

    Additionally, in src/wrapper/3dfx.h, I'm pretty sure we can just go ahead and add the following:

    #elif defined(__APPLE__)
       #  define FX_ENTRY extern
       #  define FX_CALL
    

    Basically, it's what's defined for unix machines; the 3dfx.h is pretty old, so it's trying to look for "macintosh".

  8. Log in to comment