Spivoxity / obc-3

Oxford Oberon-2 compiler
38 stars 7 forks source link

Issues with installation on Ubuntu 16.10 #13

Closed Spivoxity closed 5 years ago

Spivoxity commented 5 years ago

Reported by Edward Jones:

On Ubuntu 16.10 64-bit, after downloading the .deb and using dpkg on it – and also then doing sudo apt-get -f install to resolve dependencies – the application failed to compile the example 'Fac.m' file. The OBC version was 3.0.3, using the .deb file from here (obc_3.0.3_amd64.deb).

~$ obc -o fac Fac.m
/usr/bin/obc: 1: eval: /usr/lib/obc/oblink: not found

I'm not sure if this is a standard issue. I had not restarted my Terminal at the time, so it might have been an issue relating to PATH, if the application adds a directory to that?

After successfully compiling it myself, this error disappeared (so I can't actually provide the exact environment in which it occurs, I'm afraid), but in addition to the listed libgtksourceview2.0-dev package, I also had to install g++-multilib to allow it to configure properly (appears to be used for building a 32-bit app on 64-bit?), and then ocaml (and possibly opam) to allow it to execute make properly. (This should perhaps be documented somewhere, which I don't think it is at present – at least not in the INSTALL file.)

Spivoxity commented 5 years ago

Thanks for taking the trouble to report the problem. I've just tried and can't reproduce it, though I did not try on a fresh installation of Ubuntu that may be missing some of the 32-bit libraries. It looks like /usr/lib/obc/oblink is definitely installed, but it is a 32-bit binary and the error message may mean that needed libraries are not found.

Better documentation of the build dependencies would be good, and will come in time, though time is scarce. Actually gcc-multilib suffices in place of g++-multilib, as there is no C++ code in OBC. It would be sacrilege if there were!

Spivoxity commented 5 years ago

For the installation problem, I've added libc6:i386 to the dependencies in amd64. That ought to fix it (though I'm confused about the relationship between libc6-i386 and libc6:i386). I've not added libx11:i386, as that's needed only for the XYplane module, which is kept for nostalgic reasons alone.

I should also add to the instructions that apt-get -f install might be needed.

Spivoxity commented 5 years ago

As regards building, here for the record is my list of Debian packages to install before configuring. It may not be complete, as I'm not sure my RPi was completely virgin before I started.

apt-get update
apt-get install mercurial
apt-get install autoconf build-essential tcl ocaml-nox libgtksourceview2.0-dev
apt-get install gcc-multilib

(gcc-multilib is only needed on amd64, because the runtime system is still i386, as you've no doubt gathered.)

Spivoxity commented 5 years ago

Edward: I just installed Ubuntu 16.04.1 to a VirtualBox and used the following commands:

apt update
apt upgrade
apt install mercurial
hg clone http://bitbucket.org/Spivey/obc-3 -u rel-3.0
cd obc-3
apt install autoconf gcc-multilib
./configure
apt install ocaml-nox libgtksourceview2.0-dev
make

build-essential, tcl were already installed.

This results in a ton of errors thrown, when it tries to make the 'debugger' recipe:

make -C debugger all
make[1]: Entering directory '/home/user/Documents/obc-3/debugger'
ocamlc  -custom -thread -I ../compat -I ../compiler -I ../lablgtk -o obdb1 \
     unix.cma threads.cma lablgtk.cma str.cma gtkThread.cmo ../yacc/yyparse.cmo  ../compiler/basis.cma debugger.cma debmain.cmo debprims.o 
../lablgtk/liblablgtk.a(ml_gdkpixbuf.o): In function `ml_GdkPixbuf_deserialize':
ml_gdkpixbuf.c:(.text+0x56): undefined reference to `gdk_pixdata_deserialize'
ml_gdkpixbuf.c:(.text+0x72): undefined reference to `gdk_pixbuf_from_pixdata'
ml_gdkpixbuf.c:(.text+0x93): undefined reference to `gdk_pixbuf_error_get_type'
ml_gdkpixbuf.c:(.text+0x9b): undefined reference to `g_type_class_peek'
ml_gdkpixbuf.c:(.text+0xa8): undefined reference to `g_type_check_class_cast'
ml_gdkpixbuf.c:(.text+0xb8): undefined reference to `g_enum_get_value'
ml_gdkpixbuf.c:(.text+0xd2): undefined reference to `g_error_free'
../lablgtk/liblablgtk.a(ml_gdkpixbuf.o): In function `ml_GdkPixbuf_serialize':
ml_gdkpixbuf.c:(.text+0x132): undefined reference to `gdk_pixbuf_get_type'
ml_gdkpixbuf.c:(.text+0x13d): undefined reference to `g_type_check_instance_cast'
ml_gdkpixbuf.c:(.text+0x153): undefined reference to `gdk_pixdata_from_pixbuf'
ml_gdkpixbuf.c:(.text+0x163): undefined reference to `gdk_pixdata_serialize'
ml_gdkpixbuf.c:(.text+0x183): undefined reference to `g_free'
ml_gdkpixbuf.c:(.text+0x18b): undefined reference to `g_free'
../lablgtk/liblablgtk.a(ml_gdkpixbuf.o): In function `convert_gdk_pixbuf_options':
ml_gdkpixbuf.c:(.text+0x265): undefined reference to `g_strdup'
ml_gdkpixbuf.c:(.text+0x277): undefined reference to `g_strdup'
../lablgtk/liblablgtk.a(ml_gdkpixbuf.o): In function `ml_gdkpixbuf_savefunc':
ml_gdkpixbuf.c:(.text+0x354): undefined reference to `gdk_pixbuf_error_quark'
ml_gdkpixbuf.c:(.text+0x372): undefined reference to `g_set_error'
../lablgtk/liblablgtk.a(ml_gdkpixbuf.o): In function `Val_GdkPixbuf_':
ml_gdkpixbuf.c:(.text+0x3d1): undefined reference to `g_object_ref'
../lablgtk/liblablgtk.a(ml_gdkpixbuf.o): In function `ml_gdkpixbuf_init':
ml_gdkpixbuf.c:(.text+0x3e6): undefined reference to `gdk_pixbuf_error_quark'

(which continues for another ~5000 lines, apparently.)

I did confirm, and I definitely have libgtksourceview2.0-dev installed through apt. Disabling the debugger:

./configure --disable-debugger
make

succeeds and produces the correct response twice (The factorial of 20 is 2432902008176640000).

I also have a snapshot before I installed any of the dependencies, if you push an updated .deb that I should try out.

Spivoxity commented 5 years ago

I note that you installed the GTK developement libraries after configuring, and the result it that they haven't been found during the building of the lablgtk library, and so the instruction is not passed on to the building process for the debugger to include them in the final linking.

(Actually, not to be pedantic, but. You didn't show the autoreconf step above, so I'm not absolutely convinced the sequence of events was as you describe it. Your slew of errors is a symptom of a misbuilt lablgtk.cma though.)

Doing make quiteclean; make should fix all that -- quiteclean to clean the libraries as well as OBC itself.

Actually, while I think about it, there's a Debian-based dockerfile at docker/Dockerfile that suffices for building OBC -- though without the XYplane module -- and that shows the same list of packages to install on top of minimal Debian.

Spivoxity commented 5 years ago

Re-running ./configure and make isn't enough to do that? Huh. (I did in fact run autoreconf, and I am pretty confident that's the only step missing from the list that I would have considered applicable at the time.)

That did in fact fix it. I didn't notice an error earlier, when I ran configure and so on, and I didn't realize that running commands would have effects that wouldn't just be overridden by later re-running those commands (with an additional make clean in cases where it clearly was not doing as much work), so I removed those from the list.

I rolled back to just after the apt upgrade and ran, exactly:

sudo apt update
sudo apt install mercurial
hg clone http://bitbucket.org/Spivey/obc-3 -u rel-3.30
hg clone http://bitbucket.org/Spivey/obc-3 -u rel-3.0
rm -R obc-3
hg clone http://bitbucket.org/Spivey/obc-3 -u rel-3.0
cd obc-3
sudo apt install autoconf gcc-multilib
sudo apt install ocaml-nox libgtksourceview2.0-dev
autoreconf
./configure
make

which works. Lesson learnt.

Spivoxity commented 5 years ago

Since make generally judges the up-to-date-ness of files purely by their timestamps (and doesn't record what commands were run to make them), it's a general problem that building and then changing the configuration can leave obsolete object files behind. So it's necessary to make clean or in this case make quiteclean after a configuration change, such as installing a needed library.

It's a moot point now, but I suspect you did what I often tend to do:

  1. configure
  2. make
  3. notice missing header file
  4. install libgtksourceview2.0-dev
  5. make again

But that leaves behind the file lablgtk.cma built at stage 2 and containing wrong linking information.

[Dieser Eingang war nur für dich bestimmt. Ich gehe jetzt und schließe ihn.]