rbplusplus icon indicating copy to clipboard operation
rbplusplus copied to clipboard

RuntimeError: Unable to find a castxml executable on your PATH

Open Victorcorcos opened this issue 7 years ago • 6 comments

After executing this simple example...

Extension.new "mu_parser" do |ext|
  ext.sources 'equations-parser/parser/*.h'
end

I'm getting this error message: RuntimeError: Unable to find a castxml executable on your PATH. Which means the PATH for the castxml is wrong.

How can I set up the PATH for the castxml for the rbplusplus sources call?

For the RbGCCXML gem I can set up the PATH via castxml_path...

RbGCCXML.parse("equations-parser/parser/mpParser.hpp", :castxml_path => 'castXMLSuperbuild-build/castxml/bin/castxml') 

However, I cannot do the same to the rbplusplus gem, am I wrong?

Victorcorcos avatar May 04 '18 07:05 Victorcorcos

It looks like I did miss exposing that through rb++. Thanks for the report, I will look into making more parser options available through this library. In the mean time, you can work around this by adding the castxml binary to your PATH, either locally or globally. E.g.

# Globally:
export PATH=$PATH:/path/to/castXMLSuperbuild-build/castxml/bin/
# Locally
PATH=$PATH:/path/to/castXMLSuperbuild-build/castxml/bin/ ruby extension.rb

jasonroelofs avatar May 04 '18 12:05 jasonroelofs

@jasonroelofs Thanks for the quick reply! Yep, the export PATH=$PATH:/path/to/castXMLSuperbuild-build/castxml/bin/ is working very well here. I searched over the RbGCCXML inner code and I discovered that if we place the binary on the same directory as the ruby on rails, there is no need to set a PATH, right?

I did that, but an error appears: cannot load castxml resources. Do you know what is this and how to fix? Thanks!

Victorcorcos avatar May 04 '18 12:05 Victorcorcos

It's probably not a good idea to move the castxml binary itself. That error is probably due to other files that exist within /path/to/castXMLSuperbuild-build/castxml/ that the tool needs to function that it can no longer find when the binary lives elsewhere.

jasonroelofs avatar May 04 '18 12:05 jasonroelofs

Ok, thanks! 👍

The perfect scenario would be a more robust way to find castxml binary file without the need to set up the PATH or the :castxml_path all the time.

Victorcorcos avatar May 04 '18 13:05 Victorcorcos

Unfortunately the only other option would be to scan the user's entire computer for files that look like they could be castxml, which is not a good thing to do. The standards are that PATH is set right, or a manual path is configured in the settings. There's not much more I can really do to make that easier.

jasonroelofs avatar May 04 '18 13:05 jasonroelofs

Ok! Therefore, at least the first solution to expose the castxml_path through rb++ would be a really nice improvement, since we don't need to fill the whole full directory path via $PATH.

My idea is to make possible to pass castxml_path parameter to the rb++ sources method, like we do in the RbGCCXML.parse :) :castxml_path => 'castXMLSuperbuild-build/castxml/bin/castxml'.

Victorcorcos avatar May 04 '18 13:05 Victorcorcos