[mercury-users] compilation problem, all, some
Zoltan Somogyi
zs at cs.mu.OZ.AU
Fri Jul 16 19:07:29 AEST 2004
On 16-Jul-2004, Maurizio Colucci <seguso.forever at tin.it> wrote:
> % Intuitively, a verb V is visible if for all O in SelectedObjects
> % there is a predicate P in V's requirements such that P(O).
>
> the_verb_is_visible(V, SelectedObjs):-
> verb_get_requirements(V, Reqs),
> forall( member(O, SelectedObjs),
> ( member(P, Reqs),
> call(P, O))).
The transliteration of the comment is the following:
the_verb_is_visible(V, SelectedObjs) :-
verb_get_requirements(V, Reqs),
all [O] (
member(O, SelectedObjs)
=>
member(P, Reqs),
call(P, O)
).
> On Suse 9.1, with gcc 3.3.3, if I try to compile "hello world" with the
> stable release (0.11.0), I get the following errors:
> > cd /dat/pub/src/by-mau/tests/mercury/
> > mmc main.m
> > main_init.o(.text+0x133): In function `mercury_init':
> > : undefined reference to `<predicate 'main'/2 mode 0>'
> > /usr/local/mercury-0.11.0/lib/mercury/lib/asm_fast.gc/i686-pc-linux-gnu/libmer_std.a(lexer.o)
> (.text+0xcd44): In function `<predicate 'lexer:get_float_decimals'/4 mode
> 0>':
> > : undefined reference to `__ctype_b'
This looks like an incompatibility between the system's ctype.h header file
and the C standard library. What happens if you #include <ctype.h> in a simple
C program and use e.g. isalpha()?
> If I try to compile hello world with the _unstable_ rpm, I get these errors:
>
> mmc main.m
> main_init.c: In function `mercury_init':
> main_init.c:776: warning: dereferencing type-punned pointer will break
> strict-aliasing rules
> main_init.c:778: warning: dereferencing type-punned pointer will break
> strict-aliasing rules
> main_init.c:780: warning: dereferencing type-punned pointer will break
> strict-aliasing rules
> main_init.c:782: warning: dereferencing type-punned pointer will break
> strict-aliasing rules
> main_init.c:784: warning: dereferencing type-punned pointer will break
> strict-aliasing rules
> main_init.c:786: warning: dereferencing type-punned pointer will break
> strict-aliasing rules
> main_init.o(.text+0x179): In function `mercury_init':
> : undefined reference to `<predicate 'main'/2 mode 0>'
You get these errors because gcc 3.4 assumes -fstrict-aliasing by default
at -O2, but the code generated by the Mercury compiler doesn't abide by
the rules this requires. (This is by design; we use C as portable assembler.)
You can ignore all such errors from code generated by the Mercury compiler
by specifying --fno-strict-aliasing. I committed a patch last week to detect
the presence of this flag, and have mgnuc turn it on by default if needed.
Zoltan.
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list