JarrettBillingsley / Croc

Croc is an extensible extension language in the vein of Lua, which also wishes it were a standalone language. Also it's fun.
http://www.croc-lang.org
79 stars 12 forks source link

Compilation trouble #91

Closed grimnight closed 11 years ago

grimnight commented 11 years ago

I was unable to compile a working croci with dmd-1.076 and tango-trunk-r5713 or tango-0.99.9-bin-osx32-with-dmd.1.056. Would it be possible to add the latest working DMD version and tango revision to README.md?

It would also help to have other ways to compile than using dsss. Maybe a text file with a minimal list of files and options necessary for succesfull build of croci. Maybe you could recommend a specific point in history when everything worked with a specific compiler and tango.

JarrettBillingsley commented 11 years ago

Ack, sorry. I keep getting this question and every time I have to figure out the answer again, and I never thought to write it down!

I'm using DMD 1.056 and Tango 0.99.9. All I do is get the Tango/DMD package from the Tango page here: http://dsource.org/projects/tango

I stopped following Tango-trunk a while ago because I got lots of complaints from people who wanted to stay on major releases... though I guess D1/Tango's pretty much dead now, so it doesn't really matter either way ;)

Also I don't use DSSS to compile, I use build/bud (http://dsource.org/projects/build). There are some .brf files in the repo as well for building croci and a library, though I think lib.brf is a little outdated. Really though it's extremely simple: just compile everything in croc/ and pass all those objects to whatever librarian you're using.

grimnight commented 11 years ago

I still can't get it to work. I put "tango-0.99.9-bin-osx32-with-dmd.1.056/bin" to $PATH.

But I keep getting errors:

❯❯❯ dmd croci.d -release -op -O -w -version=CrocBuiltinDocs -odobjdir -ofcroci croc/addons/devil.d croc/addons/devil_wrap.d croc/addons/gl.d croc/addons/gl_ext.d croc/addons/gl_wrap.d croc/addons/net.d croc/addons/pcre.d croc/addons/sdl.d croc/api.d croc/api_checks.d croc/api_debug.d croc/api_interpreter.d croc/api_stack.d croc/base_alloc.d croc/base_deque.d croc/base_gc.d croc/base_hash.d croc/base_metamethods.d croc/base_opcodes.d croc/base_writebarrier.d croc/compiler.d croc/compiler_ast.d croc/compiler_astvisitor.d croc/compiler_codegen.d croc/compiler_docgen.d croc/compiler_funcstate.d croc/compiler_lexer.d croc/compiler_parser.d croc/compiler_semantic.d croc/compiler_types.d croc/ex.d croc/ex_bind.d croc/ex_commandline.d croc/ex_doccomments.d croc/ex_format.d croc/ex_json.d croc/ex_library.d croc/ex_serialization.d croc/interpreter.d croc/serialization.d croc/stdlib_array.d croc/stdlib_ascii.d croc/stdlib_base.d croc/stdlib_compiler.d croc/stdlib_console.d croc/stdlib_debug.d croc/stdlib_docs.d croc/stdlib_env.d croc/stdlib_exceptions.d croc/stdlib_file.d croc/stdlib_gc.d croc/stdlib_hash.d croc/stdlib_json.d croc/stdlib_math.d croc/stdlib_memblock.d croc/stdlib_modules.d croc/stdlib_object.d croc/stdlib_os.d croc/stdlib_path.d croc/stdlib_serialization.d croc/stdlib_stream.d croc/stdlib_string.d croc/stdlib_stringbuffer.d croc/stdlib_text.d croc/stdlib_text_ascii.d croc/stdlib_text_codec.d croc/stdlib_text_latin1.d croc/stdlib_text_utf16.d croc/stdlib_text_utf32.d croc/stdlib_text_utf8.d croc/stdlib_thread.d croc/stdlib_time.d croc/stdlib_vector.d croc/types.d croc/types_array.d croc/types_class.d croc/types_funcdef.d croc/types_function.d croc/types_instance.d croc/types_memblock.d croc/types_namespace.d croc/types_nativeobj.d croc/types_string.d croc/types_table.d croc/types_thread.d croc/types_weakref.d croc/utf.d croc/utils.d croc/vm.d
croc/ex_bind.d(530): Error: undefined identifier newInstance
croc/ex_bind.d(530): Error: function expected before (), not newInstance of type int
croc/ex_bind.d(532): Error: undefined identifier setExtraVal
croc/ex_bind.d(532): Error: function expected before (), not setExtraVal of type int

❯❯❯ dmd croci.d -release -op -O -w -version=CrocBuiltinDocs -odobjdir -ofcroci croc/api.d croc/api_checks.d croc/api_debug.d croc/api_interpreter.d croc/api_stack.d croc/base_alloc.d croc/base_deque.d croc/base_gc.d croc/base_hash.d croc/base_metamethods.d croc/base_opcodes.d croc/base_writebarrier.d croc/compiler.d croc/compiler_ast.d croc/compiler_astvisitor.d croc/compiler_codegen.d croc/compiler_docgen.d croc/compiler_funcstate.d croc/compiler_lexer.d croc/compiler_parser.d croc/compiler_semantic.d croc/compiler_types.d croc/ex.d croc/ex_commandline.d croc/ex_doccomments.d croc/ex_format.d croc/ex_json.d croc/ex_library.d croc/ex_serialization.d croc/interpreter.d croc/serialization.d croc/stdlib_array.d croc/stdlib_ascii.d croc/stdlib_base.d croc/stdlib_compiler.d croc/stdlib_console.d croc/stdlib_debug.d croc/stdlib_docs.d croc/stdlib_env.d croc/stdlib_exceptions.d croc/stdlib_file.d croc/stdlib_gc.d croc/stdlib_hash.d croc/stdlib_json.d croc/stdlib_math.d croc/stdlib_memblock.d croc/stdlib_modules.d croc/stdlib_object.d croc/stdlib_os.d croc/stdlib_path.d croc/stdlib_serialization.d croc/stdlib_stream.d croc/stdlib_string.d croc/stdlib_stringbuffer.d croc/stdlib_text.d croc/stdlib_text_ascii.d croc/stdlib_text_codec.d croc/stdlib_text_latin1.d croc/stdlib_text_utf16.d croc/stdlib_text_utf32.d croc/stdlib_text_utf8.d croc/stdlib_thread.d croc/stdlib_time.d croc/stdlib_vector.d croc/types.d croc/types_array.d croc/types_class.d croc/types_funcdef.d croc/types_function.d croc/types_instance.d croc/types_memblock.d croc/types_namespace.d croc/types_nativeobj.d croc/types_string.d croc/types_table.d croc/types_thread.d croc/types_weakref.d croc/utf.d croc/utils.d croc/vm.d
Undefined symbols:
"_D4croc6addons3net12__ModuleInfoZ", referenced from:
  _D4croc3api12__ModuleInfoZ in croci.o
"_D4croc6addons4pcre12__ModuleInfoZ", referenced from:
  _D4croc3api12__ModuleInfoZ in croci.o
"_D4croc6addons3net10initNetLibFPS4croc5types10CrocThreadZv", referenced from:
  _D4croc3api10loadAddonsFPS4croc5types10CrocThreadkZv in croci.o
"_D4croc6addons4pcre7PcreLib4initFPS4croc5types10CrocThreadZv", referenced from:
  _D4croc3api10loadAddonsFPS4croc5types10CrocThreadkZv in croci.o
"_D4croc6addons5devil8DevilLib4initFPS4croc5types10CrocThreadZv", referenced from:
  _D4croc3api10loadAddonsFPS4croc5types10CrocThreadkZv in croci.o
"_D4croc6addons3sdl12__ModuleInfoZ", referenced from:
  _D4croc3api12__ModuleInfoZ in croci.o
"_D4croc6addons5devil12__ModuleInfoZ", referenced from:
  _D4croc3api12__ModuleInfoZ in croci.o
"_D4croc6addons3sdl10initSdlLibFPS4croc5types10CrocThreadZv", referenced from:
  _D4croc3api10loadAddonsFPS4croc5types10CrocThreadkZv in croci.o
"_D4croc6addons2gl5GlLib4initFPS4croc5types10CrocThreadZv", referenced from:
  _D4croc3api10loadAddonsFPS4croc5types10CrocThreadkZv in croci.o
"_D4croc6addons2gl12__ModuleInfoZ", referenced from:
  _D4croc3api12__ModuleInfoZ in croci.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
--- errorlevel 1

I even tried to use Bud:

❯❯❯ cd bud-3.04/Source/
❯❯❯ make -f Makefile.unix
dmd -op -release -inline -ofbuild build.d util/pathex_bn.d util/pathex.d source_bn.d util/str.d build_bn.d util/booltype.d util/fdt_bn.d util/str_bn.d source.d util/fdt.d util/fileex.d util/fileex_bn.d util/linetoken.d util/linetoken_bn.d util/macro.d util/file2.d
build.d(56): Identifier expected following package
build.d(56): ';' expected
build.d(634): identifier expected following '.', not 'macro'
build.d(3348): identifier expected following '.', not 'macro'
source.d(55): Identifier expected following package
source.d(55): ';' expected
source.d(105): Identifier expected following package
source.d(105): ';' expected
source.d(483): identifier expected following '.', not 'macro'
util/macro.d(38): Identifier expected following package
make: *** [build] Error 1

Any advice?

JarrettBillingsley commented 11 years ago

I think your first commandline is the closest -- just take out croc/ex_bind.d. That one is mostly templates and as a result doesn't really work in a library. I also haven't updated it in a little while :P

JarrettBillingsley commented 11 years ago

I'm sorry I made it hard to build XD I really should be better about working on a dev branch and leaving master at a buildable point. It's just that for so long, there's really only been one other person even using Croc besides me!

grimnight commented 11 years ago

Using the following does create an executable, without errors:

❯❯❯ dmd croci.d -release -op -O -w -version=CrocBuiltinDocs -odobjdir -ofcroci croc/addons/devil.d croc/addons/devil_wrap.d croc/addons/gl.d croc/addons/gl_ext.d croc/addons/gl_wrap.d croc/addons/net.d croc/addons/pcre.d croc/addons/sdl.d croc/api.d croc/api_checks.d croc/api_debug.d croc/api_interpreter.d croc/api_stack.d croc/base_alloc.d croc/base_deque.d croc/base_gc.d croc/base_hash.d croc/base_metamethods.d croc/base_opcodes.d croc/base_writebarrier.d croc/compiler.d croc/compiler_ast.d croc/compiler_astvisitor.d croc/compiler_codegen.d croc/compiler_docgen.d croc/compiler_funcstate.d croc/compiler_lexer.d croc/compiler_parser.d croc/compiler_semantic.d croc/compiler_types.d croc/ex.d croc/ex_commandline.d croc/ex_doccomments.d croc/ex_format.d croc/ex_json.d croc/ex_library.d croc/ex_serialization.d croc/interpreter.d croc/serialization.d croc/stdlib_array.d croc/stdlib_ascii.d croc/stdlib_base.d croc/stdlib_compiler.d croc/stdlib_console.d croc/stdlib_debug.d croc/stdlib_docs.d croc/stdlib_env.d croc/stdlib_exceptions.d croc/stdlib_file.d croc/stdlib_gc.d croc/stdlib_hash.d croc/stdlib_json.d croc/stdlib_math.d croc/stdlib_memblock.d croc/stdlib_modules.d croc/stdlib_object.d croc/stdlib_os.d croc/stdlib_path.d croc/stdlib_serialization.d croc/stdlib_stream.d croc/stdlib_string.d croc/stdlib_stringbuffer.d croc/stdlib_text.d croc/stdlib_text_ascii.d croc/stdlib_text_codec.d croc/stdlib_text_latin1.d croc/stdlib_text_utf16.d croc/stdlib_text_utf32.d croc/stdlib_text_utf8.d croc/stdlib_thread.d croc/stdlib_time.d croc/stdlib_vector.d croc/types.d croc/types_array.d croc/types_class.d croc/types_funcdef.d croc/types_function.d croc/types_instance.d croc/types_memblock.d croc/types_namespace.d croc/types_nativeobj.d croc/types_string.d croc/types_table.d croc/types_thread.d croc/types_weakref.d croc/utf.d croc/utils.d croc/vm.d

But, I get:

❯❯❯ ./croci stdlibdocs.croc
[1]    21497 bus error  ./croci stdlibdocs.croc
❯❯❯ ./croci samples/ackermann.croc
[1]    21574 bus error  ./croci samples/ackermann.croc
❯❯❯ ./croci samples/beer.croc
[1]    21641 bus error  ./croci samples/beer.croc
❯❯❯ ./croci samples/simple.croc
[1]    21806 bus error  ./croci samples/simple.croc
❯❯❯ ./croci samples/wc.croc
[1]    21866 bus error  ./croci samples/wc.croc
❯❯❯ ./croci
[1]    21874 bus error  ./croci
JarrettBillingsley commented 11 years ago

Huh :v

I know OSX is really really picky about stuff like stack alignment (which is usually the cause of bus errors). Maybe DMD 1.056 is too buggy to be useful on it. I've never had a Mac to test on, and I think there was one guy who used it on OSX, years ago.

I'd guess it's DMD that's at fault here. Perhaps I can try using Tango trunk so that it can be compiled with a newer version of DMD.

ligustah commented 11 years ago

Just a side note: rdmd seemed to work well for compiling my croc stuff in the past.

JarrettBillingsley commented 11 years ago

Oh, cool, I had never even considered that!

On Tue, Jul 2, 2013 at 1:33 PM, Ligustah notifications@github.com wrote:

Just a side note: rdmd seemed to work well for compiling my croc stuff in the past.

— Reply to this email directly or view it on GitHubhttps://github.com/JarrettBillingsley/Croc/issues/91#issuecomment-20373987 .

grimnight commented 11 years ago

Any updates on this?

JarrettBillingsley commented 11 years ago

OH hey, what a coincidence! Sorry, real life stuff has been preventing me from working on Croc for quite some time now. But I was just looking at it again last night and was like "oh damn has it really been 6 months?"

Anyway I'd like to get back to working on it, even if it's only on the weekends cause I have a real job now. Also I now have a Mac I can test on! I don't think the boss would mind me doing so, anyway ;) But I think I'll try getting it working on Mac this weekend.

JarrettBillingsley commented 11 years ago

Alright the bus error is happening somewhere in the Tango unittests... so I'm guessing it really is just a version issue :P Let's see if I can get a newer version set up.

JarrettBillingsley commented 11 years ago

GOT IT

It now compiles and runs properly with DMD 1.076 and Tango r5713 (latest as of this writing) on OSX. Pull the latest Croc source. Assuming you already have DMD/Tango installed on your OSX box, you should be able to just do:

rdmd --build-only -ofcroci -release -O -w -version=CrocBuiltinDocs croci.d

:)

JarrettBillingsley commented 11 years ago

Note though that some stuff might be in flux/in-progress, so if you run into any issues, let me know ;P

JarrettBillingsley commented 11 years ago

Oh and.. when you get a chance to try it, if it works, feel free to close this ticket :)

grimnight commented 11 years ago

Thank you for your trouble. It works. I got the scripts in samples working, with the exception of a few (and the ones that use the addons):

$ ./croci ./samples/antimatroids.croc
Error: SyntaxException at ./samples/antimatroids.croc(15:41): ': or ;' expected; found 'in' instead

$ ./croci ./samples/beer.croc
Error: SyntaxException at ./samples/beer.croc(29:71): ': or ;' expected; found 'in' instead

$ ./croci ./samples/lmarkov.croc
Error: SyntaxException at ./samples/lmarkov.croc(9:20): 'Identifier' expected; found '(' instead

$ ./croci ./samples/markov.croc
Error: SyntaxException at ./samples/markov.croc(16:20): 'Identifier' expected; found '(' instead

Once again, thank you.

JarrettBillingsley commented 11 years ago

Ooh, yeah, some of those samples haven't been touched in a little while. I changed the array/table comprehension syntax, so that's what you're getting errors on.