c3d / xl

A minimalist, general-purpose programming language based on meta-programming and parse tree rewrites
GNU General Public License v3.0
270 stars 15 forks source link

How to build on Ubuntu 18.04.1? #1

Closed pepa65 closed 5 years ago

pepa65 commented 5 years ago

I have simply cloned this repo, did cd xl/xl2 and then make:

make[1]: Entering directory '/home/pp/git/xl/xl2'
Compiling main.cpp
Generating dependencies in obj/linux/debug/Makefile.depend
Compiling main.cpp
Compiling main.cpp
Compiling main.cpp
make[2]: Entering directory '/home/pp/git/xl/xl2'
Compiling predepend
Compiling predepend
make[2]: Leaving directory '/home/pp/git/xl/xl2'
----------- Making debug in /home/pp/git/xl/xl2 ------------
Dependencies for debug done
Compiling main.cpp
Compiling scanner.cpp
Compiling tree.cpp
Compiling context.cpp
Compiling parser.cpp
Compiling ctrans.cpp
Compiling options.cpp
Compiling errors.cpp
Building xl
cd bootstrap && make test
make[2]: Entering directory '/home/pp/git/xl/xl2/bootstrap'
Compiling compiler.xl
Generating dependencies in ../obj/linux/debug/bootstrap/Makefile.depend
Compiling compiler.xl
Compiling compiler.xl
Compiling compiler.xl
make[3]: Entering directory '/home/pp/git/xl/xl2/bootstrap'
No dependency for %
Compiling predepend
Compiling predepend
make[3]: Leaving directory '/home/pp/git/xl/xl2/bootstrap'
make[3]: Entering directory '/home/pp/git/xl/xl2/bootstrap'
----------- Making debug in /home/pp/git/xl/xl2/bootstrap ------------
Dependencies for debug done
cp ../xl_lib.h .
cp ../xl.syntax .
Compiling compiler.xl
Compiling ../obj/linux/debug/bootstrap/compiler.xl.C
../obj/linux/debug/bootstrap/compiler.xl.C: In function ‘void xl::translator::xl2cargs(xl::parser::tree::tree)’:
../obj/linux/debug/bootstrap/compiler.xl.C:2046:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
../obj/linux/debug/bootstrap/compiler.xl.C: In function ‘void xl::translator::xl2c(xl::parser::tree::tree)’:
../obj/linux/debug/bootstrap/compiler.xl.C:2658:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
../obj/linux/debug/bootstrap/compiler.xl.C:3492:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
../obj/linux/debug/bootstrap/compiler.xl.C: In function ‘bool xl::translator::xlnamespacescope(xl::parser::tree::tree)’:
../obj/linux/debug/bootstrap/compiler.xl.C:3822:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
Building bxl
---------- Done with debug in /home/pp/git/xl/xl2/bootstrap ----------
make[3]: Leaving directory '/home/pp/git/xl/xl2/bootstrap'
make PRODUCT=bbxl XL=./bxl OBJROOT="../obj/linux/debugbbxl"
make[3]: Entering directory '/home/pp/git/xl/xl2/bootstrap'
Compiling compiler.xl
Generating dependencies in ../obj/linux/debugbbxl/bootstrap/Makefile.depend
Compiling compiler.xl
Compiling compiler.xl
Compiling compiler.xl
make[4]: Entering directory '/home/pp/git/xl/xl2/bootstrap'
No dependency for %
Compiling predepend
Compiling predepend
make[4]: Leaving directory '/home/pp/git/xl/xl2/bootstrap'
make[4]: Entering directory '/home/pp/git/xl/xl2/bootstrap'
----------- Making debug in /home/pp/git/xl/xl2/bootstrap ------------
Dependencies for debug done
Compiling compiler.xl
Compiling ../obj/linux/debugbbxl/bootstrap/compiler.xl.C
../obj/linux/debugbbxl/bootstrap/compiler.xl.C: In function ‘void xl::translator::xl2cargs(xl::parser::tree::tree)’:
../obj/linux/debugbbxl/bootstrap/compiler.xl.C:3608:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
../obj/linux/debugbbxl/bootstrap/compiler.xl.C: In function ‘void xl::translator::xl2c(xl::parser::tree::tree)’:
../obj/linux/debugbbxl/bootstrap/compiler.xl.C:4304:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
../obj/linux/debugbbxl/bootstrap/compiler.xl.C:5246:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
../obj/linux/debugbbxl/bootstrap/compiler.xl.C: In function ‘bool xl::translator::xlnamespacescope(xl::parser::tree::tree)’:
../obj/linux/debugbbxl/bootstrap/compiler.xl.C:5744:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
Building bbxl
---------- Done with debug in /home/pp/git/xl/xl2/bootstrap ----------
make[4]: Leaving directory '/home/pp/git/xl/xl2/bootstrap'
make[3]: Leaving directory '/home/pp/git/xl/xl2/bootstrap'
make PRODUCT=bbbxl XL=./bbxl OBJROOT="../obj/linux/debugbbxl_test"
make[3]: Entering directory '/home/pp/git/xl/xl2/bootstrap'
Compiling compiler.xl
Generating dependencies in ../obj/linux/debugbbxl_test/bootstrap/Makefile.depend
Compiling compiler.xl
Compiling compiler.xl
Compiling compiler.xl
make[4]: Entering directory '/home/pp/git/xl/xl2/bootstrap'
No dependency for %
Compiling predepend
Compiling predepend
make[4]: Leaving directory '/home/pp/git/xl/xl2/bootstrap'
make[4]: Entering directory '/home/pp/git/xl/xl2/bootstrap'
----------- Making debug in /home/pp/git/xl/xl2/bootstrap ------------
Dependencies for debug done
Compiling compiler.xl
Compiling ../obj/linux/debugbbxl_test/bootstrap/compiler.xl.C
../obj/linux/debugbbxl_test/bootstrap/compiler.xl.C: In function ‘void xl::translator::xl2cargs(xl::parser::tree::tree)’:
../obj/linux/debugbbxl_test/bootstrap/compiler.xl.C:3608:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
../obj/linux/debugbbxl_test/bootstrap/compiler.xl.C: In function ‘void xl::translator::xl2c(xl::parser::tree::tree)’:
../obj/linux/debugbbxl_test/bootstrap/compiler.xl.C:4304:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
../obj/linux/debugbbxl_test/bootstrap/compiler.xl.C:5246:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
../obj/linux/debugbbxl_test/bootstrap/compiler.xl.C: In function ‘bool xl::translator::xlnamespacescope(xl::parser::tree::tree)’:
../obj/linux/debugbbxl_test/bootstrap/compiler.xl.C:5744:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
Building bbbxl
---------- Done with debug in /home/pp/git/xl/xl2/bootstrap ----------
make[4]: Leaving directory '/home/pp/git/xl/xl2/bootstrap'
make[3]: Leaving directory '/home/pp/git/xl/xl2/bootstrap'
make PRODUCT=bbbbxl XL=./bbbxl OBJROOT="../obj/linux/debugbbxl_stability"
make[3]: Entering directory '/home/pp/git/xl/xl2/bootstrap'
Compiling compiler.xl
Generating dependencies in ../obj/linux/debugbbxl_stability/bootstrap/Makefile.depend
Compiling compiler.xl
Compiling compiler.xl
Compiling compiler.xl
make[4]: Entering directory '/home/pp/git/xl/xl2/bootstrap'
No dependency for %
Compiling predepend
Compiling predepend
make[4]: Leaving directory '/home/pp/git/xl/xl2/bootstrap'
make[4]: Entering directory '/home/pp/git/xl/xl2/bootstrap'
----------- Making debug in /home/pp/git/xl/xl2/bootstrap ------------
Dependencies for debug done
Compiling compiler.xl
Compiling ../obj/linux/debugbbxl_stability/bootstrap/compiler.xl.C
../obj/linux/debugbbxl_stability/bootstrap/compiler.xl.C: In function ‘void xl::translator::xl2cargs(xl::parser::tree::tree)’:
../obj/linux/debugbbxl_stability/bootstrap/compiler.xl.C:3608:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
../obj/linux/debugbbxl_stability/bootstrap/compiler.xl.C: In function ‘void xl::translator::xl2c(xl::parser::tree::tree)’:
../obj/linux/debugbbxl_stability/bootstrap/compiler.xl.C:4304:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
../obj/linux/debugbbxl_stability/bootstrap/compiler.xl.C:5246:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
../obj/linux/debugbbxl_stability/bootstrap/compiler.xl.C: In function ‘bool xl::translator::xlnamespacescope(xl::parser::tree::tree)’:
../obj/linux/debugbbxl_stability/bootstrap/compiler.xl.C:5744:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
Building bbbbxl
---------- Done with debug in /home/pp/git/xl/xl2/bootstrap ----------
make[4]: Leaving directory '/home/pp/git/xl/xl2/bootstrap'
make[3]: Leaving directory '/home/pp/git/xl/xl2/bootstrap'
echo ------ Differences: -----------------------------------------
------ Differences: -----------------------------------------
diff ../obj/linux/debugbbxl_test/bootstrap/compiler.xl.C \
     ../obj/linux/debugbbxl_stability/bootstrap/compiler.xl.C
echo ------ End of Differences -----------------------------------
------ End of Differences -----------------------------------
make[2]: Leaving directory '/home/pp/git/xl/xl2/bootstrap'
cd native && make test
make[2]: Entering directory '/home/pp/git/xl/xl2/native'
Compiling compiler.xl
Generating dependencies in ../obj/linux/debug/native/Makefile.depend
Compiling compiler.xl
Compiling compiler.xl
Compiling compiler.xl
make[3]: Entering directory '/home/pp/git/xl/xl2/native'
No dependency for %
Compiling predepend
Compiling predepend
make[3]: Leaving directory '/home/pp/git/xl/xl2/native'
make[3]: Entering directory '/home/pp/git/xl/xl2/native'
----------- Making debug in /home/pp/git/xl/xl2/native ------------
Dependencies for debug done
cp ../xl_lib.h .
cp ../xl.syntax .
Compiling compiler.xl
Compiling ../obj/linux/debug/native/compiler.xl.C
../obj/linux/debug/native/compiler.xl.C: In function ‘void xl::codegenerator::xl2cargs(xl::bytecode::bytecode)’:
../obj/linux/debug/native/compiler.xl.C:4295:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
../obj/linux/debug/native/compiler.xl.C: In function ‘void xl::codegenerator::xl2c(xl::bytecode::bytecode)’:
../obj/linux/debug/native/compiler.xl.C:6033:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
../obj/linux/debug/native/compiler.xl.C: In function ‘bool xl::codegenerator::xlnamespacescope(xl::bytecode::bytecode)’:
../obj/linux/debug/native/compiler.xl.C:6640:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
../obj/linux/debug/native/compiler.xl.C: In function ‘xl::parser::tree::treenode* xl::errors::errortree(xl::parser::tree::tree)’:
../obj/linux/debug/native/compiler.xl.C:9008:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
../obj/linux/debug/native/compiler.xl.C: In function ‘xl::parser::tree::treenode* xl::plugin::listing::translator_220(xl::parser::tree::tree, xl::parser::tree::tree, xl::symbols::rewrite, xl::parser::tree::treemap&)’:
../obj/linux/debug/native/compiler.xl.C:13427:6: warning: variable ‘XLtranslateDone’ set but not used [-Wunused-but-set-variable]
 bool XLtranslateDone = false;
      ^~~~~~~~~~~~~~~
../obj/linux/debug/native/compiler.xl.C: In function ‘xl::parser::tree::treenode* xl::plugin::xl2c::convert(xl::parser::tree::tree)’:
../obj/linux/debug/native/compiler.xl.C:13654:33: error: cannot convert ‘bool’ to ‘xl::parser::tree::tree {aka xl::parser::tree::treenode*}’ in initialization
 xl::parser::tree::tree fnargs = false;
                                 ^~~~~
../obj/linux/debug/native/compiler.xl.C: In function ‘xl::parser::tree::treenode* xl::semantics::declarations::enterdeclaration(xl::parser::tree::tree, xl::parser::tree::tree, xl::parser::tree::tree, bool)’:
../obj/linux/debug/native/compiler.xl.C:17313:31: error: expected primary-expression before ‘decltype’
 xl::semantics::types::anytype decltype = xl::semantics::types::evaluatetype (type);
                               ^~~~~~~~
../obj/linux/debug/native/compiler.xl.C:17314:39: error: expected primary-expression before ‘decltype’
 if (xl::semantics::types::istypetype (decltype)) {
                                       ^~~~~~~~
../obj/linux/debug/native/compiler.xl.C:17321:83: error: expected primary-expression before ‘decltype’
 ::types::anytype declbasetype = xl::semantics::types::nonsourcetype (decltype);
                                                                      ^~~~~~~~
../obj/linux/debug/native/compiler.xl.C:17336:58: error: expected primary-expression before ‘decltype’
 (result = xl::semantics::iterators::enteriterator (name, decltype, value, name));
                                                          ^~~~~~~~
../obj/linux/debug/native/compiler.xl.C:17341:58: error: expected primary-expression before ‘decltype’
 (result = xl::semantics::functions::enterfunction (name, decltype, value, name));
                                                          ^~~~~~~~
../obj/linux/debug/native/compiler.xl.C:17361:2: error: expected primary-expression before ‘decltype’
 (decltype = xl::semantics::types::evaluatetype (type));
  ^~~~~~~~
../obj/linux/debug/native/compiler.xl.C:17361:2: error: expected ‘)’ before ‘decltype’
../obj/linux/debug/native/compiler.xl.C:17362:115: error: expected primary-expression before ‘decltype’
 type2 = dynamic_cast< xl::semantics::types::generics::generictype > (decltype);
                                                                      ^~~~~~~~
../obj/linux/debug/native/compiler.xl.C:17362:115: error: expected ‘)’ before ‘decltype’
In file included from /usr/include/c++/7/cassert:44:0,
                 from ./xl_lib.h:39,
                 from ../obj/linux/debug/native/compiler.xl.C:2:
../obj/linux/debug/native/compiler.xl.C: In function ‘bool xl::semantics::generics::instantiatedtypematch(xl::semantics::types::anytype, xl::semantics::types::anytype)’:
../obj/linux/debug/native/compiler.xl.C:23137:32: warning: the address of ‘bool xl::semantics::generics::instantiatedtypematch(xl::semantics::types::anytype, xl::semantics::types::anytype)’ will never be NULL [-Waddress]
 assert ((instantiatedtypematch == 0));
          ~~~~~~~~~~~~~~~~~~~~~~^~~~
Makefile:138: recipe for target '../obj/linux/debug/native/compiler.xl.o' failed
make[3]: *** [../obj/linux/debug/native/compiler.xl.o] Error 1
make[3]: Leaving directory '/home/pp/git/xl/xl2/native'
../Makefile.rules:62: recipe for target 'debug' failed
make[2]: *** [debug] Error 2
make[2]: Leaving directory '/home/pp/git/xl/xl2/native'
Makefile:49: recipe for target 'native_compiler' failed
make[1]: *** [native_compiler] Error 2
make[1]: Leaving directory '/home/pp/git/xl/xl2'
Makefile.rules:62: recipe for target 'debug' failed
make: *** [debug] Error 2

What can I do to build xl2 and xlr? I am very keen to try it out.

c3d commented 5 years ago

Hello,

Thanks a lot for your interest. The 'master' branch is somewhat outdated. Please check the 'bigmerge' branch, which is under active development and should become 'master' within maybe a month or so. It now supports LLVM 3.7-8.0 (and I'm checking regularly on LLVM ToT as well), and the test suite runs somewhat reliably. I just checked xl2, and it looks OK too.

Regarding Ubuntu, you pointed out I was insufficiently testing it. I only had an Ubuntu 16 VM, which fails to compile some recorder stuff because GCC 5.0.4 is old and is not too smart about "friend name injection", so it fails with an error about _recorder_arg not being found on GCPtr (it's a compiler bug, and one that is not too easy to workaround).

I've just finished installing Ubuntu 18, and I will try tomorrow. Chances are you would be more lucky there (I hope). But if not, I will fix it quickly.

I will respond to your questions regarding dev plans on Grenouille Bouillie.

pepa65 commented 5 years ago

I checked out bigmerge, and FYI I'll post the output for make now:

make[1]: Entering directory '/home/pp/git/xl'
[BEGIN]              opt linux in [top]   
make[2]: Entering directory '/home/pp/git/xl/recorder'
[BEGIN]              opt linux in [top]recorder/   
[BUILD]              librecorder.so      
[END]                opt linux in [top]recorder/   
make[2]: Leaving directory '/home/pp/git/xl/recorder'
make[2]: Entering directory '/home/pp/git/xl/src'
/bin/bash: llvm-config: command not found
[INFO]               Building with LLVM version   
[BEGIN]              opt linux in [top]src/   
[VARIANT]            lib      
make[3]: Entering directory '/home/pp/git/xl/src'
/bin/bash: llvm-config: command not found
[INFO]               Building with LLVM version   
[BEGIN]              opt linux in [top]src/[lib]   
/bin/bash: llvm-config: command not found
/bin/bash: llvm-config: command not found
/bin/bash: llvm-config: command not found
[COMPILE  1/34]      llvm-crap.cpp      
In file included from llvm-crap.cpp:40:0:
llvm-crap.h:44:20: error: operator '<' has no left operand
 #elif LLVM_VERSION < 370
                    ^
In file included from llvm-crap.h:51:0,
                 from llvm-crap.cpp:40:
llvm-crap.h:311:19: error: operator '>=' has no left operand
 # if LLVM_VERSION >= 350 && LLVM_VERSION < 360
                   ^~
llvm-crap.h:319:19: error: operator '>=' has no left operand
 # if LLVM_VERSION >= 370 && LLVM_VERSION < 380
                   ^~
llvm-crap.h:324:19: error: operator '>=' has no left operand
 # if LLVM_VERSION >= 400
                   ^~
In file included from llvm-crap.cpp:40:0:
llvm-crap.h:55:10: fatal error: llvm/IR/Type.h: No such file or directory
 #include <llvm/IR/Type.h>
          ^~~~~~~~~~~~~~~~
compilation terminated.
../make-it-quick/rules.mk:465: recipe for target '/home/pp/git/xl/.objects/linux/opt/src/llvm-crap.cpp.o' failed
make[3]: *** [/home/pp/git/xl/.objects/linux/opt/src/llvm-crap.cpp.o] Error 1
make[3]: Leaving directory '/home/pp/git/xl/src'
../make-it-quick/rules.mk:364: recipe for target 'lib.variant' failed
make[2]: *** [lib.variant] Error 2
make[2]: Leaving directory '/home/pp/git/xl/src'
make-it-quick/rules.mk:361: recipe for target 'src.recurse' failed
make[1]: *** [src.recurse] Error 2
make[1]: Leaving directory '/home/pp/git/xl'

real    0m0.527s
user    0m0.307s
sys 0m0.189s
5 Errors, 0 Warnings in /home/pp/git/xl/.logs/build-linux-opt-20190411-143453.log
make-it-quick/rules.mk:203: recipe for target 'opt' failed
make: *** [opt] Error 2

Really appreciate all the years of work you put into this, and I hope many people will be able to benefit from it.

c3d commented 5 years ago

/bin/bash: llvm-config: command not found You need to install llvm :-) apt-get install llvm-dev should do it.

I'll make sure the build aborts right away instead of trying to compile stuff.

pepa65 commented 5 years ago

Thanks, I did check for llvm but don't know very much about it. I had libllvm7 and 6.0 but that was all. Now it has installed llvm-6.0, and YES it builds!