Compiling with 64-bit Linux

List of bug fixes and updates found after version posted.

Compiling with 64-bit Linux

Postby mitch3201 » Tue Apr 01, 2008 4:42 pm

Unable to build OpenEaagles/src. This seems to be an instantiation error of some type as it occurs for multiple files.
Mitchell James
------------------
gmake[2]: Entering directory `/usr/local/OpenEaagles/src/basic/units'
g++ -I/usr/local/OpenEaagles/include -O -Wno-long-long -pthread -c -o Density.o Density.cpp
/tmp/ccK2GQlW.s: Assembler messages:
/tmp/ccK2GQlW.s:514: Error: suffix or operands invalid for `push'
/tmp/ccK2GQlW.s:520: Error: suffix or operands invalid for `pop'
----------------
Linux clustermaster 2.6.24-gentoo-r3 #2 SMP PREEMPT Mon Mar 31 15:22:02 CDT 2008 x86_64 Intel(R) Core(TM)2 Quad CPU @ 2.66GHz GenuineIntel GNU/Linux
-----------------
clustermaster ~ # gcc -v
Using built-in specs.
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.1.2/work/gcc-4.1.2/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.1.2 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-libunwind-exceptions --enable-multilib --enable-libmudflap --disable-libssp --disable-libgcj --enable-languages=c,c++,treelang,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion=Gentoo 4.1.2 p1.1
Thread model: posix
gcc version 4.1.2 (Gentoo 4.1.2 p1.1)
------------------
mitch3201
 
Posts: 1
Joined: Tue Apr 01, 2008 3:16 pm

Re: Compiling with 64-bit Linux

Postby doug » Wed Apr 02, 2008 10:09 pm

Mitch,

Looks like you are running 64bit Linux. I suspect the problem is not with compiling the Density class, but stems way down to some assembly code we have for implementing a semaphore.

If you look in the file Object.h, and scroll down to line 255 and/or 272, you will see a file called "lock2.h" being included at that point. The contents of lock2.h are as follows:

Code: Select all
__asm__ __volatile__ (
    "pushl %%ecx\n\t"
"1:\t"
    "movl $1,%%ecx\n\t"
    "lock xchgl %%ecx,%0\n\t"
    "testl %%ecx,%%ecx\n\t"
    "je   2f\n\t"
    "jmp  1b\n"
"2:\t"
    "popl %%ecx\n\t"
    :"=m" (which->semaphore)
    :
    : "memory", "%ecx"
);

Yes, it's awful looking. But in reality all it really does is implement the equivalent of a "test and set" cpu instruction. This is how cpu's implement semaphores.

Sooo... that code is for a 32-bit Linux box, not a 64-bit Linux box. I'm not positive, but I think this is the real problem.

I did come up with a portable "fix" for this that avoids the assembly code a few years ago. It was written late one night before an I/ITSEC conference to get some software running on a high-end SGI box. I need to dig that up and add it back into the baseline. I need a little time to do this.

Would you mind being a tester for the code? I don't have a 64-bit linux box around... Maybe I should do that as well!

What flavor of Linux are you running?

Doug
doug
Site Admin
 
Posts: 206
Joined: Tue Jan 01, 2008 10:00 pm

Re: Compiling with 64-bit Linux

Postby doug » Fri Apr 04, 2008 6:37 am

Mitch,

Replace the file called "lock2.h" located at:

/usr/local/OpenEaagles/include/openeaagles/basic/linux

with the one attached to this post. It has the corrected assembly code for 64-bit Linux.

I downloaded Fedora 8 x86_86 last night and setup a drive for testing. This seems to work, but I'm not finished. I didn't have time to find and install FTGL, etc. In other words, I don't have all the required dependencies installed. I plan to work on this some more, now that I have drive.

Doug

PS I'm going to change the name of the topic to "Compiling with 64-bit Linux". Thanks for posting and raising the question.
Attachments
lock2.h
Lock file for 64-bit Linux
(598 Bytes) Downloaded 140 times
doug
Site Admin
 
Posts: 206
Joined: Tue Jan 01, 2008 10:00 pm

Re: Compiling with 64-bit Linux

Postby doug » Fri Apr 04, 2008 11:13 pm

Here is an update. Replace both files "lock.h" AND "lock2.h" located at:

/usr/local/OpenEaagles/include/openeaagles/basic/linux

with the ones attached to this post.

The framework will compile and I was even able to build a few examples, BUT, there is still a bug to resolve. It is in reading bitmaps. One of the authors for the OpenEaagles book, DJ, says it's in a bitmap loader. It makes an assumption about a "long" datatype size when loading which is incorrect under 64-bit architecture.

Doug
Attachments
lock2.h
Assembly code for semaphore locks in Object
(598 Bytes) Downloaded 116 times
lock.h
Assembly code for semaphore locks in QQueue
(596 Bytes) Downloaded 135 times
doug
Site Admin
 
Posts: 206
Joined: Tue Jan 01, 2008 10:00 pm

Re: Compiling with 64-bit Linux

Postby doug » Sat Apr 05, 2008 8:59 pm

Another update. I've updated the lock files to be compatible with either 32-bit or 64-bit linux and fixed the bitmap problem. So, replace both files "lock.h" AND "lock2.h" located at:

/usr/local/OpenEaagles/include/openeaagles/basic/linux

with the ones attached to this post. Then replace Texture.cpp at:

/usr/local/OpenEaagles/src/basicGL/

Everything compiles and appears to be working.

Doug
Attachments
Texture.cpp
Updated texture file for loading bitmaps.
(21.78 KiB) Downloaded 135 times
lock2.h
Assembly code for semaphore locks in Object
(594 Bytes) Downloaded 128 times
lock.h
Assembly code for semaphore locks in QQueue
(593 Bytes) Downloaded 130 times
doug
Site Admin
 
Posts: 206
Joined: Tue Jan 01, 2008 10:00 pm

Re: Compiling with 64-bit Linux

Postby doug » Wed Jun 11, 2008 8:04 pm

Note: The lock.h and lock2.h in the previous message have been eclipsed new ones posted with the topic Fedora 9 and GCC 4.3.0.

You will still need the Texture.cpp file though...

Doug
doug
Site Admin
 
Posts: 206
Joined: Tue Jan 01, 2008 10:00 pm


Return to Version 8.03 Updates

Who is online

Users browsing this forum: No registered users and 1 guest

cron