Re: Bug#191033: hugs98_98.200211-1(unstable/ia64): FTBFS: undefined reference to `main'
Greetings. The Debian autobuilders were unable to build hugs on a few platforms, and I tried building Hugs from the distribution tarball and got similar results on ia64 (on both Debian and Redhat). Here's what information I have. Please let me know if I can get more information for you. The error looks like this: ./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' This seems to have something to do with the "MKDLL_CMD" macro (in src/config.h) getting a bad value for these platforms. In particular, on ia64, it reads: define MKDLL_CMD "gcc " whereas on i386, it reads: #define MKDLL_CMD "gcc -shared" This is what looks like the relevant configure output on ia64: checking if '/LD' builds loadable libraries... checking if '/LD /ML /nologo' builds loadable libraries... checking if '-shared' builds loadable libraries... checking if '-bundle' builds loadable libraries... checking if '-bundle -lc' builds loadable libraries... checking if '-r' builds loadable libraries... And the same configure output on i386: checking if '/LD' builds loadable libraries... checking if '/LD /ML /nologo' builds loadable libraries... checking if '-shared' builds loadable libraries... -shared checking if '-bundle' builds loadable libraries... (cached) -shared checking if '-bundle -lc' builds loadable libraries... (cached) -shared checking if '-r' builds loadable libraries... (cached) -shared It also fails with similar output on hppa and alpha. Complete build logs for a variety of architectures can be found here (where you can see that the previous release was able to build on these architectures): http://buildd.debian.org/build.php?arch=&pkg=hugs98 However, when I alter config.h by hand to include the -shared flag, and rerun make;make install (without rerunning configure) I get this output: ./ffihugs +N +G -W +L"../libraries/Hugs/Storable_aux.c" Hugs.Storable ./ffihugs +N +G -W Foreign.Marshal.Alloc runhugs: Error occurred Reading file "/house/ijones/tmp//lib/hugs/libraries/Foreign/Marshal/Alloc.hs": Reading file "/house/ijones/tmp//lib/hugs/libraries/Foreign/C/Types.hs": Reading file "/house/ijones/tmp//lib/hugs/libraries/Foreign/C/TypesISO.hs": Reading file "/house/ijones/tmp//lib/hugs/libraries/Foreign/Storable.hs": Reading file "/house/ijones/tmp//lib/hugs/libraries/Control/Monad.hs": Reading file "/house/ijones/tmp//lib/hugs/libraries/Hugs/Storable.hs": Reading file "/house/ijones/tmp//lib/hugs/libraries/Foreign/Storable.hs": Reading file "/house/ijones/tmp//lib/hugs/libraries/Foreign/C/TypesISO.hs": Type checking ERROR "/house/ijones/tmp//lib/hugs/libraries/Foreign/C/TypesISO.hs":41 - Implementation of .&. requires extra context *** Expected type : Bits CPtrdiff => CPtrdiff -> CPtrdiff -> CPtrdiff *** Missing context : Bits Int64 Let me know if I can offer any more help. peace, isaac
On Fri, May 02, 2003 at 03:46:32PM -0400, Isaac Jones wrote:
The Debian autobuilders were unable to build hugs on a few platforms, and I tried building Hugs from the distribution tarball and got similar results on ia64 (on both Debian and Redhat). Here's what information I have. Please let me know if I can get more information for you.
[...]
This is what looks like the relevant configure output on ia64: checking if '/LD' builds loadable libraries... checking if '/LD /ML /nologo' builds loadable libraries... checking if '-shared' builds loadable libraries... checking if '-bundle' builds loadable libraries... checking if '-bundle -lc' builds loadable libraries... checking if '-r' builds loadable libraries...
And the same configure output on i386: checking if '/LD' builds loadable libraries... checking if '/LD /ML /nologo' builds loadable libraries... checking if '-shared' builds loadable libraries... -shared checking if '-bundle' builds loadable libraries... (cached) -shared checking if '-bundle -lc' builds loadable libraries... (cached) -shared checking if '-r' builds loadable libraries... (cached) -shared
Yes, the test HUGS_TRY_DYNLINK("-shared") is failing. Please try running the attached script, which is the test this is using.
However, when I alter config.h by hand to include the -shared flag, and rerun make;make install (without rerunning configure) I get this output:
[...] ERROR "/house/ijones/tmp//lib/hugs/libraries/Foreign/C/TypesISO.hs":41 - Implementation of .&. requires extra context *** Expected type : Bits CPtrdiff => CPtrdiff -> CPtrdiff -> CPtrdiff *** Missing context : Bits Int64
You can work around this one by adding an empty Bits instance
instance Bits Int64
to libraries/Hugs/Int.hs -- it shouldn't be needed, but a future release
will have a real instance. While you're at it, might as well add
instance Bits Word64
to libraries/Hugs/Word.hs just in case.
------------------------ test script ------------------------------
cat >conftest_dl.c <
Hello.
Ross Paterson
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
OK, so "-shared -fPIC" should work, but somehow the configure test isn't detecting that. Perhaps src/unix/config.log has some clues (after running configure). If that doesn't help, there's a kludge, since you're only dealing with gcc: in src/unix/configure.in, change AC_DEFINE_UNQUOTED(MKDLL_CMD, "${CC-cc} $ac_cv_dll_flags") to AC_DEFINE_UNQUOTED(MKDLL_CMD, "${CC-cc} -shared -fPIC")
It's a quoting bug. Here's a patch to apply in src/unix: --- old/aclocal.m4 2002-10-11 17:26:38.000000000 +0100 +++ aclocal.m4 2003-05-06 13:16:45.000000000 +0100 @@ -587,11 +587,11 @@ ./conftest 2>/dev/null ac_result=$? if test $ac_result = 3; then - ac_cv_dll_flags=$1 + ac_cv_dll_flags='$1' ac_cv_leading_underscore=no fi if test $ac_result = 4; then - ac_cv_dll_flags=$1 + ac_cv_dll_flags='$1' ac_cv_leading_underscore=yes fi --- old/configure.in 2002-10-31 16:10:37.000000000 +0000 +++ configure.in 2003-05-06 13:16:45.000000000 +0100 @@ -606,32 +606,32 @@ dnl-------------------------------------------------------------------- dnl Try the MS Visual C flags -HUGS_TRY_DYNLINK("/LD") -HUGS_TRY_DYNLINK("/LD /ML /nologo") +HUGS_TRY_DYNLINK([/LD]) +HUGS_TRY_DYNLINK([/LD /ML /nologo]) dnl Try the gcc flags -HUGS_TRY_DYNLINK("-shared") +HUGS_TRY_DYNLINK([-shared -fPIC]) dnl Try the MacOS X flags -HUGS_TRY_DYNLINK("-bundle") +HUGS_TRY_DYNLINK(-bundle) dnl Try the MacOS X flags -HUGS_TRY_DYNLINK("-bundle -lc") +HUGS_TRY_DYNLINK([-bundle -lc]) dnl Try the gcc flags -dnl HUGS_TRY_DYNLINK("-shared -nostdlib") +dnl HUGS_TRY_DYNLINK([-shared -nostdlib]) dnl Some other gcc flags -HUGS_TRY_DYNLINK("-r") +HUGS_TRY_DYNLINK(-r) dnl Some other gcc flags -dnl HUGS_TRY_DYNLINK("-rdynamic") +dnl HUGS_TRY_DYNLINK(-rdynamic) dnl Try the SunOS flags -dnl HUGS_TRY_DYNLINK("-G") +dnl HUGS_TRY_DYNLINK(-G) dnl Try the HPUX flags -dnl HUGS_TRY_DYNLINK("-Aa +z") +dnl HUGS_TRY_DYNLINK([-Aa +z]) AC_DEFINE_UNQUOTED(MKDLL_CMD, "${CC-cc} $ac_cv_dll_flags") if test "$ac_cv_leading_underscore" = "yes"; then
Ross Paterson
It's a quoting bug. Here's a patch to apply in src/unix:
That patch along with the instance entries seem to fix the problem. I got it too run no ia64. Expect an upload soon. Thanks Ross! peace, isaac
On Tue, May 06, 2003 at 11:54:29PM -0400, Isaac Jones wrote:
That patch along with the instance entries seem to fix the problem. I got it to run on ia64. Expect an upload soon.
Yes, I see 200211-3 works on ia64 and alpha. Hopefully hppa is the same, but that leaves the failure on m68k unexplained: http://buildd.debian.org/build.php?&pkg=hugs98&arch=m68k For more info, you could try (in src): ./hugs +N +G -W +g Foreign.Marshal.Utils
Ross Paterson
Yes, I see 200211-3 works on ia64 and alpha. Hopefully hppa is the same, but that leaves the failure on m68k unexplained:
Well, the new upload seems to fix that also, for whatever reason. The build log looks successful for all arches. I don't have an m68k to try running Hugs, however. Thanks again. peace, isaac * 98.200211-3 (ia64) (latest build at May 7 02:36: maybe-successful) * 98.200211-3 (s390) (latest build at May 7 02:38: maybe-successful) * 98.200211-3 (mips) (latest build at May 7 03:16: maybe-successful) * 98.200211-3 (powerpc) (latest build at May 7 02:47: maybe-successful) * 98.200211-3 (mipsel) (latest build at May 7 02:59: maybe-successful) * 98.200211-3 (alpha) (latest build at May 7 03:23: maybe-successful) * 98.200211-3 (arm) (latest build at May 7 04:35: maybe-successful) * 98.200211-3 (hppa) (latest build at May 7 09:35: maybe-successful) * 98.200211-3 (m68k) (latest build at May 7 12:21: maybe-successful) * 98.200211-3 (sparc) (latest build at May 7 14:10: maybe-successful)
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") assuming this is the same problem as http://lists.debian.org/debian-hppa/2002/debian-hppa-200209/msg00039.html
participants (2)
-
Isaac Jones -
Ross Paterson