pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pkg/46418: pkg
>Number: 46418
>Category: pkg
>Synopsis: swi-prolog-5.11.18 etc. xpce fails to open X11 display
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun May 06 16:15:00 +0000 2012
>Originator: John R. Towler
>Release: NetBSD 6.0_BETA, 4/23/2012
>Organization:
none
>Environment:
System: NetBSD peano.jtcl.org 6.0_BETA NetBSD 6.0_BETA (Peano2 ) #0: Mon Apr 23
19:49:54 CDT 2012
root%peano.jtcl.org@localhost:/usr/src/sys/arch/i386/compile/Peano2 i386
Architecture: i386, X11R7.3* from cvs xsrc with libXt1.1.3 from Xorg
Machine: i386
>Description:
xpce calls in swi-prolog for pkgsrc 5.11.18 and 6.* die on opening
the X11 display with code using the Xt Intrinsics to access the display
NetBSD-6.0_BETA, cvs date 4/23/2012, libXt1.1.3 from Xorg,
i386-unknown-netbsdelf
pkgsrc/lang/swi-prolog for swipl-5.11.18
bash-4.2$ swi-prolog
% library(swi_hooks) compiled into pce_swi_hooks 0.00 sec, 2,240 bytes
Welcome to SWI-Prolog (Multi-threaded, 32 bits, Version 5.11.18)
Copyright (c) 1990-2011 University of Amsterdam, VU Amsterdam
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.
For help, use ?- help(Topic). or ?- apropos(Word).
?- emacs.
ERROR: /usr/local/lib/swi-prolog-5.11.18/library/socket.pl:58:
catch/3: Undefined procedure: socket:use_foreign_library/2
Warning: /usr/local/lib/swi-prolog-5.11.18/library/socket.pl:58:
Goal (directive) failed:
socket:use_foreign_library(foreign(socket),install_socket)
ERROR: /usr/local/lib/swi-prolog-5.11.18/library/socket.pl:118:
Exported procedure socket:tcp_setopt/2 is not defined
ERROR: /usr/local/lib/swi-prolog-5.11.18/library/socket.pl:118:
Exported procedure socket:tcp_open_socket/3 is not defined
ERROR: /usr/local/lib/swi-prolog-5.11.18/library/socket.pl:118:
Exported procedure socket:tcp_socket/1 is not defined
ERROR: /usr/local/lib/swi-prolog-5.11.18/library/socket.pl:118:
Exported procedure socket:tcp_host_to_address/2 is not defined
ERROR: /usr/local/lib/swi-prolog-5.11.18/library/socket.pl:118:
Exported procedure socket:tcp_listen/2 is not defined
ERROR: /usr/local/lib/swi-prolog-5.11.18/library/socket.pl:118:
Exported procedure socket:udp_receive/4 is not defined
ERROR: /usr/local/lib/swi-prolog-5.11.18/library/socket.pl:118:
Exported procedure socket:tcp_close_socket/1 is not defined
ERROR: /usr/local/lib/swi-prolog-5.11.18/library/socket.pl:118:
Exported procedure socket:udp_send/4 is not defined
ERROR: /usr/local/lib/swi-prolog-5.11.18/library/socket.pl:118:
Exported procedure socket:gethostname/1 is not defined
ERROR: /usr/local/lib/swi-prolog-5.11.18/library/socket.pl:118:
Exported procedure socket:tcp_accept/3 is not defined
ERROR: /usr/local/lib/swi-prolog-5.11.18/library/socket.pl:118:
Exported procedure socket:tcp_bind/2 is not defined
ERROR: /usr/local/lib/swi-prolog-5.11.18/library/socket.pl:118:
Exported procedure socket:tcp_connect/2 is not defined
ERROR: /usr/local/lib/swi-prolog-5.11.18/library/socket.pl:118:
Exported procedure socket:udp_socket/1 is not defined
ERROR: /usr/local/lib/swi-prolog-5.11.18/library/socket.pl:118:
Exported procedure socket:tcp_select/3 is not defined
Warning: locale not supported by Xlib, locale set to C
Warning: X locale modifiers not supported, using default
[PCE fatal: @pce/pce: Signal trapped: Segmentation violation
in: <No exception goal>
]
[ 8] M @display/display <-depth()
[ 7] M @784813683/dialog ->initialise(@default/constant,
@default/constant, @default/constant)
[ 6] M @emacs_mark_list/emacs_bookmark_editor ->append((nil))
[ 5] M @emacs_mark_list/emacs_bookmark_editor ->initialise()
[ 4]
[ 3] M @emacs/emacs ->initialise(@emacs_buffers/dict)
[ 2]
[ 1] M @prolog/host ->call(trap_ref, emacs)
Host stack:
[17] send(@emacs_mark_list/emacs_bookmark_editor, append(new(_G754,
dialog)))
[16] Send-method on @emacs_mark_list/emacs_bookmark_editor:
emacs_bookmark_editor->initialise
[15] '$c_call_prolog'
<Alien goal>
[14] new(@emacs_mark_list/emacs_bookmark_editor, emacs_bookmark_editor)
[13] Send-method on @emacs/emacs: emacs->initialise(@emacs_buffers/dict)
ERROR: :- pce_global/2: create failed: emacs(@emacs_buffers)
ERROR: pce(object) `@emacs' does not exist
?-
----
xterm i/o fails after this
There is a problem with swipl in this version as well as 6.x from
http://swi-prolog.org. TOP/packages/xpce/src/x11/{xcommon,xdisplay}.c
contain the Xt init function calls for setting the locale and
initializing and opening the X display. On prev. versions of NetBSD
e.g. 3.[0,1,2], 1.6.2 with pl-5.4.7, and 5.1.2 with pl-6.1.2, this
code base worked. From what I have been able to find out via archives
of comp.windows.x, this change stems from around 2005 to make the
locale set as per i18n, l10n for X11 --esp. given the NLP interest
base and the European devel site at uva.nl. None of the patches for
the pkg in pkgsrc do anything with this. On using the distr. code
base, the changes I need to make, apart from this problem are all
around getting the autoconf-based build system to pick up CPPFLAGS and
LDFLAGS from the environment for the compilation processes. I did
submit this to the bugs list for swi-prolog, and posted to the
swi-prolog mailing list. So far, no solution, but if I can fix it for
NetBSD, great.
I know little or nothing about X11 programming save for my recent
attempts to build tools with lisp using xlib and McCLIM towards
porting the lkb system etc.
I checked the code, traced the problems in the debugger, and grovelled
through the code base a bit. I found out that it was these Xt fns for
initializing the display. I found that as distributed, pl-6.x when
invoking xpce preds, gives an error message about NetBSD only having a
valid locale setting for "C" and POSIX environments. (See man 3
setlocale) I found the O'Reilly Xt book for R4, R5 on the Xorg
documentation site. I read enough to understand the basic skeleton
needed for this process. I found the example code at ftp.ora.com. I
compiled it and tested it as written for Ch02 and Ch13, modifying the
open display fn calls to match the string value for my X11 DISPLAY
variable and host. It worked correctly, and windows with the right
text opened on the 6.0_BETA X11 display. They followed the
recommended fn call order in the Xt book and in the most recent Xt lib
documentation. As it unrolls from a functional calling order to its
imperative equivalent, this code base for swipl uses a different
order. I checked the diffs between the cvs trees for NetBSD
xsrc/*/Xt* for version numbers for 5.1.2 vs. 6.0_BETA. I thought it
might be my Xt version or X11R7 version. I found out that the base
devel system for the project is ubuntu X11R7.6. Their systems build
and run this code. I found out the modular libXt pkgs for Xorg for v
1.0.5, 1.0.9, 1.1.1,1.1.2,1.1.3. I got them all to properly configure
and build as my username, and then did su to install 1.1.3, thinking
it was the version of libXt. No change in either the O'Reilly example
code or swipl's code in opening the display. I changed the working
O'Reilly example code progressively from an imperative sequence of
necess. Xt fns to a sequence of fn calls which then call these Xt fns,
thus imitating the pattern of the swipl code base. I have experienced
problems using functional prog. style with C fn calls, and I was
taught, and read about the problems of call-by-value in invoking C fns
with fns as arguments. Somewhere in this process, the working Xt
code, so modified, failed as well, for similar reasons. Swi-prolog
also has a prolog level setlocale predicate in TOP/src/os/somthing or
other. This also might be a source of problematic settings for this
NetBSD locale design.
My primary interest since 1987 has been comp. ling. esp. using logic
programming and functional programming. I have a good system. Unix
code, and essentially all code like this should not be platform
dependent. I am assuming that the pkgsrc contributor/maintainer knows
all about this, has dealt with this problem in some way for NetBSD,
and more informed eyes on the problem will lead to a solution which
works for pkgsrc on NetBSD, and can be contributed to the swi-prolog
project, so that you can just ftp the code base, set env. vals for
locally installed libs etc, type configure, gmake , install and all
will work the first time. On this topic in the swi-prolog mailing
list, the author responded about my system identification questions
for systems with successful builds, and said that he would accept
patches for a logical disjunction essentially of branching CPP values
for the exception of NetBSD's current implementation of setlocale and
how these Xt fns call and set this. This is the problem, and pl-6.1.3
and pl-devel on this same area also fail either by dumping core with
the error msg about the locale setting, or as with this pkgsrc 5.11.18
version, call a whole series of xpce prolog preds and xpce C fns, and
die w/o opening the display, and also disabling i/o on the xterm.
Given a fix with this, the pkgsrc version could also be upgraded to
the most current version, or the distr. code could just build. Please
help me with this problem to make it go. The binary pkgsrc builds for
swi-prolog-packages include several for i386 NetBSD 5-6.0_BETA. The
ones posted for 6.0_BETA are dated 4/23 or 4/24, which is the date of
my last cvs update for netbsd-6. On these systems too, they claim to
build and work for the swi-prolog suite including xpce. This is
Craig's Interpolation Theorem, a path from src to successful build (a)
exists, and (b) and equivalent series of steps on a path for a
(constructive) proof for a build on my system also exists.
xpce/src/x11/xdisplay.c
void
ws_open_display(DisplayObj d)
{ DisplayWsXref ref = d->ws_ref;
char *address;
Display *display;
char **PCEargv = malloc(sizeof(char**)*10);
PCEargv[0] = "pl";
PCEargv[1] = NULL;
PCEargc = 1;
address = isDefault(d->address) ? NULL : strName(d->address);
display = XtOpenDisplay(pceXtAppContext(NULL),
address, "xpce",
"Pce", /* resource class (not used) */
opTable, XtNumber(opTable),
&PCEargc, PCEargv);
if ( !display )
{ char problem[LINESIZE];
char *theaddress = XDisplayName(address);
if ( isDefault(d->address) && !getenv("DISPLAY") )
sprintf(problem, "no DISPLAY environment variable");
else if ( !ws_legal_display_name(theaddress) )
sprintf(problem, "malformed address: %s", theaddress);
else
strcpy(problem, "No permission to contact X-server?");
errorPce(d, NAME_noXServer,
CtoName(theaddress), CtoString(problem), 0);
return;
} else
{ int screen = DefaultScreen(display);
DEBUG(NAME_display,
XSynchronize(display, True));
ref->display_xref = display;
ref->screen = screen;
ref->visual = DefaultVisual(display, screen);
ref->colour_map = DefaultColormap(display, screen);
ref->white_pixel = WhitePixel(display, screen);
ref->black_pixel = BlackPixel(display, screen);
ref->depth = DefaultDepth(display, screen);
#ifdef O_XIM
if ( !(ref->im = XOpenIM(display, NULL, NULL, NULL)) )
{ DEBUG(NAME_event, Cprintf("Could not open XIM\n"));
}
#endif
}
{ Arg args[5];
Cardinal n = 0;
XtSetArg(args[n], XtNmappedWhenManaged, False); n++;
XtSetArg(args[n], XtNwidth, 64); n++;
XtSetArg(args[n], XtNheight, 64); n++;
ref->shell_xref = XtAppCreateShell("xpce",
"Pce", /* Resource Class */
applicationShellWidgetClass,
display,
args, n);
}
if ( !ref->shell_xref )
{ errorPce(d, NAME_noMainWindow);
return;
}
XtRealizeWidget(ref->shell_xref); /* Need a window for GC */
ref->root_bitmap = XCreatePixmap(display, XtWindow(ref->shell_xref),
8, 4, 1);
}
xpce/src/x11/xcommon.c
void *
pceXtAppContext(void * ctx)
{ if ( ThePceXtAppContext == NULL )
{ if ( ctx != NULL )
{ ThePceXtAppContext = ctx;
XSetErrorHandler(x_error_handler);
} else
{
#if defined(_REENTRANT) && defined(HAVE_XINITTHREADS)
if ( XPCE_mt == TRUE )
{ if ( use_x_init_threads )
XInitThreads();
} else
{ XPCE_mt = -1;
}
#else
XPCE_mt = -1;
#endif
XtToolkitInitialize();
XSetErrorHandler(x_error_handler);
if ( (ThePceXtAppContext = XtCreateApplicationContext()) == NULL )
{ errorPce(TheDisplayManager(), NAME_noApplicationContext);
fail;
}
if ( !XtSetLanguageProc(ThePceXtAppContext, NULL, NULL) )
{ errorPce(TheDisplayManager(), NAME_noLocaleSupport,
CtoName(setlocale(LC_ALL, NULL)));
fail;
}
}
}
return ThePceXtAppContext;
}
>How-To-Repeat:
cd /usr/pkgsrc/lang/swi-prolog; make; make install; bash$ swi-prolog
?-emacs.
>Fix:
something with TOP/packages/xpce/src/x11/{xcommon,xdisplay}.c
and XtSetLanguageProc() for NetBSD's locale settings having to
do with the basic order for initializing and opening a window
in the X11 display for Xt fn calls, and also
poss. TOP/src/os/something or other where the prolog level
setlocale predicate is in the code. etags *.[ch], and
tags-search setlocale or mkid, lid setlocale will give the
file and line for the context. xpce X11 error msg about
locale settings can also be found with mkid, lid locale, gid
locale for the xpce local subtree.
Home |
Main Index |
Thread Index |
Old Index