Apostolos
Apostolos

Reputation: 8121

Haxe can't find std libraries

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...

Upvotes: 5

Views: 5634

Answers (2)

JRichardsz
JRichardsz

Reputation: 16574

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

Upvotes: 1

John Ink
John Ink

Reputation: 526

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.

Upvotes: 2

Related Questions