Re: [racket-dev] Racket head fails to compile

2014-03-12 Thread Paulo Matos

On 20/02/14 14:19, Matthew Flatt wrote:

At Sun, 09 Feb 2014 08:35:03 +, Paulo J. Matos wrote:

On 09/02/14 00:03, Matthew Flatt wrote:

There should be many more flags passed to `gcc`, including some -I
flags and some -D flags.

Is something in your environment overriding the CFLAGS definition in
the makefile? Normally, a definition in the makefile would take
precedence over an environment variable, but maybe something else is
taking precedence over the definition?




Doh, right. I assumed for no good reason racket would behave the same
way my usual project does and use env CFLAGS as the optimization flags
used for compilation. Any other env variable the racket build system
uses for me to add additional compilation flags? (for example to build
with `-O2 -ftree-vectorize` or `-O0 -g3`)

After some thought shouldn't -D... and -I... flags be controlled by
CPPFLAGS and not CFLAGS such that overriding CFLAGS would still leave
CPPFLAGS intact?


I've changed the makefiles so that setting CFLAGS (or CPPFLAGS) will
hopefully work the way you expect.



By the way Matthew, this is now working as I expected it to. Thanks.


--
PMatos

_
 Racket Developers list:
 http://lists.racket-lang.org/dev


Re: [racket-dev] Racket head fails to compile

2014-03-12 Thread Paulo Matos

On 20/02/14 14:19, Matthew Flatt wrote:

At Sun, 09 Feb 2014 08:35:03 +, Paulo J. Matos wrote:

On 09/02/14 00:03, Matthew Flatt wrote:

There should be many more flags passed to `gcc`, including some -I
flags and some -D flags.

Is something in your environment overriding the CFLAGS definition in
the makefile? Normally, a definition in the makefile would take
precedence over an environment variable, but maybe something else is
taking precedence over the definition?




Doh, right. I assumed for no good reason racket would behave the same
way my usual project does and use env CFLAGS as the optimization flags
used for compilation. Any other env variable the racket build system
uses for me to add additional compilation flags? (for example to build
with `-O2 -ftree-vectorize` or `-O0 -g3`)

After some thought shouldn't -D... and -I... flags be controlled by
CPPFLAGS and not CFLAGS such that overriding CFLAGS would still leave
CPPFLAGS intact?


I've changed the makefiles so that setting CFLAGS (or CPPFLAGS) will
hopefully work the way you expect.



I might have spoken too soon:

make[7]: Entering directory `/home/pmatos/projects/BUILDS/racket/foreign'
gcc -O3 -Wall -Werror -c ../../../racket/racket/src/foreign/foreign.c -o 
foreign.o
../../../racket/racket/src/foreign/foreign.c:9:21: fatal error: 
schpriv.h: No such file or directory

 #include schpriv.h

When compiling foreign with CFLAGS=-O3 -Wall -Werror, the include 
paths disappear.


--
PMatos

_
 Racket Developers list:
 http://lists.racket-lang.org/dev


[racket-dev] Unlucky with Racket 6.0 (1/2)

2014-03-12 Thread Paulo Matos

Hello,

I have downloaded the Ubuntu precise script, installed it on a Kubuntu 
precise machine and ran it. Everything went smoothly.


If I try to run DrRacket it starts, when I go to Preferences it SEGFAULTS.

To obtain more information I go to drracket script and try to execute it 
under bash -x:

$ bash -x local-install/racket-6.0/bin/drracket
+ 
saveP=/home/pmatos/.rvm/gems/ruby-1.9.3-p286/bin:/home/pmatos/.rvm/gems/ruby-1.9.3-p286@global/bin:/home/pmatos/.rvm/rubies/ruby-1.9.3-p286/bin:/home/pmatos/.rvm/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/pmatos/.rvm/bin

+ PATH=/usr/bin:/bin
++ pwd
+ saveD=/home/pmatos
++ dirname local-install/racket-6.0/bin/drracket
+ D=local-install/racket-6.0/bin
++ basename local-install/racket-6.0/bin/drracket
+ F=drracket
+ cd local-install/racket-6.0/bin
+ test -L drracket
++ pwd
+ D=/home/pmatos/local-install/racket-6.0/bin
+ cd /home/pmatos
+ bindir=/home/pmatos/local-install/racket-6.0/bin
+ 
PATH=/home/pmatos/.rvm/gems/ruby-1.9.3-p286/bin:/home/pmatos/.rvm/gems/ruby-1.9.3-p286@global/bin:/home/pmatos/.rvm/rubies/ruby-1.9.3-p286/bin:/home/pmatos/.rvm/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/pmatos/.rvm/bin

+ librktdir=/home/pmatos/local-install/racket-6.0/bin/../lib
+ findxend
+ oneargflag=
+ case $1 in
+ exec /home/pmatos/local-install/racket-6.0/bin/../lib/gracket -N 
local-install/racket-6.0/bin/drracket -J DrRacket -l- drracket/drracket.rkt


(drracket:14735): GLib-GObject-CRITICAL **: g_signal_connect_data: 
assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed


... [A few more pages of this]

(drracket:14735): GLib-GObject-CRITICAL **: g_signal_connect_data: 
assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

SIGSEGV MAPERR si_code 1 fault on addr 0x3e00
Aborted (core dumped)

So, I decide to run the gracket command under gdb but now it segfaults 
immediately without displaying drracket window.
$ gdb --args /home/pmatos/local-install/racket-6.0/bin/../lib/gracket -N 
local-install/racket-6.0/bin/drracket -J DrRacket -l- drracket/drracket.rkt

GNU gdb (GDB) 7.6.1-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
http://gnu.org/licenses/gpl.html

This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type show copying
and show warranty for details.
This GDB was configured as x86_64-linux-gnu.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from 
/home/pmatos/local-install/racket-6.0/lib/gracket...(no debugging 
symbols found)...done.

(gdb) r
Starting program: 
/home/pmatos/local-install/racket-6.0/bin/../lib/gracket -N 
local-install/racket-6.0/bin/drracket -J DrRacket -l- drracket/drracket.rkt

[Thread debugging using libthread_db enabled]
Using host libthread_db library /lib/x86_64-linux-gnu/libthread_db.so.1.
[New Thread 0x76503700 (LWP 14760)]

Program received signal SIGSEGV, Segmentation fault.
0x006824fa in scheme_gmp_tls_unload ()
(gdb) bt
#0  0x006824fa in scheme_gmp_tls_unload ()
#1  0x0064c6f3 in ?? ()
#2  0x0068e95f in ?? ()
#3  0x0068f01f in ?? ()
#4  0x0069313a in GC_malloc_atomic ()
#5  0x0060fbe1 in scheme_make_sized_offset_byte_string ()
#6  0x004658c3 in scheme_make_sized_offset_kind_path ()
#7  0x0046e3c1 in ?? ()
#8  0x0046965f in ?? ()
#9  0x0046f0b0 in scheme_simplify_path ()
#10 0x77fecb0e in ?? ()
#11 0x in ?? ()
#12 0x77e31a46 in ?? ()
#13 0x in ?? ()
#14 0x0005 in ?? ()
#15 0x7fffc230 in ?? ()
#16 0x76866798 in ?? ()
#17 0x0005 in ?? ()
#18 0x76505dd8 in ?? ()
#19 0x00ae in ?? ()
#20 0xf420 in ?? ()
#21 0x0001 in ?? ()
#22 0x00460fad in scheme_do_eval ()
#23 0x0047f5f7 in ?? ()
#24 0x77fe27af in ?? ()
#25 0x7fffc400 in ?? ()
#26 0x77e3b583 in ?? ()
#27 0x in ?? ()
(gdb) disass
Dump of assembler code for function scheme_gmp_tls_unload:
   0x006824d0 +0: mov(%rdi),%rdx
   0x006824d3 +3: mov0x2b5afe(%rip),%rax# 
0x937fd8

   0x006824da +10:mov%rdx,%fs:0x960(%rax)
   0x006824e2 +18:mov0x8(%rdi),%rdx
   0x006824e6 +22:mov%rdx,%fs:0x958(%rax)
   0x006824ee +30:mov0x10(%rdi),%rdx
   0x006824f2 +34:mov%rdx,%fs:0x980(%rax)
= 0x006824fa +42:movq   $0x0,(%rdi)
   0x00682501 +49:mov%rsi,%fs:0x950(%rax)
   0x00682509 +57:retq
End of assembler dump.
(gdb) info regs
Undefined info command: regs.  Try help info.
(gdb) info reg
rax0xf420   -3040
rbx

Re: [racket-dev] Unlucky with Racket 6.0 (1/2)

2014-03-12 Thread Sam Tobin-Hochstadt
On Wed, Mar 12, 2014 at 6:35 PM, Paulo Matos pa...@matos-sorge.com wrote:

 So, I decide to run the gracket command under gdb but now it segfaults
 immediately without displaying drracket window.
 $ gdb --args /home/pmatos/local-install/racket-6.0/bin/../lib/gracket -N
 local-install/racket-6.0/bin/drracket -J DrRacket -l- drracket/drracket.rkt


Racket uses page faults to manage memory, so you need to do:

(gdb) handle SIGSEGV nostop noprint

and then continue, and if there's an error, it will halt in `abort()`.

Sam
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Unlucky with Racket 6.0 (1/2)

2014-03-12 Thread Paulo Matos

On 12/03/14 22:38, Sam Tobin-Hochstadt wrote:

On Wed, Mar 12, 2014 at 6:35 PM, Paulo Matos pa...@matos-sorge.com wrote:


So, I decide to run the gracket command under gdb but now it segfaults
immediately without displaying drracket window.
$ gdb --args /home/pmatos/local-install/racket-6.0/bin/../lib/gracket -N
local-install/racket-6.0/bin/drracket -J DrRacket -l- drracket/drracket.rkt



Racket uses page faults to manage memory, so you need to do:

 (gdb) handle SIGSEGV nostop noprint

and then continue, and if there's an error, it will halt in `abort()`.



Thanks, you're right. Got there when entered the Preferences screen:
Program received signal SIGABRT, Aborted.
0x77323f77 in __GI_raise (sig=sig@entry=6)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56  ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x77323f77 in __GI_raise (sig=sig@entry=6)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x773275e8 in __GI_abort () at abort.c:90
#2  0x0068927e in fault_handler ()
#3  signal handler called
#4  0x72e595b9 in g_type_check_instance ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#5  0x72e4e3f7 in g_signal_connect_data ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#6  0x00687548 in ffi_call_unix64 ()
#7  0x00686e8d in ffi_call ()
#8  0x0067896c in ?? ()

Not very useful. Need to setup drracket with debugging to understand this.

--
PMatos

_
 Racket Developers list:
 http://lists.racket-lang.org/dev


[racket-dev] Unlucky with Racket 6.0 (2/2)

2014-03-12 Thread Paulo Matos
The other alternative is to compile racket, however I seem to be doing 
something wrong.


In the early days (I haven't done this in maybe 1 or 2 years), doing an 
in-place ./configure ; make ; make install was enough.


With racket-6.0, I do:
cd racket/racket/src
./configure --prefix=/home/pmatos/racket-6.0
make
make install

This installs a directory with racket and raco only.
Same thing for an in-place build, like so:
cd racket/racket/src
mkdir build
cd build
make
make install

However, I notice a top-level Makefile in racket/, after taking a peek 
and reading INSTALL.txt it seems that now I need to use this Makefile to 
build everything.


So, I try (as mentioned in the INSTALL.txt):
make in-place

in-place is not a target.

Trying just `make` builds racket in place successfully. I get the same 
SEGFAULT mentioned in my previous post with same title.


Is there a way to compile this with debug information?

Cheers,

--
PMatos

_
 Racket Developers list:
 http://lists.racket-lang.org/dev


Re: [racket-dev] Racket head fails to compile

2014-03-12 Thread Matthew Flatt
At Wed, 12 Mar 2014 20:37:14 +, Paulo Matos wrote:
 make[7]: Entering directory `/home/pmatos/projects/BUILDS/racket/foreign'
 gcc -O3 -Wall -Werror -c ../../../racket/racket/src/foreign/foreign.c -o 
 foreign.o
 ../../../racket/racket/src/foreign/foreign.c:9:21: fatal error: 
 schpriv.h: No such file or directory
   #include schpriv.h
 
 When compiling foreign with CFLAGS=-O3 -Wall -Werror, the include 
 paths disappear.

I missed a makefile; repair pushed.

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] Changing the default error display handler to use exn:srclocs

2014-03-12 Thread Eric Dobson
A common issue I have is that the default error handler does not
display error message's exn:srcloc if it has it

racket -e (require racket/match) -e (match 2)
=
match: no matching clause for 2
  context...:
   
/Users/endobson/proj/rnacket/plt/racket/collects/racket/match/runtime.rkt:21:0:
match:error

But no information about what match raised the issue. The handler in
DrRacket uses this info nicely in the buttons that it provides and the
highlighting.

Is this reasonable to add to the default error handler, and if so do
people have suggestions on the format?


My current .racketrc has

 (let ((old-error-display-handler (error-display-handler)))
(error-display-handler
  (λ (str exn)
(when (exn:srclocs? exn)
  (for ((srcloc ((exn:srclocs-accessor exn) exn)))
(displayln (source-location-string srcloc
(old-error-display-handler str exn)

Which is a hack but works for my interactive use. It doesn't work for
when I run a program on its own, and I don't see a way to configure
anything to do that.

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Unlucky with Racket 6.0 (2/2)

2014-03-12 Thread Matthew Flatt
At Wed, 12 Mar 2014 23:14:14 +, Paulo Matos wrote:
 However, I notice a top-level Makefile in racket/, after taking a peek 
 and reading INSTALL.txt it seems that now I need to use this Makefile to 
 build everything.
 
 So, I try (as mentioned in the INSTALL.txt):
 make in-place
 
 in-place is not a target.

I'm stumped on this one. Is `in-place` not on line 38 of your copy of
Makefile?

 Trying just `make` builds racket in place successfully. I get the same 
 SEGFAULT mentioned in my previous post with same title.
 
 Is there a way to compile this with debug information?

You can provide flags like `--enable-noopt` via `CONFIGURE_ARGS_qq'.

But I've set up a 32-bit Kubuntu VM and I can replicate the crash
there, so I'll investigate more.

_
  Racket Developers list:
  http://lists.racket-lang.org/dev