For those that are interested, we resolved the problem - build with -m64 and -ansi, and add the 64-bit library path to the executable's RPATH. The off-list e-mail thread is given below if you care to see the details. Cheers, Lyle -----Original Message----- From: Crescioli, Phil [mailto:Phil.Crescioli@xxxxxxxxxx] Sent: Thursday, February 12, 2004 2:57 PM To: lrtaylor Subject: RE: #error "Both _ILP32 and _LP64 are defined" Lyle, Sparcv9 in the LD_LIBRARY_PATH path did the trick. Way kewl. Now time to move on to the next fun thing :) Want to post this or part of it to thread for finality? Phil -----Original Message----- From: lrtaylor@xxxxxxxxxx [mailto:lrtaylor@xxxxxxxxxx] Sent: Thursday, February 12, 2004 4:48 PM To: Crescioli, Phil Subject: RE: #error "Both _ILP32 and _LP64 are defined" I think the problem when you try to run the 64-bit program is that the 64-bit version of the GCC libraries are not in your LD_LIBRARY_PATH or embedded in the program. So, it finds the 32-bit versions and finds that it can't use them. I believe that your 64-bit GCC libraries should be in this directory: /home/philc/GCC/gcc323bin/lib/sparcv9 At least, that's effectively the directory for my build of GCC. Try adding that directory (after you've verified that's the one) to your program's runpath. You can do that in one of two ways. Add one of the following command line arguments to your link line and then try running it again. -R/home/philc/GCC/gcc323bin/lib/sparcv9 -Wl,-rpath,/home/philc/GCC/gcc323bin/lib/sparcv9 If the first one doesn't work (that is, if the compiler doesn't accept it) try the second one. Lyle -----Original Message----- From: Crescioli, Phil [mailto:Phil.Crescioli@xxxxxxxxxx] Sent: Thursday, February 12, 2004 2:39 PM To: lrtaylor Subject: FW: #error "Both _ILP32 and _LP64 are defined" Lyle, Lyle, Awesome. Thanks for the time, I owe you one. -ansi unfortunately is a requirement since my goal is to not only port my code from gcc2952 to gcc323, but also to be to ISO/ANSI compliant. After seeing your compile worked and other emails, I did the same. My results are below. On a side note, the code is not exactly correct yet, the process filename gets printed out with a block of junk - that I'm not worried about fixing now - that's the easy part. The problem now is that with both -ansi and -m64 turned on, the program (I pasted below) compiles without errors, but it crashes with the following output: FYI - I did compile gcc3.2.3 on an ultrasparc3e(8 -ultra3e cpu's,@900MHz), using solaris 8. Looks like a wrong library I'm using? I'm not sure... Any suggestions ? [langley]:/home/philc/GCC/test> g++ -g -Wall -o glxProcInfoTest glxProcInfoTest.cpp [langley]:/home/philc/GCC/test> glxProcInfoTest Entering Main() pr_fname length = 16 Bytes procFile length = 336 ]»rð]»rðõõ$$ (`E@+ï·lxProcInfoTestglxProcInfoTestÿ¾òÿ¾ò |O=&@+ïÿÿÿÿÿÿÿÿExiting Main() [langley]:/home/philc/GCC/test> g++ -ansi -g -m64 -Wall -o glxProcInfoTest glxProcInfoTest.cpp [langley]:/home/philc/GCC/test> glxProcInfoTest ld.so.1: glxProcInfoTest: fatal: /home/philc/GCC/gcc323bin/lib/libstdc++.so.5: wrong ELF class: ELFCLASS32 Killed [langley]:/home/philc/GCC/test> [langley]:/home/philc/GCC/test> cat glxProcInfoTest.cpp #include <iostream> #include <fstream> #include <procfs.h> #include <unistd.h> using namespace std ; int main(void) { char *buffer ; ifstream procFile ; char procFileName[25] ; psinfo_t info ; int pid_ ; int length ; cout << "Entering Main()" << endl ; // Get this processes Process IDentification (PID) pid_ = getpid(); // Now setup to read the psinfo file. sprintf(procFileName, "/proc/%d/psinfo", pid_); # if 1 procFile.open(procFileName,ifstream::in); # else procFile.open(procFileName, ios::binary) ; # endif if (procFile.is_open()) { // allocate memory: buffer = new char [sizeof(info.pr_fname)]; cout <<"pr_fname length = "<<sizeof(info.pr_fname)<<" Bytes"<<endl; // get length of file: procFile.seekg(0, ios::end); length = procFile.tellg(); cout << "procFile length = " << length << endl ; procFile.seekg(0, ios::beg); // read data as a block: procFile.read(buffer,length); procFile.close(); strcpy(buffer, info.pr_fname); cout.write(buffer, length); } else { cout << "cant open process info file" << endl ; } cout << "Exiting Main()" << endl ; return (0); } /* main */ [langley]:/home/philc/GCC/test> -----Original Message----- From: lrtaylor@xxxxxxxxxx [mailto:lrtaylor@xxxxxxxxxx] Sent: Thursday, February 12, 2004 1:54 PM To: Crescioli, Phil Subject: RE: #error "Both _ILP32 and _LP64 are defined" Sorry. I didn't mean to build GCC with that option. I meant to use that option when compiling programs with GCC. Here's a simple example of what I was talking about: admin-devl> file ftest ftest: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped admin-devl> rm ftest admin-devl> g++ -o ftest -m64 test.cpp admin-devl> file ftest ftest: ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped ftest is just a stupid little test program. The first copy was built with GCC without -m64. In my case, it produces 32-bit executables by default. -m64 causes it to build a 64-bit executable. However, it just tried to build your test program on a box here, and it built fine for me. I'm using GCC 3.3.1. Hold on, I'll respond with that to the list... Lyle -----Original Message----- From: Crescioli, Phil [mailto:Phil.Crescioli@xxxxxxxxxx] Sent: Thursday, February 12, 2004 11:41 AM To: lrtaylor Subject: FW: #error "Both _ILP32 and _LP64 are defined" Lyle, Silly Q 4 U... Im trying to figure out how I pass -m64 in the gcc config step? This doesn't work... cd $HOME/GCC64/obj $HOME/GCC64/gcc-3.2.3/configure --prefix=$HOME/GCC64/bin -m64 Thanks, Phil -----Original Message----- From: lrtaylor@xxxxxxxxxx [mailto:lrtaylor@xxxxxxxxxx] Sent: Wednesday, February 11, 2004 6:18 PM To: Crescioli, Phil Subject: RE: #error "Both _ILP32 and _LP64 are defined" I believe that GCC builds 32-bit executables by default. If this is an option, you could try telling it to build a 64-bit binary instead using the -m64 option. Cheers, Lyle