intellij-haxe icon indicating copy to clipboard operation
intellij-haxe copied to clipboard

Standard library not found

Open alexnauda opened this issue 7 years ago • 30 comments

I'm trying to use this plugin in a Mac and can't get a run config or debug config to work... IntelliJ 2017.2.2 Haxe Toolkit Support 0.11.2 OSX El Capitan 10.11.6 Haxe 3.4.5 Haxelib 3.3.0 openfl 7.1.2

After I installed the Haxe Toolkit Support plugin, I import a new project from sources (based on an openfl sample) and it detected Haxe sources and selected the Haxe 3.4.5 SDK. In Project Structure > Platform Settings > SDKs > Haxe 3.4.5, in the Classpath tab, it shows /usr/local/lib/haxe/std, which is where my std library is located.

I created a run configuration for the application (this is C++ target but I get the same thing with any target). When I try to run it I get:

Information:2/24/18, 4:19 PM - Compilation completed with 2 errors and 0 warnings in 69ms Error:Compilation failed /Applications/IntelliJ IDEA.app/Contents/bin Information:/usr/local/lib/haxe/haxe -main Main -debug -cp /Users/alex/w/WeatherGraph/Source -cpp .exe Information:Standard library not found Information:No additional error information available. Error: (Command exited with an error code) 1

I thought maybe I need to create a Haxe Library under Global Libraries for the std library. When I do that and add it under Dependencies, I get a different error:

Information:2/24/18, 4:29 PM - Compilation completed with 3 errors and 0 warnings in 145ms Error:Compilation failed /Applications/IntelliJ IDEA.app/Contents/bin Information:/usr/local/lib/haxe/haxe -main Main -debug -cp /Users/alex/w/WeatherGraph/Source -cp /usr/local/lib/haxe/std -cp /usr/local/lib/haxe/std -cpp .exe Information:No additional error information available. Error: (Command exited with an error code) 1 /usr/local/lib/haxe/std/Std.hx Error:(23, 7) Please don't add haxe/std to your classpath, instead set HAXE_STD_PATH env var

I do have the HAXE_STD_PATH env var set, under Preferences > Appearance & Behavior > Path Variables, to the same path (/usr/local/lib/haxe/std). Still doesn't work.

Any suggestions?

alexnauda avatar Feb 24 '18 21:02 alexnauda

Forgot to mention, this works fine if I run something like openfl test cpp or any other target, from either Terminal or as a bash run config in IntelliJ. So Haxe and openfl seem to be working fine on my machine; it's just the Haxe Toolkit Support plugin in IntelliJ that I can't figure out.

alexnauda avatar Feb 24 '18 21:02 alexnauda

This sounds like the known problem of things not working if you run IntelliJ IDEA via a launch icon. If you start idea from the same command shell/Terminal as your working project, then everything will work correctly. (IIRC, the path to start idea is /Applications/IntelliJ IDEA/Contents/bin/idea.sh)

The issue is that the command shell environment isn't used when starting from an icon (or the launcher); only a minimal environment is passed to IDEA. To get the same environment that you set up for your command shell, you have to start IDEA from a command shell.

We've been thinking about adding the extra data needed to the SDK configuration. We haven't gotten to that yet.

(BTW. I'm sure that there are at least two other bugs that address this issue, but I can't find them at the moment. :/ )

EricBishton avatar Feb 27 '18 01:02 EricBishton

Starting it from the command line after exporting HAXE_STD_PATH does get past that error, but I still can't get it working. I still get "Unresolved symbol..." and "Unresolved type" errors in the editor. Debugging with the C++ target now gives me: Error:(2, 7) Type not found : openfl.events.Event

I tried adding openfl 7,1,2 and lime 6,2,0 to the classpath of the SDK, which removes the "Unresolved symbol..." and "Unresolved type" errors in the editor, but doesn't change the behavior of the Debug build.

I added Global Library entries for openfl 7,1,2 and lime 6,2,0 and added those as dependencies to the project, and I get a new error: /usr/local/lib/haxe/lib/lime/6,2,0/lime/system/System.hx Error:(322, 14) Class<lime._backend.native.NativeCFFI> has no field lime_system_get_timer /usr/local/lib/haxe/lib/lime/6,2,0/lime/graphics/format/JPEG.hx Error:(105, 10) Class<lime._backend.native.NativeCFFI> has no field lime_image_encode /usr/local/lib/haxe/lib/lime/6,2,0/lime/graphics/format/PNG.hx Error:(105, 10) Class<lime._backend.native.NativeCFFI> has no field lime_image_encode

Am I missing some other settings, either in environment variables or in the plugin preferences or the module settings?

alexnauda avatar Mar 18 '18 15:03 alexnauda

I got the debugger working using the openfl Flash target and following the instructions here: https://www.youtube.com/watch?v=kvFg1Zee4h4

And still starting IntelliJ from the shell as you suggested, after exporting HAXE_STD_PATH.

alexnauda avatar Mar 18 '18 20:03 alexnauda

@alexnauda, good job! @EricBishton, I guess we need add such things into FAQ.

mayakwd avatar Mar 19 '18 06:03 mayakwd

Thanks for yr help, i had this problem too. Here's a handy stackoverflow answer on how to set a global environment variable on OSX... https://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x#588442

chichilatte avatar Apr 05 '18 10:04 chichilatte

Still can't get it to work. Here my variable path image I'm starting Idea using Terminal line /Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea which is executed from project directory. It is so frustrating, please help.

JokerDen avatar May 27 '18 14:05 JokerDen

@JokerDen Try things in this order:

  1. Make sure that you can get a "Hello World" app to build and run outside of IntelliJ.
  2. From that working command shell, start IDEA.
  3. Make sure that "/usr/local/lib/haxe/std" is the first and only entry in both the Classpath and Sourcepath tabs for your Haxe SDK (File->Project Structure...->SDKs).
  4. Make sure that your project is pointing at the Haxe SDK.

As far as the Path Variables that you reference in your screen shot, I don't think that the plugin is paying attention to that (but we probably should be).

There is a working example project using hxcpp and hxcpp-debugger on Windows at: https://github.com/HaxeFoundation/intellij-haxe/tree/master/ExampleProjects/HxcppDebugging I will test that on Mac shortly.

EricBishton avatar Jun 07 '18 17:06 EricBishton

@EricBishton Thanks for reply.

  1. Works fine via terminal.
  2. I'm not sure that I'm doing that right. Is it mean that I must just launch IDEA via terminal? I'm using the line /Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea.
  3. It's so.
  4. Yes, it is pointing.

JokerDen avatar Jun 08 '18 10:06 JokerDen

@jokerden Please post screen shots of your project and module configurations (all tabs). Also post the contents of the messages pane (at least the first half dozen lines and the relevant error messages from the compiler).

EricBishton avatar Jun 08 '18 16:06 EricBishton

@EricBishton Here they are (sorry for uncropped images):

screen shot 2018-06-08 at 20 34 09 screen shot 2018-06-08 at 20 34 34 screen shot 2018-06-08 at 20 34 38 screen shot 2018-06-08 at 20 34 42 screen shot 2018-06-08 at 20 34 46 screen shot 2018-06-08 at 20 34 51 screen shot 2018-06-08 at 20 34 53 screen shot 2018-06-08 at 20 37 07

JokerDen avatar Jun 08 '18 17:06 JokerDen

@EricBishton I have the exact same issue and my setup is identical to @JokerDen l. I added the environment var to IntelliJ and launchd.conf. I also tried launching Intellij via the terminal too. Now if I Install (with IntelliJ open) Have 3.4.4 and run the Haxelib setup and update the SDK in the project the project will build no problem. I sent you an email too... and we had a brief chat.

jrmarkham avatar Jul 04 '18 23:07 jrmarkham

I just want to confirm jrmarkham's solution. I had the exact same problem (standard library not found) and identical paths setup in the IDE and launchd.conf.

Reverting from Haxe 3.4.7 to Haxe 3.4.4 resolved the problem.

Vectorpark avatar Jul 07 '18 16:07 Vectorpark

Re-opening because it seems like a few people have been running into this again. Though the issue appears to be related to the Haxe version now, not just the Mac environment.

EricBishton avatar Jan 10 '19 21:01 EricBishton

I found a way to fix it. You just need to add path to std lib in lime config. In my case it was /usr/admin/.lime/config.xml Hope it helps to somebody=) image (1)

kiloT avatar Jun 05 '19 10:06 kiloT

@kiloT Thank you, this worked!

Vectorpark avatar Jun 05 '19 15:06 Vectorpark

me who still not work =(

kantaphat7 avatar Nov 23 '21 08:11 kantaphat7

@kantaphat7 We can't possibly begin to help you without knowing the problem you are having. Let's have some particulars, please:
What error message are you seeing? Which IDE? What Version? Which OS? What Version? Which version of Haxe?
Which version of the plugin? What is in your environment? (Go to the console within the IDE and run "set". Paste the output.)

EricBishton avatar Nov 24 '21 01:11 EricBishton

Can I have the full folder/file path please?

MINCREFAT avatar May 02 '23 00:05 MINCREFAT

Nevermind

MINCREFAT avatar May 02 '23 00:05 MINCREFAT

Nope I do need the folder/file path

MINCREFAT avatar May 02 '23 00:05 MINCREFAT

If I use command prompt its "Standard library not found. You may need to set your HAXE_STD_PATH environment variable" error message

MINCREFAT avatar May 02 '23 00:05 MINCREFAT

image

MINCREFAT avatar May 02 '23 00:05 MINCREFAT

i found the folder ".lime"

MINCREFAT avatar May 02 '23 00:05 MINCREFAT

ok now i have another error 'Error: "C:\Users\my user is not gonna be here\ .lime\config.xml" contains invalid XML data'

MINCREFAT avatar May 02 '23 00:05 MINCREFAT

fixed, i didnt have haxe fml

MINCREFAT avatar May 02 '23 03:05 MINCREFAT

and still fml, not fixed

MINCREFAT avatar May 02 '23 03:05 MINCREFAT

i cant get it to work and nobody likes me

MINCREFAT avatar May 02 '23 03:05 MINCREFAT

i quit this page

MINCREFAT avatar May 02 '23 03:05 MINCREFAT

I found a way to fix it. You just need to add path to std lib in lime config. In my case it was /usr/admin/.lime/config.xml Hope it helps to somebody=) image (1)

it wont work @kiloT

MINCREFAT avatar May 02 '23 03:05 MINCREFAT