haxe/c++ crash-and-burn in neko

244 views
Skip to first unread message

Christopher Vagnetoft

unread,
Jul 18, 2013, 2:47:52 PM7/18/13
to haxe...@googlegroups.com
Hi all,

I was hoping someone could tell me what is up with this. Tried making a project to build to both php and c++, and as it turned out the php one works but the c++ failed. Digging around, I found this when trying to invoke haxelib:

$ haxelib 
Segmentation fault

So, into GDB:
 
$ gdb haxelib
GNU gdb (GDB) 7.5.91.20130417-cvs-ubuntu
<snip>
This GDB was configured as "i686-linux-gnu".
<snip>
Reading symbols from /usr/bin/haxelib...
warning: the debug information found in "/usr/bin/neko" does not match "/usr/bin/haxelib" (CRC mismatch).

(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/haxelib 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0xb7f9b852 in neko_buffer_append_sub () from /usr/lib/libneko.so.0
(gdb) backtrace 
#0  0xb7f9b852 in neko_buffer_append_sub () from /usr/lib/libneko.so.0
#1  0xb7f9c52f in ?? () from /usr/lib/libneko.so.0
#2  0xb7fc91c4 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) 

Any ideas on how to fix this? Thanks in advance.

If it's useful, this is the build output:

$ haxe build-cpp.hxml -v
Classpath : ;/;./haxe/std/cpp/_std/;/usr/share/haxe/std/cpp/_std/;./haxe/std/;/usr/share/haxe/std/
Parsed /usr/share/haxe/std/StdTypes.hx
Parsed /usr/share/haxe/std/String.hx
Parsed /usr/share/haxe/std/Array.hx
Parsed /usr/share/haxe/std/cpp/_std/Std.hx
Parsed App.hx
Parsed MyClass.hx
Typing App.main
Parsed /usr/share/haxe/std/haxe/Log.hx
Parsed /usr/share/haxe/std/haxe/PosInfos.hx
Typing haxe.Log.trace
Typing MyClass.new
Typing Std.is
Typing Std.string
Typing Std.int
Typing Std.parseInt
Typing Std.parseFloat
Typing Std.random
Parsed /usr/share/haxe/std/StdTypes.hx
Parsed /usr/share/haxe/std/String.hx
Parsed /usr/share/haxe/std/Array.hx
Parsed /usr/share/haxe/std/Std.hx
Typing haxe.Log.clear
Generating Cpp in : cpp
Segmentation fault
End_of_file



Regards,
Chris

Cauê Waneck

unread,
Jul 18, 2013, 3:07:10 PM7/18/13
to haxe...@googlegroups.com
Did you build the neko binary yourself? There's still an open issue ( https://code.google.com/p/nekovm/issues/detail?id=31 ) on neko about building with newer gcc versions on linux 32-bit.

@ncannasse, the problem seems to be at https://github.com/HaxeFoundation/neko/blob/master/vm/jit_x86.c#L803 . Does anything look odd there?

Nicolas Cannasse

unread,
Jul 18, 2013, 5:00:23 PM7/18/13
to haxe...@googlegroups.com
Le 18/07/2013 21:07, Cau� Waneck a �crit :
Ah, interesting. Might be related to ABI requirements such as stack
alignment on 32 bytes. Could you confirm that running with -interp does
work?

Best,
Nicolas

Cauê Waneck

unread,
Jul 18, 2013, 5:05:49 PM7/18/13
to haxe...@googlegroups.com
I'm not sure if it's the exact problem as Christopher's, but for the issue #31, I can confirm that -interp mode will run correctly.


2013/7/18 Nicolas Cannasse <ncan...@gmail.com>


--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
--- You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/groups/opt_out.



Message has been deleted

Christopher Vagnetoft

unread,
Jul 19, 2013, 12:45:10 PM7/19/13
to haxe...@googlegroups.com
No luck replying (lost 2 replies so far) and no luck building, dpkg-buildpackage borks out with "Standard library not found". Neither stock (ubuntu repo) or homebuilt neko works here.

Christopher Vagnetoft

unread,
Jul 19, 2013, 12:48:34 PM7/19/13
to haxe...@googlegroups.com
Log from dpkg-buildpackage: http://pastebin.com/0gsAU1mK

Cauê Waneck

unread,
Jul 19, 2013, 12:59:25 PM7/19/13
to haxe...@googlegroups.com
Can you try the nekovm binaries available at http://nekovm.org/download ?
Also, the debian repo is still building a very old version of Haxe (2.07).


2013/7/19 Christopher Vagnetoft <cvagn...@gmail.com>
--

Christopher Vagnetoft

unread,
Jul 19, 2013, 1:16:35 PM7/19/13
to haxe...@googlegroups.com
No luck with the binaries either; replaced neko with the binaries from the link you provided and grabbed the latest haxe binaries as well.

noccy@christopher-desktop:/tmp/haxe$ ./haxe 
*** longjmp causes uninitialized stack frame ***: ./haxe terminated
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x63)[0xb7672bc3]
/lib/i386-linux-gnu/libc.so.6(+0x106a6a)[0xb7672a6a]
/lib/i386-linux-gnu/libc.so.6(__longjmp_chk+0x4b)[0xb76729db]
/usr/lib/libneko.so(+0xf8d2)[0xb732b8d2]
/usr/lib/libneko.so(neko_val_callEx+0x34f)[0xb7323e8f]
/usr/lib/libneko.so(neko_val_callN+0x3b)[0xb732424b]
./haxe[0x827e1f4]
./haxe[0x809935e]

ldd for haxe:

        linux-gate.so.1 =>  (0xb76e4000)
        libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb7699000)
        libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7656000)
        libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb7650000)
        libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb749d000)
        /lib/ld-linux.so.2 (0xb76e5000)

Additional details of relevance; 32-bit OS, Ubuntu 13.04. libc version is 2.17.
Message has been deleted

Cauê Waneck

unread,
Jul 22, 2013, 5:20:32 PM7/22/13
to haxe...@googlegroups.com
Hi!
Sorry, I forgot to answer your topic before.

So, avoid using apt-get as its very outdated. Also, I recommend very much that you use the standard /usr/lib/haxe and /usr/lib/neko locations for haxe and neko. Using non-default installation directories will make you configure a lot of environment variables by hand.

Here's the complete TODO:

- download neko from http://nekovm.org/download
- extract to /usr/lib/neko
- ln -s /usr/lib/neko/neko* /usr/bin
- ln -s /usr/lib/neko/libneko.so /usr/lib
neko is installed. Test with
neko
should show neko v2.0

For Haxe, I usually build from sources
- apt-get install git ocaml
- cd /usr/src
- ln -s /usr/src/haxe /usr/lib/haxe
- cd haxe
- make all
- make tools
- ln -s /usr/src/haxe/haxe* /usr/bin

haxe
Should display Haxe Compiler 3.1.0

And you're all set ;)

Let me know if you're still having trouble. It's probably better to uninstall apt-get versions.


2013/7/19 Christopher Vagnetoft <cvagn...@gmail.com>
I tried that as well, but neither homebuilt or ubuntu repository version changed the outcome.

Seems dpkg-buildpackage doesn't work either, also related to the standard library. Grabbed the source for this with apt-get source:

<snip>
Installing std.cmi
Installing std.cmx
<snip>
Installing extLib.a
Done.
> ocamlfind ocamlc  -I .. -I ../ extc_stubs.c
> ocamlfind ocamlopt -a -I .. -o extc.cmxa -cclib ../ocaml/extc/extc_stubs.o -cclib -lz extc.ml
> ocamlfind ocamlopt -a -o swflib.cmxa -I .. -I ../extc as3.mli as3hl.mli as3code.ml as3parse.ml as3hlparse.ml swf.ml actionScript.ml swfParser.ml
> ocamllex lexer.mll
127 states, 1206 transitions, table size 5586 bytes
> ocamlfind ocamlopt -c -cclib -fno-stack-protector -I ../ocaml -I ../ocaml/swflib -I /usr/lib/ocaml/xml-light -I ../ocaml/extc -I ../neko/libs/include/ocaml -linkpkg -package xml-light -pp camlp4o ast.ml lexer.ml type.ml common.ml parser.ml typecore.ml genxml.ml typeload.ml codegen.ml optimizer.ml ../neko/libs/include/ocaml/nast.ml ../neko/libs/include/ocaml/binast.ml ../neko/libs/include/ocaml/nxml.ml genneko.ml genas3.ml genjs.ml genswf8.ml genswf9.ml genswf.ml genphp.ml gencpp.ml interp.ml typer.ml main.ml
> ocamlfind ocamlopt -o ../bin/haxe -linkpkg -package xml-light ../ocaml/extLib.cmxa ../ocaml/extc/extc.cmxa ../ocaml/swflib/swflib.cmxa /usr/lib/ocaml/xml-light/xml-light.cmxa unix.cmxa str.cmxa ast.cmx lexer.cmx type.cmx common.cmx parser.cmx typecore.cmx genxml.cmx typeload.cmx codegen.cmx optimizer.cmx ../neko/libs/include/ocaml/nast.cmx ../neko/libs/include/ocaml/binast.cmx ../neko/libs/include/ocaml/nxml.cmx genneko.cmx genas3.cmx genjs.cmx genswf8.cmx genswf9.cmx genswf.cmx genphp.cmx gencpp.cmx interp.cmx typer.cmx main.cmx
/tmp/haxe-2.7+20110131/bin/haxe /tmp/haxe-2.7+20110131/haxe/std/tools/haxedoc/haxedoc.hxml
Standard library not found
make: *** [build-stamp] Error 1
dpkg-buildpackage: error: debian/rules build gave error exit status 2


On Thursday, July 18, 2013 9:07:10 PM UTC+2, Cauê Waneck wrote:
Did you build the neko binary yourself? There's still an open issue ( https://code.google.com/p/nekovm/issues/detail?id=31 ) on neko about building with newer gcc versions on linux 32-bit.

@ncannasse, the problem seems to be at https://github.com/HaxeFoundation/neko/blob/master/vm/jit_x86.c#L803 . Does anything look odd there?

--

Cauê Waneck

unread,
Jul 22, 2013, 5:21:19 PM7/22/13
to haxe...@googlegroups.com
ah you need also to use git submodule init / git submodule update after cloning the main repo


2013/7/22 Cauê Waneck <wan...@gmail.com>

Christopher Vagnetoft

unread,
Jul 24, 2013, 1:40:44 PM7/24/13
to haxe...@googlegroups.com
Thank you, that did the trick in regards to getting the neko/haxe/haxelib tools working again. The build process for the little c++ test app is however still not fully sorted:

haxelib run hxcpp Build.xml haxe -Ddebug -Dhaxe3="1" -Dhaxe_svn="1" -Dhaxe_ver="3.1"
Creating hxcpp.h.gch...
g++ -Iinclude -c -fvisibility=hidden -g -fpic -fPIC -DHX_LINUX -DHXCPP_DEBUG -m32 -I/usr/lib/haxe/lib/hxcpp/2,10//include -frtti -o hxcpp.h.gch /usr/lib/haxe/lib/hxcpp/2,10//include/hxcpp.h
g++ -I. -Iinclude -c -fvisibility=hidden -g -fpic -fPIC -DHX_LINUX -DHXCPP_DEBUG -m32 -I/usr/lib/haxe/lib/hxcpp/2,10//include -x c++ -frtti ./src/haxe/Log.cpp -oobj/linux-debug//src/haxe/Log.o
In file included from ./src/haxe/Log.cpp:4:0:
include/Std.h:11:39: error: expected initializer before ‘:’ token
Called from ? line 1
Called from BuildTool.hx line 1265
Called from BuildTool.hx line 554
Called from BuildTool.hx line 591
Called from BuildTool.hx line 710
Called from BuildTool.hx line 744
Called from BuildTool.hx line 200
Uncaught exception - Error : 1 - build cancelled
Error: Build failed


On Monday, July 22, 2013 11:20:32 PM UTC+2, Cauê Waneck wrote:
Hi!
Sorry, I forgot to answer your topic before.

So, avoid using apt-get as its very outdated. Also, I recommend very much that you use the standard /usr/lib/haxe and /usr/lib/neko locations for haxe and neko. Using non-default installation directories will make you configure a lot of environment variables by hand.

Here's the complete TODO: <snip>

mipalhash

unread,
Jul 27, 2013, 2:11:59 AM7/27/13
to haxe...@googlegroups.com


Hi,

thanks for the little but efficient tutorial
( Haxe 3 and haxelib 3 are now working on my Debian 6.07 Squeeze )

the handicap was the use of "Git" I never heard about before.

Michel

mipalhash

unread,
Jul 29, 2013, 9:48:17 AM7/29/13
to haxe...@googlegroups.com

Hi again,

during this week-end, I realized :

  - "cvs" --> haXe 1.x  ... cheat ! what is "cvs" ?
    - "svn" --> haXe 2.x  ... f..k ! what is "svn" ?
    - "github" --> Haxe 3.x  ... oh my ! where is ( my ) haxelib and what is "git" ?
   
probably, things went too fast;
outside ( a precompiled ) Haxe & Neko, I am lost.

working "Haxe & Neko" is enchantment;
"Lucky man" ( Emerson, Lake & Palmer ) we are ;)

thanks again,
Michel

Cauê Waneck

unread,
Aug 2, 2013, 3:05:15 PM8/2/13
to haxe...@googlegroups.com
Hi!
Sorry to take so long to answer. The issue there is that since you're at the latest git builds on haxe, you must also use the latest SVN hxcpp. You can do that like this:

cd /usr/src
haxelib dev hxcpp /usr/src/hxcpp

This should be enough to get it running

Cheers!
Cauê


2013/7/24 Christopher Vagnetoft <cvagn...@gmail.com>

Cauê Waneck

unread,
Aug 2, 2013, 3:07:39 PM8/2/13
to haxe...@googlegroups.com

  - "cvs" --> haXe 1.x  ... cheat ! what is "cvs" ?
    - "svn" --> haXe 2.x  ... f..k ! what is "svn" ?
    - "github" --> Haxe 3.x  ... oh my ! where is ( my ) haxelib and what is "git" ?

Those are all the version control systems (VCS) that Haxe has used throughout its history. You can read more about Version Control at https://en.wikipedia.org/wiki/Revision_control .

Cheers!
Cauê

mipalhash

unread,
Aug 4, 2013, 10:23:52 AM8/4/13
to haxe...@googlegroups.com

hi Cauê,

thanks for spending your time with us on this topic.
not so far from our topic, some days ago, i discovered a website
which promises a new era of shared software projects ( including Github ).

  https://pagekite.net/

as ingenuous, I actually only have a lot of interrogations about it :

  - is this technology the rebirth of our desktops ( decentralized web )
  - would this technology permit us to use and deploy everywhere "mod_neko" ( or mod_tora ) ?
  - is it a ( temporary ) viable solution ?
  - is it secure enough ?
  - could it be worth translating "pagekite.py" ( Python ) in "Pagekite.hx" ( Haxe )
  - what are the pros and cons of this technology ?
  - and so on ...

cheers,
Michel

Reply all
Reply to author
Forward
0 new messages