build on x86-64 fails with undefined references

Hello, I have a 32-bit distro (Kubuntu 6.10) running on a 64-bit kernel. The yhc build fails with 'undefined reference' errors.
scons: Reading SConscript files ... Checking for architecture... x86_64 Checking for operating system... linux2 Bootstrapping... Done. scons: done reading SConscript files. scons: Building targets ... gcc -o inst/bin/yhi src/runtime/BCKernel/sanity.o src/runtime/BCKernel/info.o src/runtime/BCKernel/iofuncs.o src/runtime/BCKernel/external.o src/runtime/BCKernel/profile.o src/runtime/BCKernel/integer.o src/runtime/BCKernel/hsffi.o src/runtime/BCKernel/foreign.o src/runtime/BCKernel/jonkers.o src/runtime/BCKernel/mutator.o src/runtime/BCKernel/process.o src/runtime/BCKernel/stable.o src/runtime/BCKernel/module.o src/runtime/BCKernel/primitive.o src/runtime/BCKernel/main.o src/runtime/BCKernel/hashtable.o src/runtime/BCKernel/pretty.o src/runtime/BCKernel/thread.o src/runtime/BCKernel/stopcopy.o src/runtime/BCKernel/make.o src/runtime/BCKernel/mark.o src/runtime/BCKernel/heap.o src/runtime/BCKernel/builtin/Array.o src/runtime/BCKernel/builtin/IO.o src/runtime/BCKernel/builtin/Prelude.o src/runtime/BCKernel/builtin/FFI.o src/runtime/BCKernel/builtin/RuntimeAPI.o src/runtime/BCKernel/builtin/Concurrent.o src/runtime/BCKernel/builtin/System.o src/runtime/BCKernel/builtin/PackedString.o depends/ctypes/libffi/src/prep_cif.o depends/ctypes/libffi/src/cfield.o depends/ctypes/libffi/src/x86/ffi64.o depends/ctypes/libffi/src/x86/unix64.o depends/ctypes/libffi/src/x86/sysv.o -L/usr/local/lib -lgmp -lm -lpthread -ldl src/runtime/BCKernel/hsffi.o: In function `hsffi_call':hsffi.c:(.text+0x3a1): undefined reference to `ffi_call' src/runtime/BCKernel/hsffi.o: In function `hsffi_evalContext':hsffi.c:(.text+0x439): undefined reference to `ffi_call' depends/ctypes/libffi/src/prep_cif.o: In function `ffi_prep_cif':prep_cif.c:(.text+0x20c): undefined reference to `ffi_prep_cif_machdep' depends/ctypes/libffi/src/x86/sysv.o: In function `ffi_closure_SYSV':depends/ctypes/libffi/src/x86/sysv.S:(.text+0x8a): undefined reference to `ffi_closure_SYSV_inner' collect2: ld returned 1 exit status scons: *** [inst/bin/yhi] Error 1 scons: building terminated because of errors.
I replaced uname (in /bin) with a version that prints "i386" for the architecture rather than "x86_64", and the build succeeds, with warnings (some ffi-related). But I'm not sure if my uname hack is a good idea (could it break builds of other software?) Does yhc support 64-bit architectures? And since my distribution is 32-bit, will a 64-bit binary run at all? Do you advise me to use a 32-bit kernel with yhc? Thanks a lot. -- Kartik Vaddadi. Home: www.cse.iitb.ac.in/~kart Blogs: kartik.infogami.com, kartik-log.blogspot.com, kartik-rlog.blogspot.com Alternate mail ID: kartik.vad@gmail.com "50% Reservation, 100% Politics" - Protest the Indian government's decision to increase reservation in private educational institutions (yfemumbai.blogspot.com)

Hi Kartik, Yhc does indeed work on (fully) 64-bit platforms but apparently not on 32-bit distros running on 64-bit kernels. We suspect the problem is that the architecture detects x86_64 (from the kernel) and then builds for that. But then nothing links because you don't have the 64bit development libraries. This is why your uname hack works, it makes the build script think you're running an x86 kernel. In the long run you're probably better off sticking with either both 64bit kernel and distro or both 32bit. I suspect you'll get a lot of trouble trying to build almost anything with a 'mixed' system. It's also worth remembering 64bit is still quite capable of running 32bit applications in Ubuntu (I run 64-bit ubuntu). Anyhow, I've asked Andrew to add an option to the build to force the architecture. When that's done you should be able to repull the source and try rebuilding with: scons arch=x86 Hope that helps. Tom Kartik Vaddadi wrote:
Hello, I have a 32-bit distro (Kubuntu 6.10) running on a 64-bit kernel. The yhc build fails with 'undefined reference' errors.
scons: Reading SConscript files ... Checking for architecture... x86_64 Checking for operating system... linux2 Bootstrapping... Done. scons: done reading SConscript files. scons: Building targets ... gcc -o inst/bin/yhi src/runtime/BCKernel/sanity.o src/runtime/BCKernel/info.o src/runtime/BCKernel/iofuncs.o src/runtime/BCKernel/external.o src/runtime/BCKernel/profile.o src/runtime/BCKernel/integer.o src/runtime/BCKernel/hsffi.o src/runtime/BCKernel/foreign.o src/runtime/BCKernel/jonkers.o src/runtime/BCKernel/mutator.o src/runtime/BCKernel/process.o src/runtime/BCKernel/stable.o src/runtime/BCKernel/module.o src/runtime/BCKernel/primitive.o src/runtime/BCKernel/main.o src/runtime/BCKernel/hashtable.o src/runtime/BCKernel/pretty.o src/runtime/BCKernel/thread.o src/runtime/BCKernel/stopcopy.o src/runtime/BCKernel/make.o src/runtime/BCKernel/mark.o src/runtime/BCKernel/heap.o src/runtime/BCKernel/builtin/Array.o src/runtime/BCKernel/builtin/IO.o src/runtime/BCKernel/builtin/Prelude.o src/runtime/BCKernel/builtin/FFI.o src/runtime/BCKernel/builtin/RuntimeAPI.o src/runtime/BCKernel/builtin/Concurrent.o src/runtime/BCKernel/builtin/System.o src/runtime/BCKernel/builtin/PackedString.o depends/ctypes/libffi/src/prep_cif.o depends/ctypes/libffi/src/cfield.o depends/ctypes/libffi/src/x86/ffi64.o depends/ctypes/libffi/src/x86/unix64.o depends/ctypes/libffi/src/x86/sysv.o -L/usr/local/lib -lgmp -lm -lpthread -ldl src/runtime/BCKernel/hsffi.o: In function `hsffi_call':hsffi.c:(.text+0x3a1): undefined reference to `ffi_call' src/runtime/BCKernel/hsffi.o: In function `hsffi_evalContext':hsffi.c:(.text+0x439): undefined reference to `ffi_call' depends/ctypes/libffi/src/prep_cif.o: In function `ffi_prep_cif':prep_cif.c:(.text+0x20c): undefined reference to `ffi_prep_cif_machdep' depends/ctypes/libffi/src/x86/sysv.o: In function `ffi_closure_SYSV':depends/ctypes/libffi/src/x86/sysv.S:(.text+0x8a): undefined reference to `ffi_closure_SYSV_inner' collect2: ld returned 1 exit status scons: *** [inst/bin/yhi] Error 1 scons: building terminated because of errors.
I replaced uname (in /bin) with a version that prints "i386" for the architecture rather than "x86_64", and the build succeeds, with warnings (some ffi-related).
But I'm not sure if my uname hack is a good idea (could it break builds of other software?)
Does yhc support 64-bit architectures? And since my distribution is 32-bit, will a 64-bit binary run at all?
Do you advise me to use a 32-bit kernel with yhc? Thanks a lot.

Hi,
I've pushed the patch so hopefully 'scons arch=x86' will work for you.
Regards,
Andrew
On 9/14/06, Tom Shackell
Hi Kartik,
Yhc does indeed work on (fully) 64-bit platforms but apparently not on 32-bit distros running on 64-bit kernels.
We suspect the problem is that the architecture detects x86_64 (from the kernel) and then builds for that. But then nothing links because you don't have the 64bit development libraries. This is why your uname hack works, it makes the build script think you're running an x86 kernel.
In the long run you're probably better off sticking with either both 64bit kernel and distro or both 32bit. I suspect you'll get a lot of trouble trying to build almost anything with a 'mixed' system. It's also worth remembering 64bit is still quite capable of running 32bit applications in Ubuntu (I run 64-bit ubuntu).
Anyhow, I've asked Andrew to add an option to the build to force the architecture. When that's done you should be able to repull the source and try rebuilding with:
scons arch=x86
Hope that helps.
Tom
Kartik Vaddadi wrote:
Hello, I have a 32-bit distro (Kubuntu 6.10) running on a 64-bit kernel. The yhc build fails with 'undefined reference' errors.
scons: Reading SConscript files ... Checking for architecture... x86_64 Checking for operating system... linux2 Bootstrapping... Done. scons: done reading SConscript files. scons: Building targets ... gcc -o inst/bin/yhi src/runtime/BCKernel/sanity.o src/runtime/BCKernel/info.o src/runtime/BCKernel/iofuncs.o src/runtime/BCKernel/external.o src/runtime/BCKernel/profile.o src/runtime/BCKernel/integer.o src/runtime/BCKernel/hsffi.o src/runtime/BCKernel/foreign.o src/runtime/BCKernel/jonkers.o src/runtime/BCKernel/mutator.o src/runtime/BCKernel/process.o src/runtime/BCKernel/stable.o src/runtime/BCKernel/module.o src/runtime/BCKernel/primitive.o src/runtime/BCKernel/main.o src/runtime/BCKernel/hashtable.o src/runtime/BCKernel/pretty.o src/runtime/BCKernel/thread.o src/runtime/BCKernel/stopcopy.o src/runtime/BCKernel/make.o src/runtime/BCKernel/mark.o src/runtime/BCKernel/heap.o src/runtime/BCKernel/builtin/Array.o src/runtime/BCKernel/builtin/IO.o src/runtime/BCKernel/builtin/Prelude.o src/runtime/BCKernel/builtin/FFI.o src/runtime/BCKernel/builtin/RuntimeAPI.o src/runtime/BCKernel/builtin/Concurrent.o src/runtime/BCKernel/builtin/System.o src/runtime/BCKernel/builtin/PackedString.o depends/ctypes/libffi/src/prep_cif.o depends/ctypes/libffi/src/cfield.o depends/ctypes/libffi/src/x86/ffi64.o depends/ctypes/libffi/src/x86/unix64.o depends/ctypes/libffi/src/x86/sysv.o -L/usr/local/lib -lgmp -lm -lpthread -ldl src/runtime/BCKernel/hsffi.o: In function `hsffi_call':hsffi.c:(.text+0x3a1): undefined reference to `ffi_call' src/runtime/BCKernel/hsffi.o: In function `hsffi_evalContext':hsffi.c:(.text+0x439): undefined reference to `ffi_call' depends/ctypes/libffi/src/prep_cif.o: In function `ffi_prep_cif':prep_cif.c:(.text+0x20c): undefined reference to `ffi_prep_cif_machdep' depends/ctypes/libffi/src/x86/sysv.o: In function `ffi_closure_SYSV':depends/ctypes/libffi/src/x86/sysv.S:(.text+0x8a): undefined reference to `ffi_closure_SYSV_inner' collect2: ld returned 1 exit status scons: *** [inst/bin/yhi] Error 1 scons: building terminated because of errors.
I replaced uname (in /bin) with a version that prints "i386" for the architecture rather than "x86_64", and the build succeeds, with warnings (some ffi-related).
But I'm not sure if my uname hack is a good idea (could it break builds of other software?)
Does yhc support 64-bit architectures? And since my distribution is 32-bit, will a 64-bit binary run at all?
Do you advise me to use a 32-bit kernel with yhc? Thanks a lot.
_______________________________________________ Yhc mailing list Yhc@haskell.org http://www.haskell.org/mailman/listinfo/yhc

Thank you once again. You shouldn't have bothered, given that I already have things working (and I need the uname hack to build other software). But thanks a lot for going out of your way to help me :) Tom Shackell wrote:
Yhc does indeed work on (fully) 64-bit platforms but apparently not on 32-bit distros running on 64-bit kernels.
We suspect the problem is that the architecture detects x86_64 (from the kernel) and then builds for that. But then nothing links because you don't have the 64bit development libraries. This is why your uname hack works, it makes the build script think you're running an x86 kernel.
In the long run you're probably better off sticking with either both 64bit kernel and distro or both 32bit. I suspect you'll get a lot of trouble trying to build almost anything with a 'mixed' system. It's also worth remembering 64bit is still quite capable of running 32bit applications in Ubuntu (I run 64-bit ubuntu).
Anyhow, I've asked Andrew to add an option to the build to force the architecture. When that's done you should be able to repull the source and try rebuilding with:
scons arch=x86
Hope that helps.
-- Kartik Vaddadi. Home: www.cse.iitb.ac.in/~kart Blogs: kartik.infogami.com, kartik-log.blogspot.com, kartik-rlog.blogspot.com Alternate mail ID: kartik.vad@gmail.com "50% Reservation, 100% Politics" - Protest the Indian government's decision to increase reservation in private educational institutions (yfemumbai.blogspot.com)
participants (3)
-
Andrew Wilkinson
-
Kartik Vaddadi
-
Tom Shackell