Menu

#607 fbc not running on AMD64 system

closed
dkl
build (7)
2014-11-14
2012-06-07
lsmod
No

First i tried to use the regular install with the RUN file.

PC:t/FreeBASIC-0.23.0-source/FreeBASIC/examples/gfx$ fbc -version
FreeBASIC Compiler - Version 0.23.0 (08-07-2011) for linux (target:linux)
Copyright (C) 2004-2011 The FreeBASIC development team.
Configured with prefix /usr/local
objinfo enabled using FB BFD header version 217

PC:/FreeBASIC-0.23.0-source/FreeBASIC/examples/gfx$ ldd /usr/local/bin/fbc
linux-gate.so.1 => (0xf7776000)
libc.so.6 => /lib32/libc.so.6 (0xf760f000)
libm.so.6 => /lib32/libm.so.6 (0xf75e9000)
libpthread.so.0 => /lib32/libpthread.so.0 (0xf75cf000)
libdl.so.2 => /lib32/libdl.so.2 (0xf75cb000)
libncurses.so.5 => /lib32/libncurses.so.5 (0xf7592000)
/lib/ld-linux.so.2 (0xf7777000)

PC:t/FreeBASIC-0.23.0-source/FreeBASIC/examples/gfx$ fbc rel-torus.bas
rel-torus.bas() error 24: File not found, libsupc++.a
ld: cannot find -lX11

This library has been installed - the packages gcc-multilib and g++ are installed!

Then i tried to download the source and compile my own 64-Bit version of fbc.
This also does not work. :-(

root@PC:/srv/test/FreeBASIC-0.23.0-source/FreeBASIC/src/compiler# ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for fbc... no
checking for aclocal... aclocal
checking for autoconf... autoconf
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether byte ordering is bigendian... no
configure: creating ./config.status
config.status: creating Makefile
config.status: WARNING: Makefile.in seems to ignore the --datarootdir setting

root@PC:/srv/test/FreeBASIC-0.23.0-source/FreeBASIC/src/compiler# make
e -c -i . -target linux -arch x86_64 -m fbc -d HOST_LINUX -d TARGET_LINUX -d HOST_X86_64 -d TARGET_X86_64 -d ARCH_PREFIX=/usr/local -d HOST_LITTLE_ENDIAN fbc.bas -o fbc.o
/bin/bash: e: Kommando nicht gefunden.
make: [fbc.o] Fehler 127 (ignoriert)
e -c -i . -target linux -arch x86_64 -m fbc -d HOST_LINUX -d TARGET_LINUX -d HOST_X86_64 -d TARGET_X86_64 -d ARCH_PREFIX=/usr/local -d HOST_LITTLE_ENDIAN ast.bas -o ast.o
/bin/bash: e: Kommando nicht gefunden.
make: [ast.o] Fehler 127 (ignoriert)
e -c -i . -target linux -arch x86_64 -m fbc -d HOST_LINUX -d TARGET_LINUX -d HOST_X86_64 -d TARGET_X86_64 -d ARCH_PREFIX=/usr/local -d HOST_LITTLE_ENDIAN ast-gosub.bas -o ast-gosub.o
/bin/bash: e: Kommando nicht gefunden.
make: [ast-gosub.o] Fehler 127 (ignoriert)
e -c -i . -target linux -arch x86_64 -m fbc -d HOST_LINUX -d TARGET_LINUX -d HOST_X86_64 -d TARGET_X86_64 -d ARCH_PREFIX=/usr/local -d HOST_LITTLE_ENDIAN ast-node-addr.bas -o ast-node-addr.o
/bin/bash: e: Kommando nicht gefunden.

...

make: [symb-comp.o] Fehler 127 (ignoriert)
e -c -i . -target linux -arch x86_64 -m fbc -d HOST_LINUX -d TARGET_LINUX -d HOST_X86_64 -d TARGET_X86_64 -d ARCH_PREFIX=/usr/local -d HOST_LITTLE_ENDIAN fbc_linux.bas -o fbc_linux.o
/bin/bash: e: Kommando nicht gefunden.
make: [fbc_linux.o] Fehler 127 (ignoriert)
gcc -c c-objinfo.c -o c-objinfo.o
c-objinfo.c:27:17: error: bfd.h: Datei oder Verzeichnis nicht gefunden
c-objinfo.c: In function ‘hMapFlag’:
c-objinfo.c:42: error: ‘flagword’ undeclared (first use in this function)
c-objinfo.c:42: error: (Each undeclared identifier is reported only once
c-objinfo.c:42: error: for each function it appears in.)
c-objinfo.c:42: error: expected ‘;’ before ‘ret’
c-objinfo.c:44: error: ‘ret’ undeclared (first use in this function)
c-objinfo.c:44: error: ‘SEC_HAS_CONTENTS’ undeclared (first use in this function)
c-objinfo.c: At top level:
c-objinfo.c:56: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘hMapFormat’
c-objinfo.c:78: error: return type is an incomplete type
c-objinfo.c: In function ‘hMapArch’:
c-objinfo.c:81: error: ‘bfd_arch_i386’ undeclared (first use in this function)
c-objinfo.c:81: warning: ‘return’ with a value, in function returning void
c-objinfo.c:86: error: ‘bfd_arch_unknown’ undeclared (first use in this function)
c-objinfo.c:86: warning: ‘return’ with a value, in function returning void
c-objinfo.c: At top level:
c-objinfo.c:93: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘’ token
c-objinfo.c:97: error: expected ‘)’ before ‘
’ token
c-objinfo.c:101: error: expected ‘)’ before ‘’ token
c-objinfo.c:105: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘
’ token
c-objinfo.c:109: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘’ token
c-objinfo.c:113: error: expected ‘)’ before ‘
’ token
c-objinfo.c:117: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘’ token
c-objinfo.c:121: error: expected ‘)’ before ‘
’ token
c-objinfo.c:125: error: expected ‘)’ before ‘’ token
c-objinfo.c:129: error: expected ‘)’ before ‘
’ token
c-objinfo.c:133: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘’ token
c-objinfo.c:137: error: expected ‘)’ before ‘
’ token
c-objinfo.c:141: error: expected ‘)’ before ‘’ token
c-objinfo.c:145: error: expected ‘)’ before ‘
’ token
c-objinfo.c:149: error: expected ‘)’ before ‘’ token
c-objinfo.c:153: error: expected ‘)’ before ‘
’ token
make: *** [c-objinfo.o] Fehler 1

What is going wrong here?

Discussion

  • lsmod

    lsmod - 2012-06-07

    I am using Debian stable (squeeze) AMD64

    uname -a

    Linux PC 2.6.32-5-amd64 #1 SMP Mon Jan 16 16:22:28 UTC 2012 x86_64 GNU/Linux

     
  • dkl

    dkl - 2012-06-07

    Hi,

    the linking errors indicate some missing libraries which can be obtained by installing certain packages. FB really is 32bit-only at the moment, so it's necessary to install 32bit development & runtime libraries to get it to work on a 64bit system.

    32bit libsupc++: comes in the g++-multilib package on Debian squeeze amd64 (or rather one of its dependencies, like g++-4.4-multilib)

    32bit libX11: comes in the ia32-libs-dev package (it also includes lots of other 32bit libraries)

    Installing these two should do the trick.

    Compiling FB is another thing, and will probably not be necessary anymore. The FreeBASIC 0.23 build system (configure scripts and makefiles) was not setup to work on 64bit systems automatically, especially because FB itself wasn't ported to 64bit then (and isn't yet). A basic guide can be found here:

    http://www.freebasic.net/wiki/wikka.php?wakka=SVNLinux

    Getting it to work on 64bit involves ensuring that "gcc -m32" is used instead of just "gcc" when compiling the C parts of the FB source; and/or some adjustment to the compiler makefile to get it to use 32bit defines when compiling the compiler.

    The errors you were getting seem explainable to me:

    /bin/bash: e: Kommando nicht gefunden.
    make: [fbc.o] Fehler 127 (ignoriert)

    these commands were supposed to use fbc to compile the compiler source, but apparently the "fbc" is missing from the command line. Apparently the configure script couldn't run/find your installed fbc: checking for fbc... no
    It's necessary to have a working FB installation in order to compile a new fbc, because fbc is written in FB itself.

    The failures on c-objinfo.c are due to "c-objinfo.c:27:17: error: bfd.h: Datei oder Verzeichnis nicht gefunden". Compiling fbc normally requires libbfd development files (the corresponding Debian package is called binutils-dev, if I remember correctly, but note that you'll of course need a 32bit version of it, not the 64bit one). The dependency on libbfd can be disabled by passing --disable-objinfo to the compiler's configure script.

    The current FB source code in the Git repository (FB 0.24) has a new and quite different build system, which is easier to use, but probably not yet setup for trivial 64bit support either.

     
  • lsmod

    lsmod - 2012-06-07

    I installed the packages g++-multilib and ia32-libs-dev now.
    But the error does not disappear.

    PC:/win/CowBasic$ fbc gcbasic.bas
    gcbasic.bas() error 24: File not found, libsupc++.a
    ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.3.5/libgcc.a when searching for -lgcc
    ld: cannot find -lgcc

    PC:/win/CowBasic$ file /usr/lib/gcc/x86_64-linux-gnu/4.3.5/libgcc.a
    /usr/lib/gcc/x86_64-linux-gnu/4.3.5/libgcc.a: current ar archive

    I can't understand this.
    It's an archive and not a library?

    Maybe this Basic chain is to much.
    fbc compiled by fbc should run gcbasic. :-)

    This is an really interesting concept with an chicken-and-egg problem.

     
  • lsmod

    lsmod - 2012-06-07

    Of course i give up trying to compile a 64-Bit version.
    Thank you for the explanation!

     
  • dkl

    dkl - 2012-06-24

    Hello again,

    I've got a Debian 6 amd64 virtual machine setup for testing now:
    Linux vm 2.6.32-5-amd64 #1 SMP Sun May 6 04:00:17 UTC 2012 x86_64 GNU/Linux

    After installing FB 0.23 into /usr/local via "./FreeBASIC-0.23.0-linux.run install" I had to install these packages:
    lib32ncurses5 - to be able to run fbc in the first place
    gcc-multilib - to fix the "cannot find -lgcc" ld errors when compiling FB programs
    g++-multilib - to fix the "File not found, libsupc++.a" fbc errors when compiling FB programs
    ia32-libs-dev - to fix the "cannot find -lX11" ld errors when compiling FB graphics programs

    There was a "cannot find -lXpm" ld error remaining even after installing ia32-libs-dev, but I fixed that by running:

    ln -s /usr/lib32/libXpm.so.4 /usr/lib32/libXpm.so

    The ia32-libs-dev package doesn't install the symlink for libXpm automatically for some reason, only for the other X development libraries (libX11, libXrandr, libXrender).

    If you're seeing -lgcc or -lsupc++ errors again it seems like you uninstalled gcc-multilib and g++-multilib again. Installing them or perhaps reinstalling (if already installed but broken etc.) could help.

    /usr/lib/gcc/x86_64-linux-gnu/4.3.5/libgcc.a is for 64bit, while FB is 32bit and asks the linker to create 32bit programs, hence ld is "skipping the incompatible" library.

    Libraries indeed are archives (.a, the format created/extracted by the ar program) of pre-compiled .o files. The following can show you the contained files:
    ar t /usr/lib/gcc/x86_64-linux-gnu/4.3.5/libgcc.a

     

Log in to post a comment.

MongoDB Logo MongoDB