public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: using gcc 3.0.1 and 2.95.2.1
@ 2001-09-11  1:04 Michael Veksler
  2001-09-11  3:46 ` Willy Gardiol
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Veksler @ 2001-09-11  1:04 UTC (permalink / raw)
  To: gardiol; +Cc: gcc-help

> I am trying to compile kdevelop 2.0 but i get an error
> compiling flex related stuff (flex 2.5.4a)

Flex (the one that I have) creates non standard c++ code.
The ungly hack that I have runs sed on the result of flex,
and replaces 'class istream;' with '#include <iosfwd.h>".
"iosfwd.h" is a file I wrote that includes iosfwd, and has
several "using std::one-of-iostream-classes;" lines.

> So i decided to install a second gcc: 2.905.2.1

You mean gcc-2.95.2, right ?
> (/usr/local/gcc-2.95.2) and use it to compile KDevelop.

> It works, BUT if i try to compile with that gcc i get
> tons (really tons) of udefined symbol!


> Now i suspect gcc from 2.x to 3.x uses a different naming
> for c++ symbols but how can i overcome this problem?

Maybe recompile every single C++ library you have with the same C++
compiler?

The ABI of gcc C++ has changed every release (except for patch level
releases). This means that C++ code you compiled (or somebody else
compiled for you), cannot be mixed with C++ code compiled with different
gcc versions.

It *may* be possible to mix two different C++ versions in a single program
by using C or CORBA proxies, but I guess you are not that desperate.


  Michael


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: using gcc 3.0.1 and 2.95.2.1
  2001-09-11  1:04 using gcc 3.0.1 and 2.95.2.1 Michael Veksler
@ 2001-09-11  3:46 ` Willy Gardiol
  0 siblings, 0 replies; 4+ messages in thread
From: Willy Gardiol @ 2001-09-11  3:46 UTC (permalink / raw)
  To: Michael Veksler; +Cc: gcc-help

> Flex (the one that I have) creates non standard c++ code.
> The ungly hack that I have runs sed on the result of flex,
> and replaces 'class istream;' with '#include <iosfwd.h>".
> "iosfwd.h" is a file I wrote that includes iosfwd, and has
> several "using std::one-of-iostream-classes;" lines.

Where can i find that file? 
i would like to try this workaround.I would need kdevelop in a short.

> > So i decided to install a second gcc: 2.905.2.1
>
> You mean gcc-2.95.2, right ?

2.95.2.1 yes :) type error....
just because 2.95.2 is the "officially" supported gcc by kde

> > Now i suspect gcc from 2.x to 3.x uses a different naming
> > for c++ symbols but how can i overcome this problem?
>
> Maybe recompile every single C++ library you have with the same C++
> compiler?

Argh!
so, should i go back to 2.95.2 or some other older compiler ( i dont want toi 
do this unless i am REALLY desperate) or try to fix problems as they came? 

> It *may* be possible to mix two different C++ versions in a single program
> by using C or CORBA proxies, but I guess you are not that desperate.

Can you explain better? i am NOT so desperate but i am curious.

thanks!

>
>
>   Michael

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: using gcc 3.0.1 and 2.95.2.1
@ 2001-09-11  5:44 Michael Veksler
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Veksler @ 2001-09-11  5:44 UTC (permalink / raw)
  To: gardiol; +Cc: gcc-help

> > "iosfwd.h" is a file I wrote that includes iosfwd, and has
> > several "using std::one-of-iostream-classes;" lines.
>
> Where can i find that file?
> i would like to try this workaround.I would need kdevelop in a short.

It is trivial to write, just read vector.h in gcc-3.0 and use it
as an example. I don't want to give you the actual file
(company copyright policy I don't want to check and learn).
It should look something like:

// iosfwd.h
#ifndef _IOSFWD_H
#define _IOSFWD_H
#include <iosfwd>
using std::istream; // this is probably enough for flex.
// Put here other things that you find in iosfwd
// and prefix them with "using std::"
#endif


> > Maybe recompile every single C++ library you have with the same C++
> > compiler?
>
> Argh!
> so, should i go back to 2.95.2 or some other older compiler ( i dont want
toi
> do this unless i am REALLY desperate) or try to fix problems as they
came?
If you know what was compiled with what version, then you only have to
recompile libraries you depend on and are from the "wrong" version.
If you used shared libraries, then it should be simple - just run ldd on
the library in question and you will see what libstdc++.so it uses.

> > It *may* be possible to mix two different C++ versions in a single
program
> > by using C or CORBA proxies, but I guess you are not that desperate.
>
> Can you explain better? i am NOT so desperate but i am curious.

You can read about CORBA on the net.
C proxy can be something like this (CORBA auto-generated code has
similarities
with this example):

// A.h
// This is the original class compiled with gcc-2.95
class A {
public:
   int get();
  void set(int a);
};

// proxy.h
extern "C" {
struct proxy_A;   // this gives minimal type checking
int A_get(proxy_A *object);
void A_set(proxy_A *object, int a);
proxy_A * A_new();
void A_delete(proxy_A*);
};

// proxy2-95.cpp - compiled with gcc-2.95
#include "A.h"
#include "proxy.h"
int A_get(proxy_A *object)
{
  return ((A*)object)->get();
}
void A_set(proxy_A *object, int a)
{
  ((A*)object)->set(a);
}
// etc.


// proxy3.h - included by code compiled with  gcc-3.0
namespace Gcc3 {
  class A {
  public:
     A() { _value = A_new(); }
     // do something for copy ctor and assignment...
    ~A() { A_delete(_value) };
     int get() { return A_get(_value); }
    void set(int a) { A_set(_value, a); }
  private:
   proxy_A *_value;
  };
};
using namespace Gcc3;

/// end example


Note that this may not work due to clashing libstdc++. You may overcome
that by dlopen tricks (and in that case you don't need namespace Gcc3).
As you see, it can be done, but doing it manually is not very nice.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* using gcc 3.0.1 and 2.95.2.1
@ 2001-09-11  0:22 Willy Gardiol
  0 siblings, 0 replies; 4+ messages in thread
From: Willy Gardiol @ 2001-09-11  0:22 UTC (permalink / raw)
  To: gcc-help

I
i am building my linux box from the sand...
i choose gcc 3.0 (then 3.0.1) to compile my stuff and i had no problems until 
now.

I am trying to compile kdevelop 2.0 but i get an error compiling flex related 
stuff (flex 2.5.4a)
So i decided to install a second gcc: 2.905.2.1 (/usr/local/gcc-2.95.2) and 
use it to compile KDevelop.
It works, BUT if i try to compile with that gcc i get tons (really tons) of 
udefined symbol!
it seems it is not able to find ANY symbol exported from the Qt libraries 
which are correctly built and working, but onlyi with gcc 3.0.x.

Now i suspect gcc from 2.x to 3.x uses a different naming for c++ symbols but 
how can i overcome this problem?

-- 
Willy Gardiol
gardiol@libero.it
www.poli.studenti.to.it/~s92884
digilander.iol.it/Shimitar
Orgoglioso di NON essere Cattolico


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-09-11  5:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-11  1:04 using gcc 3.0.1 and 2.95.2.1 Michael Veksler
2001-09-11  3:46 ` Willy Gardiol
  -- strict thread matches above, loose matches on Subject: below --
2001-09-11  5:44 Michael Veksler
2001-09-11  0:22 Willy Gardiol

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).