5

I am trying to setup Haxe with IntelliJ and my Linux box. I downloaded Linux 64bit binaries from haxe(haxe 3.1.3) site and community edition intellij. I installed Haxe plugin in intellij and then created a new Haxe Module. For sdk I picked the haxe folder I donwloaded from haxe site. I created a new configuration to compile and run but It gives me an error that It can't locate standard library. Why is that happenning?

Haxe Directory Tree

haxe-3.1.3
├── extra
└── std
    ├── cpp
    ├── cs
    ├── flash
    ├── flash8
    ├── haxe
    ├── java
    ├── js
    ├── neko
    ├── php
    ├── sys
    └── tools

haxe-3.1.3 was the directory I chose for haxe toolbox in intellij. Creating a new Haxe project lets me choose Haxe 3.1.3 (meaning that toolkit is set up correctly since its recognized). External Libraries in intellij project includes Haxe dir with std (when expanding the folder to see what it contains).

In "Project structure" dialog in the SDK i see that libraries are setup correctly (haxe-3.1.3/std) and the haxe executable also(haxe-3.1.3/haxelib). Classpath contains the Library directory

When I compile it using openFl and with flash as target I get the following error

Error:compilation failed
/home/avlahop/development/Haxe/haxe-3.1.3/haxelib
Error:libneko.so: cannot open shared object file: No such file or directory

When I switch to Haxe compiler and Neko or Javascript I get the following

Information:Compilation completed with 1 error and 1 warning in 0 sec
Information:1 error
Information:1 warning
Error:compilation failed
Warning:Standard library not found

My Class

package ;
class Test3 {
    public function new() {
    }

    public static function main(): Void{
        trace("Hello from haxe and IntelliJ IDEA");
    }
}

I really want to get in to it but cannot start...

Apostolos
  • 7,763
  • 17
  • 80
  • 150

2 Answers2

2

Manually go into /usr/lib and look for libneko.so. Sometimes installs might throw a one at the end or something aka libneko.so.1.

Rename the file correctly. You may have to use a newer version of neko, I had to compile from the git to get it to work: https://github.com/HaxeFoundation/neko

If you don't notice anything off, make sure your environment variables are correct. Open up /etc/environment in the text editor of your choosing

export HAXE_STD_PATH=/usr/local/haxe/std:. # path to std + :.
export HAXE_HOME=/usr/whatever/haxe        # path to haxe
export NEKOPATH=/usr/local/neko            # path to neko

Note that if you used HAXE_LIBRARY_PATH, that's been changed to HAXE_STD_PATH in later versions of Haxe. You also need the reference to this file, open your /etc/profile with sudo and check for:

. /etc/environment

That's all I got. Hope it works out for you.

John Ink
  • 486
  • 3
  • 6
  • Didn't Install anything, binaries got downloaded and unziiped unzipped and just told IntelliJ where Haxe SDK is.... – Apostolos Nov 09 '14 at 15:19
  • 2
    You probably need to look up an install guide then, or use the install script here http://www.openfl.org/documentation/setup/install-haxe/ – John Ink Nov 09 '14 at 16:32
  • Now I get the following error when trying to get to export to javascript Error running Helloworld: Wrong target JavaScript! You can run only Neko, Flash or JavaScript.And when i user openfl it says I need lime to install...How can I install lime?Haxe to neko works perfectly – Apostolos Nov 09 '14 at 16:56
  • How are you compiling? On that same link, they have a guide for lime. Or, Haxelib is a program that runs like apt-get. Run "haxelib install lime" – John Ink Nov 10 '14 at 00:21
  • Yes yes I show it and installed. OpenFl and neko work great...I can't target javascript... – Apostolos Nov 10 '14 at 10:21
  • How are you compiling? If you type "haxe -main ClassName -js Export.js" in the folder you want, it should compile. If that works, then its a problem with your setup in intelliJ – John Ink Nov 10 '14 at 13:59
  • It does create the out.js file even when compiling from intellij..Not sure wha the problem is – Apostolos Nov 10 '14 at 14:51
  • try js.lib.alert() instead of trace, or try embedding the js in an html page. Simply running it will give you console errors. http://old.haxe.org/doc/start/js – John Ink Nov 10 '14 at 15:33
1

Based on @johnink anwser, this work for me in linux commandline mode :

I downloaded linux binaries from https://haxe.org/download/ and uncompress in some path like

/some/folder/haxe-tool

I added this lines to my ~/bashrc

export HAXE_STD_PATH="/some/folder/haxe-tool/std"
export HAXE_HOME="/some/folder/haxe-tool"
export PATH=$PATH":"$HAXE_HOME

And tested with this cmd:

haxe -main HelloWorld --interp

Also I converted to javascript with this cmd

haxe -js HelloWorld.js -main HelloWorld

Using this file :

class Main {
  static public function main():Void {
    trace("Hello World");
  }
}

Following the "Hello World" example :

https://code.haxe.org/category/beginner/hello-world.html

JRichardsz
  • 14,356
  • 6
  • 59
  • 94