HaxeFoundation / intellij-haxe

Haxe plugin for IntelliJ Platform based IDEs (IDEA, Android-Studio)
http://intellij-haxe.org
Apache License 2.0
219 stars 100 forks source link

Standard library not found #762

Open alexnauda opened 6 years ago

alexnauda commented 6 years ago

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 commented 6 years ago

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.

EricBishton commented 6 years ago

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. :/ )

alexnauda commented 6 years ago

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 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 has no field lime_image_encode /usr/local/lib/haxe/lib/lime/6,2,0/lime/graphics/format/PNG.hx Error:(105, 10) Class 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 commented 6 years ago

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.

mayakwd commented 6 years ago

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

chichilatte commented 6 years ago

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

JokerDen commented 6 years ago

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.

EricBishton commented 6 years ago

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

JokerDen commented 6 years ago

@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.
EricBishton commented 6 years ago

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

JokerDen commented 6 years ago

@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

jrmarkham commented 6 years ago

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

Vectorpark commented 6 years ago

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.

EricBishton commented 5 years ago

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.

kiloT commented 5 years ago

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)

Vectorpark commented 5 years ago

@kiloT Thank you, this worked!

kantaphat7 commented 2 years ago

me who still not work =(

EricBishton commented 2 years ago

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

MINCREFAT commented 1 year ago

Can I have the full folder/file path please?

MINCREFAT commented 1 year ago

Nevermind

MINCREFAT commented 1 year ago

Nope I do need the folder/file path

MINCREFAT commented 1 year ago

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

MINCREFAT commented 1 year ago

image

MINCREFAT commented 1 year ago

i found the folder ".lime"

MINCREFAT commented 1 year ago

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

MINCREFAT commented 1 year ago

fixed, i didnt have haxe fml

MINCREFAT commented 1 year ago

and still fml, not fixed

MINCREFAT commented 1 year ago

i cant get it to work and nobody likes me

MINCREFAT commented 1 year ago

i quit this page

MINCREFAT commented 1 year ago

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