orangeduck / Cello

Higher level programming in C
http://libcello.org/
Other
6.81k stars 370 forks source link

MacOS: __dyld section not supported #118

Open IngwiePhoenix opened 5 years ago

IngwiePhoenix commented 5 years ago

I came across this while trying to fix the benchmarking on my local copy:

 $ ./benchmarks/List/list_cello 
dyld: __dyld section not supported in /Users/Ingwie/Work/Git/Cello/./benchmarks/List/list_cello
fish: './benchmarks/List/list_cello' terminated by signal SIGABRT (Abort)

I didn't investigate into it just yet, but maybe you have an idea :)

Meanwhile, this is what I did up to the point I found this error:

diff --git a/benchmarks/benchmark b/benchmarks/benchmark
index f005520..7e6c884 100755
--- a/benchmarks/benchmark
+++ b/benchmarks/benchmark
@@ -1,3 +1,17 @@
+if [ "$(uname -s)" = "Darwin" ]; then
+  # On Mac OS, use gtime, if it is installed.
+  which -s gtime
+  if [ "$?" = 0 ]; then
+    TIME="gtime -f"
+  else
+    # gtime not found, revert to basic time
+    TIME=time
+  fi
+else
+  # Use regular time. This is GNU's time command, so it has the "-f" flag.
+  TIME="time -f"
+fi
+
 gcc ./ext/genint.c -o ./ext/genint

 gcc Nbodies/nbodies_c.c -std=c99 -O3 -lm -o Nbodies/nbodies_c
@@ -39,23 +53,23 @@ echo
 echo "## Garbage Collection"
 echo
 echo -n "* C: "
-time -f "%e" ./GC/gc_c
+$TIME "%e" ./GC/gc_c
 echo -n "* C++: "
-time -f "%e" ./GC/gc_cpp
+$TIME "%e" ./GC/gc_cpp
 echo -n "* Cello: "
-time -f "%e" ./GC/gc_cello
+$TIME "%e" ./GC/gc_cello
 echo -n "* Java: "
-time -f "%e" java -cp ./GC gc_java
+$TIME "%e" java -cp ./GC gc_java
 echo -n "* Javascript: "
-time -f "%e" nodejs GC/gc_javascript.js
+$TIME "%e" node GC/gc_javascript.js
 echo -n "* Python: "
-time -f "%e" python GC/gc_python.py
-echo -n "* Ruby: "
+$TIME "%e" python GC/gc_python.py
+$TIME "* Ruby: "
 time -f "%e" ruby GC/gc_ruby.rb
 echo -n "* Lua: "
-time -f "%e" lua GC/gc_lua.lua
+$TIME "%e" lua GC/gc_lua.lua
 echo -n "* Lua JIT: "
-time -f "%e" luajit GC/gc_lua.lua
+$TIME "%e" luajit GC/gc_lua.lua

 gprof GC/gc_cello > GC/profile.txt
 rm gmon.out
@@ -65,23 +79,23 @@ echo
 echo "## List"
 echo
 echo -n "* C: "
-time -f "%e" ./List/list_c
+$TIME "%e" ./List/list_c
 echo -n "* C++: "
-time -f "%e" ./List/list_cpp
+$TIME "%e" ./List/list_cpp
 echo -n "* Cello: "
-time -f "%e" ./List/list_cello
+$TIME "%e" ./List/list_cello
 echo -n "* Java: "
-time -f "%e" java -cp ./List list_java
+$TIME "%e" java -cp ./List list_java
 echo -n "* Javascript: "
-time -f "%e" nodejs List/list_javascript.js
+$TIME "%e" node List/list_javascript.js
 echo -n "* Python: "
-time -f "%e" python List/list_python.py
+$TIME "%e" python List/list_python.py
 echo -n "* Ruby: "
-time -f "%e" ruby List/list_ruby.rb
+$TIME "%e" ruby List/list_ruby.rb
 echo -n "* Lua: "
-time -f "%e" lua List/list_lua.lua
+$TIME "%e" lua List/list_lua.lua
 echo -n "* Lua JIT: "
-time -f "%e" luajit List/list_lua.lua
+$TIME "%e" luajit List/list_lua.lua

 gprof List/list_cello > List/profile.txt
 rm gmon.out
@@ -90,23 +104,23 @@ echo
 echo "## Map"
 echo
 echo -n "* C: "
-time -f "%e" sh -c './ext/genint | ./Map/map_c'
+$TIME "%e" sh -c './ext/genint | ./Map/map_c'
 echo -n "* C++: "
-time -f "%e" sh -c './ext/genint | ./Map/map_cpp'
+$TIME "%e" sh -c './ext/genint | ./Map/map_cpp'
 echo -n "* Cello: "
-time -f "%e" sh -c './ext/genint | ./Map/map_cello'
+$TIME "%e" sh -c './ext/genint | ./Map/map_cello'
 echo -n "* Java: "
-time -f "%e" sh -c './ext/genint | java -cp ./Map map_java'
+$TIME "%e" sh -c './ext/genint | java -cp ./Map map_java'
 echo -n "* Javascript: "
-time -f "%e" sh -c './ext/genint | nodejs Map/map_javascript.js'
+$TIME "%e" sh -c './ext/genint | node Map/map_javascript.js'
 echo -n "* Python: "
-time -f "%e" sh -c './ext/genint | python Map/map_python.py'
+$TIME "%e" sh -c './ext/genint | python Map/map_python.py'
 echo -n "* Ruby: "
-time -f "%e" sh -c './ext/genint | ruby Map/map_ruby.rb'
+$TIME "%e" sh -c './ext/genint | ruby Map/map_ruby.rb'
 echo -n "* Lua: "
-time -f "%e" sh -c './ext/genint | lua Map/map_lua.lua'
+$TIME "%e" sh -c './ext/genint | lua Map/map_lua.lua'
 echo -n "* Lua JIT: "
-time -f "%e" sh -c './ext/genint | luajit Map/map_lua.lua'
+$TIME "%e" sh -c './ext/genint | luajit Map/map_lua.lua'

 gprof Map/map_cello > Map/profile.txt
 rm gmon.out
@@ -115,23 +129,23 @@ echo
 echo "## NBodies"
 echo
 echo -n "* C: "
-time -f "%e" ./Nbodies/nbodies_c 
+$TIME "%e" ./Nbodies/nbodies_c 
 echo -n "* C++: "
-time -f "%e" ./Nbodies/nbodies_cpp
+$TIME "%e" ./Nbodies/nbodies_cpp
 echo -n "* Cello: "
-time -f "%e" ./Nbodies/nbodies_cello
+$TIME "%e" ./Nbodies/nbodies_cello
 echo -n "* Java: "
-time -f "%e" java -cp ./Nbodies nbodies_java
+$TIME "%e" java -cp ./Nbodies nbodies_java
 echo -n "* Javascript: "
-time -f "%e" nodejs Nbodies/nbodies_javascript.js
+$TIME "%e" node Nbodies/nbodies_javascript.js
 echo -n "* Python: "
-time -f "%e" python Nbodies/nbodies_python.py
+$TIME "%e" python Nbodies/nbodies_python.py
 echo -n "* Ruby: "
-time -f "%e" ruby Nbodies/nbodies_ruby.rb
+$TIME "%e" ruby Nbodies/nbodies_ruby.rb
 echo -n "* Lua: "
-time -f "%e" lua Nbodies/nbodies_lua.lua
+$TIME "%e" lua Nbodies/nbodies_lua.lua
 echo -n "* Lua JIT: "
-time -f "%e" luajit Nbodies/nbodies_lua.lua
+$TIME "%e" luajit Nbodies/nbodies_lua.lua

 gprof Nbodies/nbodies_cello > Nbodies/profile.txt
 rm gmon.out
@@ -140,23 +154,23 @@ echo
 echo "## Dict"
 echo
 echo -n "* C: "
-time -f "%e" sh -c './ext/genint | ./Dict/dict_c'
+$TIME "%e" sh -c './ext/genint | ./Dict/dict_c'
 echo -n "* C++: "
-time -f "%e" sh -c './ext/genint | ./Dict/dict_cpp'
+$TIME "%e" sh -c './ext/genint | ./Dict/dict_cpp'
 echo -n "* Cello: "
-time -f "%e" sh -c './ext/genint | ./Dict/dict_cello'
+$TIME "%e" sh -c './ext/genint | ./Dict/dict_cello'
 echo -n "* Java: "
-time -f "%e" sh -c './ext/genint | java -cp ./Dict dict_java'
+$TIME "%e" sh -c './ext/genint | java -cp ./Dict dict_java'
 echo -n "* Javascript: "
-time -f "%e" sh -c './ext/genint | nodejs Dict/dict_javascript.js'
+$TIME "%e" sh -c './ext/genint | node Dict/dict_javascript.js'
 echo -n "* Python: "
-time -f "%e" sh -c './ext/genint | python Dict/dict_python.py'
+$TIME "%e" sh -c './ext/genint | python Dict/dict_python.py'
 echo -n "* Ruby: "
-time -f "%e" sh -c './ext/genint | ruby Dict/dict_ruby.rb'
+$TIME "%e" sh -c './ext/genint | ruby Dict/dict_ruby.rb'
 echo -n "* Lua: "
-time -f "%e" sh -c './ext/genint | lua Dict/dict_lua.lua'
+$TIME "%e" sh -c './ext/genint | lua Dict/dict_lua.lua'
 echo -n "* Lua JIT: "
-time -f "%e" sh -c './ext/genint | luajit Dict/dict_lua.lua'
+$TIME "%e" sh -c './ext/genint | luajit Dict/dict_lua.lua'

 gprof Dict/dict_cello > Dict/profile.txt
 rm gmon.out
@@ -165,23 +179,23 @@ echo
 echo "## Sudoku"
 echo
 echo -n "* C: "
-time -f "%e" sh -c './ext/sudoku | ./Sudoku/sudoku_c'
+$TIME "%e" sh -c './ext/sudoku | ./Sudoku/sudoku_c'
 echo -n "* C++: "
-time -f "%e" sh -c './ext/sudoku | ./Sudoku/sudoku_cpp'
+$TIME "%e" sh -c './ext/sudoku | ./Sudoku/sudoku_cpp'
 echo -n "* Cello: "
-time -f "%e" sh -c './ext/sudoku | ./Sudoku/sudoku_cello'
+$TIME "%e" sh -c './ext/sudoku | ./Sudoku/sudoku_cello'
 echo -n "* Java: "
-time -f "%e" sh -c './ext/sudoku | java -cp ./Sudoku sudoku_java'
+$TIME "%e" sh -c './ext/sudoku | java -cp ./Sudoku sudoku_java'
 echo -n "* Javascript: "
-time -f "%e" sh -c './ext/sudoku | nodejs Sudoku/sudoku_javascript.js'
+$TIME "%e" sh -c './ext/sudoku | node Sudoku/sudoku_javascript.js'
 echo -n "* Python: "
-time -f "%e" sh -c './ext/sudoku | python Sudoku/sudoku_python.py'
+$TIME "%e" sh -c './ext/sudoku | python Sudoku/sudoku_python.py'
 echo -n "* Ruby: "
-time -f "%e" sh -c './ext/sudoku | ruby Sudoku/sudoku_ruby.rb'
+$TIME "%e" sh -c './ext/sudoku | ruby Sudoku/sudoku_ruby.rb'
 echo -n "* Lua: "
-time -f "%e" sh -c './ext/sudoku | lua Sudoku/sudoku_lua.lua'
+$TIME "%e" sh -c './ext/sudoku | lua Sudoku/sudoku_lua.lua'
 echo -n "* Lua JIT: "
-time -f "%e" sh -c './ext/sudoku | luajit Sudoku/sudoku_lua.lua'
+$TIME "%e" sh -c './ext/sudoku | luajit Sudoku/sudoku_lua.lua'

 gprof Sudoku/sudoku_cello > Sudoku/profile.txt
 rm gmon.out
@@ -190,23 +204,23 @@ echo
 echo "## Matmul"
 echo
 echo -n "* C: "
-time -f "%e" ./Matmul/matmul_c
+$TIME "%e" ./Matmul/matmul_c
 echo -n "* C++: "
-time -f "%e" ./Matmul/matmul_cpp
+$TIME "%e" ./Matmul/matmul_cpp
 echo -n "* Cello: "
-time -f "%e" ./Matmul/matmul_cello
+$TIME "%e" ./Matmul/matmul_cello
 echo -n "* Java: "
-time -f "%e" java -cp ./Matmul matmul_java
+$TIME "%e" java -cp ./Matmul matmul_java
 echo -n "* Javascript: "
-time -f "%e" nodejs Matmul/matmul_javascript.js
+$TIME "%e" node Matmul/matmul_javascript.js
 echo -n "* Python: "
-time -f "%e" python Matmul/matmul_python.py
+$TIME "%e" python Matmul/matmul_python.py
 echo -n "* Ruby: "
-time -f "%e" ruby Matmul/matmul_ruby.rb
+$TIME "%e" ruby Matmul/matmul_ruby.rb
 echo -n "* Lua: "
-time -f "%e" lua Matmul/matmul_lua.lua
+$TIME "%e" lua Matmul/matmul_lua.lua
 echo -n "* Lua JIT: "
-time -f "%e" luajit Matmul/matmul_lua.lua
+$TIME "%e" luajit Matmul/matmul_lua.lua

 gprof Matmul/matmul_cello > Matmul/profile.txt
 rm gmon.out
orangeduck commented 5 years ago

Hey sorry I have no real idea what this error is about but after a quick googling it appears the latest version of MacOS Mojave doesn't support profiling or something like that...