comp.lang.ada
 help / color / mirror / Atom feed
* FreeBSD Linuxulator runs GNAT
@ 2005-09-02 16:02 Craig Carey <research@ijs.co.nz>
  0 siblings, 0 replies; only message in thread
From: Craig Carey <research@ijs.co.nz> @ 2005-09-02 16:02 UTC (permalink / raw)



Getting Ada programs compiled inside of the FreeBSD Linuxulator

The FreeBSD Ada Port seems to not run or install or something.

Here is how to compile a Linux gnatmake inside of FreeBSD and
have it run under the Linux emulator.

The main trick here is to add this to the compiler options:
   -largs -static -Wl,--sysroot=/usr/compat/linux

Linux GNAT programs seem to run correctly in the FreeBSD Linuxulator.

-------------------------------------------------------------------
(4) In FreeBSD, after the following steps are done:

To get gnatmake to run, this can be added

   -bargs -E -p -we -s -F
   -largs -v -v -static -Wl,--sysroot=/usr/compat/linux -Wl,--verbose

gnatmake myprog.adb ..... 	# >| xx 2>&1
brandelf -t Linux myprog  	# Failed to eliminate the use of brandelf

The -Wl,--verbose seems useful. It lists all /lib files that are
used. Use of any FreeBSD *.a file can ruin the executable.

-------------------------------------------------------------------
(1) In FreeBSD
** Install a Linux emulator. That involves getting the
   kernel configured appropriately.
** Install ports/archives/rpm2cpio
** Get the development libc file that matches the other
   Linuxulator files, to supply libpthread.a.
   E.g. download the next from rmpfind.net:
      glibc-devel-2.3.2-27.9.7.i386.rpm

** If the Linux rpm was used then the command might look like
  this:
    rpm -i --ignoreos --root /usr/compat/linux --dbpath /var/lib/rpm $@
  (That install would copy over too much documentation or
   fail since Linux kernel headers are missing.)

   rpm2cpio < glibc-devel-2.3.2-27.9.7.i386.rpm >| xx
   cpio -idm < xx  # create directories with original time stamps
   The "cp -pv" files into /usr/compat/linux/usr/lib/

-------------------------------------------------------------------
(2) In Linux, build FSF gcc
 Download gcc: http://gcc.gnu.org/install/download.html
export CVS_RSH=ssh
export CVSROOT=:ext:anoncvs@savannah.gnu.org:/cvsroot/gcc
cvs -z9 checkout -P gcc

 Compile up GCC. It seems that version 4.1.0 has bugs and it is
   not expected to run correctly, so GCC 3.4.4 can be used.

export PATH=/lxg/gcc1/bin:$PATH

cd obj
/fu/@gcc/344/gcc/configure \
   --prefix=/lxg/gcc344    \
   --enable-languages="c,c++,ada" \
   --enable-libada         \
   --with-gcc --with-gnu-ld --with-gnu-as \
   --enable-threads=posix  \
   --disable-shared   \
   --with-system-zlib \
   --disable-nls      \
   --disable-multilib \
   --disable-libssp

nice make STAGE1_CFLAGS='-O0' BOOT_CFLAGS='-O0' bootstrap

make -C gcc gnatlib_and_tools  # try this?
make -C gcc/ada gnatlib        # try this?
make install

-------------------------------------------------------------------
(3) In Linux, build Redhat binutils. A version new enough to
have the --sysroot feature, is needed.
http://sourceware.org/binutils/
export CVSROOT=:pserver:anoncvs@sourceware.org:/cvs/src
# Password is "anoncvs", "anonymous"?
cvs -z9 login
cvs -z9 co binutils

cd /  ; ln -s / lxsys
# /lxsys is not used again so presumably "/" could be used instead

export PATH=/lxg/gcc344/bin:$PATH_SAVED
export LD_LIBRARY_PATH=/lxg/gcc344/lib:$LD_LIBRARY_PATH

# the build modifies the source directory so it might be copied.

cd obj
lxg/@redhat/src/configure       \
   --prefix=/lxg/gcc344          \
   --with-build-sysroot=/lxsys   \
   --with-sysroot=/lxsys         \
   --enable-static=yes           \
   --enable-languages=c,c++,ada  \
   --enable-libada               \
   --with-gcc --with-gnu-ld --with-gnu-as \
   --enable-threads=posix  \
   --disable-shared     \
   --with-system-zlib   \
   --disable-nls        \
   --disable-multilib   \
   --disable-libssp


Then maybe the Suse Gvd or whatever, might be used as the
debugger.
In Windows, the Gdb debuger of GNAT 3.15p can't handle some Cygwin
paths and ver "gdb-5.3" of http://libre.act-europe.fr/GDB/
can fix that (AdaCore names only 6.3, and maybe that is not better)

-------------------------------------------------------------------

The above message could have gone to these mailing lists:
GNATLIST: http://hermes.gwu.edu/archives/gnatlist.html
GCC-Help: http://gcc.gnu.org/lists.html

The ARG (run from St Quentin France) is apparently still lacking the
thrusting power to get its "arg@ada-auth.org" mailing list to lift off
into the  night sky of real-time dissemination of information in
accordance with deadlines for delays that are under 1.5 minutes ...

---------

Here is promotion for running FreeBSD inside of some Windows OS,
e.g. from P2P:

NAT connection and the VMware filesharing, FreeBSD guest:

   http://www.ijs.co.nz/unix.htm
   http://www.ijs.co.nz/code/unix-etc-files.zip



Here are my notes on how to create a defective native FreeBSD
cross compiler that targets Linux:

http://www.ijs.co.nz/code/ada95-freebsd-to-linux-cross-compiler.txt




Craig Carey, Auckland city, research@ijs.co.nz




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-09-02 16:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-02 16:02 FreeBSD Linuxulator runs GNAT Craig Carey <research@ijs.co.nz>

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox