Arc Forumnew | comments | leaders | submitlogin
1 point by stefano 6124 days ago | link | parent

I've tried it on linux with gtk 2.6 (quite old) with libgtk-x11-2.0.so as a link to libgtk-x11-2.0.so.0.600.4. I don't know why it crashes, on my computer it works correctly. What's the error message exactly?


1 point by almkglor 6124 days ago | link

it just core dumps without a message IIRC. Incidentally I actually had to modify the ffi.arc to add "-fPIC" to the gcc command, I have no idea why (Position Independent Code, yes, but what for? for the .so?) but ld complains if I don't and suggests that to me.

As an aside, I'm using an intel core duo, on a 64-bit SMP kernel. I don't know what those terms mean (core duo? like what, apple cores?), I'm a software hacker, not a hardware one. ^^ Oops, scratch that, okay my boss thinks I'm a hardware hacker but I hack FPGA's, not microprocessors and kernels ^^.

Also, I'm on an Ubuntu 7.10 box, with libgtk2.0-0 installed, which provides /usr/lib/libgtk-x11-2.0.so.0.1200.0 and is described as "This package contains the shared libraries.". However Ubuntu also has another package, libgtk2.0-dev (not installed on my computer), which is described as "This package contains the header files and static libraries which is needed for developing the GTK+ applications." Should I be using the -dev version?

-----

1 point by almkglor 6124 days ago | link

tried again with the latest version. Running plain, once I load gtk.arc:

  /usr/bin/ld: /tmp/ccwElZvz.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
  /tmp/ccwElZvz.o: could not read symbols: Bad value
  collect2: ld returned 1 exit status
Modifying ffi.arc to add -fPIC to gcc call:

  arc>  (load "gtk.arc")
  *** redefining cdef
  *** redefining w/ffi
  *** redefining w/inline
  *** redefining w/del
  gs1789.c: In function ‘inc_pt’:
  gs1789.c:3: warning: cast from pointer to integer of different size
  gs1789.c:3: warning: cast to pointer from integer of different size


  nil
  arc>  (gtk-hello-world)
  Segmentation fault (core dumped)
The segmentation fault occurs whenever I click the button or close the window. Moving it around and resizing doesn't seem to hurt it.

Modifying inc_pt to:

    void* inc_pt(void *pt, unsigned int offset) 
   {
     return (void*)&((char*)pt)[offset];
   }
results in:

  arc>  (load "gtk.arc")
  *** redefining cdef
  *** redefining w/ffi
  *** redefining w/inline
  *** redefining w/del

  nil
  arc> (gtk-hello-world)
  Segmentation fault (core dumped)
Segfaults at the same conditions. ^^

Possibly the problem is in the 'connect thing?

-----

2 points by stefano 6123 days ago | link

I think the problem is in the connect: with mzscheme 352 it segfaults(not always, though), with mzscheme 372 it seems to work. Maybe is a bug in mzscheme 352 C callbacks. Wich version are you using?

-----

1 point by almkglor 6123 days ago | link

360. Yes, the problem does seem to be in 'connect, because that appears to be the part where it interacts with the user.

That said, is another potential problem the fact that I'm using a 64-bit machine+kernel?

-----

2 points by stefano 6123 days ago | link

To access some structures (such as GValue) I manually allocate the correct size with cmalloc, and to access the structure i use low level functions (such as inc_pt) wich make assumptions on the size of the structure. I program on a 32 bit machine where pointers are smaller than on a 64 bit machine, so this could (and probably is) a problem. I definetly need a better way to access C structures, but this would mean to extend Arc FFI capabilities.

Edit: i've tried mzscheme 360 and it works. The problem then is with the 64 bit.

-----

1 point by stefano 6122 days ago | link

I've found and solved the signal connection problem, the bug fix is now on Anarki.

-----