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

Gregory D. Weber gdweber at indiana.edu
Fri Jul 30 09:14:35 AEST 2004


I've had very similar experience with undefined reference to __ctype_b called
from lexer__get_float_decimals -- aren't those messages ugly! :-)
(However, I did not get any "undefined reference to main".)

I had installed Mercury from the binary tarball for libc2.2, i.e.,

ftp://ftp.mercury.cs.mu.oz.au/pub/mercury/
  mercury-0.11.0.i686-pc-linux-libc2.2-gnu-O5.tar.gz.

I began getting these error messages after upgrading my Linux system
from Red Hat 8.0 to Fedora Core 1, on a program that previously
compiled without errors.  The glibc version in RH8 was 2.3.2-4.80.6;
in FC1 it's 2.3.2-101.4.  I can't explain why I installed Mercury
for libc 2.2 on a libc 2.3 system, but it did work.  So why wouldn't
it work in FC1, which again has libc 2.3?  I found that although
both versions of libc were nominally 2.3, the one with RH8 (2.3.2-4.80.6)
apparently contained some "backwards compatibility" features for 2.2
which were dropped from FC1's libc 2.3.2-101.4.

My solution was to download the gcc 3.2 compiler and the Mercury source
tarball from the Mercury ftp site, compile gcc 3.2, compile Mercury with
gcc 3.2.  That fixed it.  Perhaps another way to solve the problem
would be to download and install the Mercury binary for libc 2.3,
but I didn't try that.

ftp://ftp.mercury.cs.mu.oz.au/pub/mercury/
  gcc-core-3.2.tar.gz 
  mercury-compiler-0.11.0.tar.gz  

You did say you installed from source.  If your libc might have changed
after you installed Mercury, I would suggest recompiling it.

Greg

Maurizio Colucci writes:
 > Hello,
 > 
 > 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>'
 > > /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'
 > > /usr/local/mercury-0.11.0/lib/mercury/lib/asm_fast.gc/i686-pc-linux-gnu/libmer_std.a(lexer.o)(.text+0xcf95): In function `<predicate 'lexer:get_float_decimals'/4 mode 0>':
 > > : undefined reference to `__ctype_b'
 > > /usr/local/mercury-0.11.0/lib/mercury/lib/asm_fast.gc/i686-pc-linux-gnu/libmer_std.a(lexer.o)(.text+0xd231): In function `<predicate 'lexer:string_get_float_decimals'/7 mode 0>':
 > > : undefined reference to `__ctype_b'
 > > /usr/local/mercury-0.11.0/lib/mercury/lib/asm_fast.gc/i686-pc-linux-gnu/libmer_std.a(lexer.o)(.text+0xd35d): In function `<predicate 'lexer:string_get_float_decimals'/7 mode 0>':
 > > : undefined reference to `__ctype_b'
 > > /usr/local/mercury-0.11.0/lib/mercury/lib/asm_fast.gc/i686-pc-linux-gnu/libmer_std.a(lexer.o)(.text+0xd644): In function `<predicate 'lexer:get_float_exponent'/4 mode 0>':
 > > : undefined reference to `__ctype_b'
 > > /usr/local/mercury-0.11.0/lib/mercury/lib/asm_fast.gc/i686-pc-linux-gnu/libmer_std.a(lexer.o)(.text+0xddbe): more undefined references to `__ctype_b' follow
 > > collect2: ld returned 1 exit status
 > > 
 > 
 > Is this a problem with glibc? Is it solvable?
 > 
 > Thanks 
 > 
 > Maurizio
 > --------------------------------------------------------------------------
 > 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
 > --------------------------------------------------------------------------
 > 

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