Bug#191033: hugs98_98.200211-1(unstable/ia64): FTBFS: undefined reference to `main'

Isaac Jones ijones@syntaxpolice.org
04 May 2003 23:02:16 -0400


Hello.

Ross Paterson <ross@soi.city.ac.uk> writes:

> gcc -shared conftest_dl.c -o conftest_dl.so

Got this output:

/usr/bin/ld: /tmp/ccAhUuiW.o: @gprel relocation against dynamic symbol x
collect2: ld returned 1 exit status

> gcc conftest.c -ldl
> ./a.out
> echo $?

and so as you would expect:

$ gcc conftest.c -ldl
$ ./a.out
$ echo $?
2

But ...

> HUGS_TRY_DYNLINK("-shared -fPIC")

as per this suggestion:

gcc -shared  -fPIC conftest_dl.c -o conftest_dl.so
bash-2.05a$ ./a.out
bash-2.05a$ echo $?
3

however...

> A suggestion for the alpha/ia64/hppa build failure: in
> src/unix/configure.in, after the line
>
> HUGS_TRY_DYNLINK("-shared")
>
> add a new line
>
> HUGS_TRY_DYNLINK("-shared -fPIC")

I tried this, and got this output during configure:

checking if '/LD' builds loadable libraries...
checking if '/LD /ML /nologo' builds loadable libraries...
checking if '-shared' builds loadable libraries...
checking if '-shared -fPIC' builds loadable libraries...
checking if '-bundle' builds loadable libraries...
checking if '-bundle -lc' builds loadable libraries...
checking if '-r' builds loadable libraries...
...
creating ../config.h
...

Leaving config.h with:

#define MKDLL_CMD "gcc "

and the predictable build failure:

...../ffihugs -N +G -W +L"../lib/exts/Storable_aux.c" HugsStorable
/usr/lib/crt1.o: In function `_start':
/usr/lib/crt1.o(.text+0x41): undefined reference to `main'
collect2: ld returned 1 exit status
runhugs: Error occurred
Reading file "/house/ijones/tmp//lib/hugs/lib/exts/HugsStorable.hs":
ERROR "/house/ijones/tmp//lib/hugs/lib/exts/HugsStorable.hs" - Error while running compilation command 'gcc  -D__HUGS__ "-I/house/ijones/tmp//lib/hugs/include"
"/house/ijones/tmp//lib/hugs/lib/exts/HugsStorable.c" -o "/house/ijones/tmp//lib/hugs/lib/exts/HugsStorable.so" ../lib/exts/Storable_aux.c'
 


peace,

isaac