Gobo Eiffel on OpenBSD

eiffel

The Eiffel language is one of the best object-oriented programming languages, most of the concepts of which have been taken up by languages such as Java, C# and others.
Unfortunately, Eiffel now has a very low popularity, which hardly encourages developers to learn it or use it.

Historically, the Eiffel language was conceived by Bertrand Meyer in 1985. There are several compilers for this language:

  • Eiffel from B. Meyer
  • Gobo Eiffel
  • LibertyEiffel

These languages are all distributed in open source, but Gobo Eiffel has the advantage of having a very permissive license and of being easily installed on OpenBSD.

Installation on OpenBSD

Let's start by downloading the Eiffel Gobo software package on GitHub: gobo-master.zip

Let's unzip this file in our user directory.

We can also use the git command with the link
https://github.com/gobo-eiffel/gobo.git

In the .profile file of our user session, let's insert the lines:

GOBO=/home/<user>/<path-to>/gobo-master

export GOBO

Let's install in "root" mode the package libiconv which proves essential for the compilation from Eiffel Gobo. But an attempt to compile the package causes a files not found error (iconv.h and libiconv.a). This stems from the fact that the manager OpenBSD packages installs them in the /usr/local directory and not in /usr.

Tentatively, let's perform symbolic links as follows:

ln -s /usr/local/lib/libiconv.a /usr/lib/libiconv.a

ln -s /usr/local/include/iconv.h /usr/include/iconv.h

Finally, let's place ourselves in the directory /home/<user>/<path-to>/gobo-master/bin

and let's run the command:
sh install.sh -v clang

Everything compiles and installs normally without errors.

To test the installation let's execute in the directory /home/<user>/<path-to>/gobo-master, the command
geant test_ge

Unfortunately, the checks end with several errors:

 Test Summary for xparse_example

# Passed:     1 test
# FAILED:     4 tests
# Aborted:    0 test
# Total:      5 tests (15 assertions)

After some compilation tests on a hello example, I realized that it was missing in the generated files hello.make and hello.sh a -l iconv link to the library. But the problem has already been reported for Mac OS X (Fixed iconv build issue for Mac OS X #48) on GitHub.

Let's add to the .profile file the following lines:

ISE_PLATFORM=openbsd-x86
export ISE_PLATFORM

The most important thing is that there is bsd in the name.

Let's start the installation again. In the directory /home/<user>/<path-to>/gobo-master/bin, let's run the command:
sh install.sh -v clang

Let's perform one more last test:
geant test_ge

It still fails but much further.
Test Summary for xgec_tool

# Passed:     0 test
# FAILED:     1 test
# Aborted:    0 test
# Total:      1 test (5 assertions)

Test Results:
FAIL:  [TEST_GEC.test_gec] expected_results
   expected: output containing 'No Diff since last run'
   but  got:

Testing validation...
Running Test Cases

Test Summary for validation

# Passed:     189 tests
# FAILED:     298 tests
# Aborted:    0 test
# Total:      487 tests (6026 assertions)

It could be that some classes from the free_elks library are not usable.

Example

Let's try a simple example anyway. To do this, let's create the following files in the same directory:

hello.e

class HELLO

create
	make

feature
i: INTEGER
	make
		do
			print ("Hello, World%N")
			from
			i := 0
			until
				i >= 10
			loop
				print (i)
				i := i + 1
			end
			print ("%N")
		end

end

hello.ecf

<?xml  version="1.0"  encoding="ISO-8859-1"?>
<system
	xmlns="http://www.eiffel.com/developers/xml/configuration-1-22-0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-22-0  http://www.eiffel.com/developers/xml/configuration-1-22-0.xsd"
	name="hello"
	uuid="8C35A383-9927-4EF8-8784-D6F287B296E7"
>
	<target  name="hello">
		<root  class="HELLO"  feature="make"/>
		<file_rule>
			<exclude>.git</exclude>
		</file_rule>

		<option  warning="true">
			<assertions  precondition="true"  postcondition="true"  check="true"  invariant="true"  loop="true"  supplier_precondition="true"/>
		</option>

		<!--  Assumes  you  set  the  GOBO  environment  variable  to  the  path  to  your  gobo  repo  folder,  as  per  gobo's  install  instructions.  -->
		<library  name="free_elks"  location="${GOBO}/library/free_elks/library_ge.ecf"  readonly="true"/>

		<cluster  name="root_cluster"  location="./"  recursive="false">
			<file_rule>
				<exclude>.git</exclude>
			</file_rule>
		</cluster>
	</target>
</system>

Then let's compile the program by running the command:
gec hello.ecf

Degree 6: 0/0/0 0:0:0.058
Degree 5: 0/0/0 0:0:0.522
Degree 4: 0/0/0 0:0:0.182
Degree 3: 0/0/0 0:0:0.244
Degree -2: 0/0/0 0:0:0.221
Degree -3: 0/0/0 0:0:0.210
hello1.c(hello1.o:(eif_file_creatable)): warning: strcpy() is almost always misused, please use strlcpy()
hello1.c(hello1.o:(eif_file_owner)): warning: sprintf() is often misused, please use snprintf()
Degree -4: 0/0/0 0:0:7.088
Total Time: 0/0/0 0:0:8.704

Apart from a few warning messages, it works.

At runtime, it displays:

Hello, World
0123456789

RSS


Mail


Follow


Preferencesoft Website Privacy Policy