[mercury-users] Cannot compile hello world (glibc, suse 9.1)

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Jul 23 17:39:33 AEST 2004


On 13-Jul-2004, Maurizio Colucci <seguso.forever at tin.it> wrote:
> I am on suse 9.1 with mercury 0.11, installed from source the usual way.
> 
> I am trying to compile a trivial program :
> 
> > 
> > :- module main.
> > 
> > 
> > :- interface.
> > 
> > :- import_module io.
> > 
> > 
> > :- pred main(io__state, io__state).
> > :- mode main(di, uo) is det.
> > 
> > :- implementation.
> > 
> > 
> > main -->
> > 	io__print("ciao"). 
> 
> and I am getting these 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>'

Hmm, that one is suprising.
main/2 should be defined in main.o.

Try compiling with '-v' to see that main.o is being linked in.
Try compiling with '--no-demangle' to see exactly what name is undefined
here, and use "nm main.o" to check whether that name is defined in main.o.

> > /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'

That looks like a a glibc problem.  

> Is it solvable?

Sometimes those sort of issues arise because of inconsistencies between
the dynamic and static versions of libc.
So it may be worth trying to compile with "--linkage shared".

-- 
Fergus Henderson                    |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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