[Gambas-devel] [Gambas-user] Release of gambas2 1.9.33

Benoit Minisini gambas at ...1...
Sun Jul 2 20:03:38 CEST 2006


On Sunday 02 July 2006 19:46, José L. Redrejo Rodríguez wrote:
> El dom, 02-07-2006 a las 19:40 +0200, Benoit Minisini escribió:
> > On Sunday 02 July 2006 19:20, José L. Redrejo Rodríguez wrote:
> > > El sáb, 01-07-2006 a las 12:06 -0700,
> > >
> > > > Message: 4
> > > > Date: Sat, 1 Jul 2006 15:59:24 +0200
> > > > From: Benoit Minisini <gambas at ...1...>
> > > > Subject: Re: [Gambas-user] Release of gambas2 1.9.33
> > > > To: mailing list for gambas users <gambas-user at ...494...t>
> > > > Message-ID: <200607011559.25411.gambas at ...1...>
> > > > Content-Type: text/plain;  charset="utf-8"
> > > >
> > > > On Saturday 01 July 2006 15:14, Lorenzo wrote:
> > > > > Benoit, compiling like always, "segmentation fault" in gb.qt.kde
> > > > > component, wait instruccions.
> > > > >
> > > > >
> > > > >
> > > > > make[5]: se ingresa al directorio
> > > > > `/1/gambas2-1.9.33/gb.qt.kde/src/html'
> > > > >
> > > > >
> > > > >
> > > > > Creating the information files for gb.qt.kde.html component...
> > > > >
> > > > > gb.qt.kde.html
> > > > >
> > > > > make[5]: *** [install-data-hook] Violaci?n de segmento
> > > > >
> > > > > make[5]: se sale del directorio
> > > > > `/1/gambas2-1.9.33/gb.qt.kde/src/html'
> > > > >
> > > > > make[4]: *** [install-data-am] Error 2
> > > > >
> > > > >
> > > > >
> > > > > regards
> > > > >
> > > > >
> > > > >
> > > > > lorenzo
> > > >
> > > > Which distribution do you use?
> > > >
> > > > Try 'gbi2 gb.qt.kde.html' manually as root. Does it crash or not?
> > > >
> > > > If it crashes, tell me where by running it inside gdb:
> > > >
> > > > $ gdb gbi2
> > > > ...
> > > > (gdb) run gb.qt.kde.html
> > > > ...
> > > > (gdb) bt
> > > >
> > > > Regards,
> > > >
> > > > --
> > > > Benoit Minisini
> > >
> > > Hi Benoît, I've been digging a little bit in this error. I have
> > > detected it since a month ago and it applies to (at least) all 1.9.x
> > > versions since 1.9.19. I haven't tested it in previous versions. The
> > > error has raised since a Debian unstable packages upgrade. What I've
> > > seen is that:
> > >
> > > - gb.qt.kde.html needs the execution of preload(argv, "libqt-mt.so.3
> > > libkdecore.so.4") as you've written in the gbi.c code. I think this
> > > didn't apply in previous version of Debian packages, and that could
> > > explain why the error didn't raise before.
> > > - in the preload function of gbi.c you have :
> > >       execv("/usr/bin/gbi" GAMBAS_VERSION_STRING, argv);
> > > and this doesn't work if you are installing gambas in a different path
> > > of /usr, as /usr/local or  when compiling packages in debian, in a
> > > temporary directory.
> > >
> > > So, the bug seems to be due to the hardcoded path "/usr/bin/gbi" in the
> > > preload function of gbi.c
> > >
> > > Please, tell me if I'm wrong or if you find a fast workaround to avoid
> > > this to be able to build new gambas packages for this release.
> > >
> > > Regards.
> >
> > Oops! This hardcoded path is a stupid thing of mine...
> >
> > I have replaced it by the Gambas installation path, and you will get it
> > in the next version.
> >
> > Regards,
>
> Please, could you tell me how do you get that in the gbi.c or, just send
> me the fixed file. I did a very ugly hack to be able to compile it with:
>
>   char buf[256];
>   char str[256];
>   if (getenv("ROOT"))
>   	strcpy (str,getenv("ROOT"));
>   strcat (str,"/usr/bin/gbi");
>   strcat (str,GAMBAS_VERSION_STRING);
>   if (_nopreload || getenv("GAMBAS_PRELOAD"))
>     return;
>   sprintf(buf, "LD_PRELOAD=%s", lib);
>   putenv(buf);
>   putenv("GAMBAS_PRELOAD=1");
>   execv(str, argv);
>
> but this is really awful, and I would like to prepare the packages of
> this version and I only need gbi.c to end them.
>
> Regards.
>
>

Here is the new preload() function:

--8<---------------------------------------------------------------
static void preload(char **argv, char *lib)
{
#if DO_PRELOADING
  char buf[256];
  const char *path;

  if (_nopreload || getenv("GAMBAS_PRELOAD"))
    return;

  sprintf(buf, "LD_PRELOAD=%s", lib);
  putenv(buf);
  putenv("GAMBAS_PRELOAD=1");

	path = FILE_cat(FILE_get_dir(FILE_find_gambas(NULL)), "gbi" 
GAMBAS_VERSION_STRING, NULL);
  execv(path, argv);
#endif
}
--8<---------------------------------------------------------------

But I don't think it will solve your problem, as your "evil" hack did.

Try to modify the component.am file in the source directory:

Replace the line

	@$(DESTDIR)$(bindir)/gbi$(GAMBAS_VERSION) -r $(DESTDIR)$(prefix) $(COMPONENT)

by

	@$(DESTDIR)$(bindir)/gbi$(GAMBAS_VERSION) -p -r $(DESTDIR)$(prefix) 
$(COMPONENT)

to disable preloading. Maybe preloading is not necessary anymore for qt & kde.

But maybe the better is reusing argv[0] to run gbi2 again. This is safe, 
provided that the current working directory does not change.

--8<---------------------------------------------------------------
static void preload(char **argv, char *lib)
{
#if DO_PRELOADING
  char buf[256];

  if (_nopreload || getenv("GAMBAS_PRELOAD"))
    return;

  sprintf(buf, "LD_PRELOAD=%s", lib);
  putenv(buf);
  putenv("GAMBAS_PRELOAD=1");

  execv(argv[0], argv);
#endif
}
--8<---------------------------------------------------------------

Tell me the result!

Regards,

-- 
Benoit Minisini




More information about the Devel mailing list