#error "Both _ILP32 and _LP64 are defined"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think I'm having some 64bit<-->32bit ABI compatibility problems and
not quite sure how to solve *correctly*.  I wish I could set a compiler
directive to solve it.  My attempts so far don't work. Any help is
appreciated. I'm on a sparc system running solaris 8 with gcc 3.2.3.

My code below finds its PID from the proc tables 
in /usr/proc/* and then finds it's file name using 
fstream and procfs structure variables then prints 
the executed filename to stdout.
============================================================
#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();
  sprintf(procFileName, "/proc/%d/psinfo", pid_);
  procFile.open(procFileName, ios::binary) ;
  if (procFile.is_open())
  {
    // get length of file:
    procFile.seekg(0, ios::end);
    length = procFile.tellg();
    procFile.seekg(0, ios::beg);
    // allocate memory:
    buffer = new char [length];
    // read data as a block:
    procFile.read(buffer,length);
    procFile.close();
    strcpy(buffer, info.pr_fname);
    cout << "buffer =" << buffer << endl ;
  }
  else{
    cout << "cant open process info file" << endl ;
  }
  cout << "Exiting Main()" << endl ;
  return (0);
}  /* main */
======================================================================
When I compile this code with the cmd below I get the following error
======================================================================
g++ -ansi -g -Wall -o ProcInfoTest ProcInfoTest.cpp
In file included from /usr/include/sys/procfs.h:41,
                 from /usr/include/procfs.h:26,
                 from glxProcInfoTest.cpp:3:
/usr/include/sys/procfs_isa.h:230: 'uint64_t' is used as a type, but is
not 
   defined as a type.
In file included from /usr/include/procfs.h:26, from
glxProcInfoTest.cpp:3:
/usr/include/sys/procfs.h:304: 'uint64_t' is used as a type, but is not
defined as a type.

======================================================================
I found that uint64_t is defined in /usr/include/sys/int_types.h.
So, when I compile this code with the additional -DLP64 directive I 
get the following error
======================================================================
g++ -ansi -g -Wall -D_LP64 -o ProcInfoTest ProcInfoTest.cpp
In file included from /usr/include/sys/feature_tests.h:15,
                 from /usr/include/iso/stdio_iso.h:35,
                 from
/home/philc/GCC/gcc323bin/lib/gcc-lib/sparc-sun-solaris2.8/3.2.3/include
/stdio.h:36,
                 from
/home/philc/GCC/gcc323bin/include/c++/3.2.3/cstdio:52,
                 from
/home/philc/GCC/gcc323bin/include/c++/3.2.3/sparc-sun-solaris2.8/bits/c+
+io.h:35, from
/home/philc/GCC/gcc323bin/include/c++/3.2.3/bits/fpos.h:44,
                 from
/home/philc/GCC/gcc323bin/include/c++/3.2.3/iosfwd:46,
                 from
/home/philc/GCC/gcc323bin/include/c++/3.2.3/ios:44,
                from
/home/philc/GCC/gcc323bin/include/c++/3.2.3/ostream:45,
              from
/home/philc/GCC/gcc323bin/include/c++/3.2.3/iostream:45,
               from glxProcInfoTest.cpp:1:
/usr/include/sys/isa_defs.h:376:2: #error "Both _ILP32 and _LP64 are
defined"
======================================================================
If anyone knows how I can only get _LP64 defined to make this compile,
or what the correct solution is to get this compiles, please let me
know.
======================================================================
Thanks,
Phil Crescioli
GENERAL DYNAMICS
Phil.Crescioli@xxxxxxxxxx


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux