small medium large xlarge

Generic-user-small
12 May 2016, 10:22
Bernard Kaiflin (13 posts)

The example crashes in the test with

{“init terminating in do_boot”,{error,could_not_load_driver}}

To make it work on OS X El Capitan 10.11.4, I had to remove references to example1_lid in Makefile.mac and unit_test.erl.

ports/Makefile.mac modified :

.SUFFIXES: .erl .beam .yrl

.erl.beam:
	erlc -W $<

MODS = example1 unit_test

all: 	 ${MODS:%=%.beam} example1
	@erl -noshell -s unit_test start
example1:  example1.c erl_comm.c example1_driver.c
	gcc -o example1 example1.c erl_comm.c example1_driver.c
clean:
	rm example1 *.beam

ports/unit_test.erl modified :

    10 = example1:sum(6,4),
%%    example1_lid:start(),
%%    8 = example1_lid:twice(4),
%%    20 = example1_lid:sum(15,5),
    io:format("All tests worked~n"),

And now it works :

$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.4.0
...
$ make -f Makefile.mac 
erlc -W example1.erl
erlc -W unit_test.erl
gcc -o example1 example1.c erl_comm.c example1_driver.c
Testing drivers
All tests worked
$ erl
Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V7.3  (abort with ^G)
1> example1:start().
true
2> example1:sum(45, 32).
77
3> example1:twice(10).
20
4> 
You must be logged in to comment