Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

g++ not found in omc on Eclipse for Mac OS X (10.6.x)

g++ not found in omc on Eclipse for Mac OS X (10.6.x)

After a lot of work getting OMC working correctly in Eclipse with MDT, I think I'm close.  I can load my mo file, load a model and check the model.  However, when I try to simulate it I get the following error:
omc> simulate(RLCcircuit, startTime=0, stopTime=20, numberOfIntervals=100)
record SimulationResult
    resultFile = "",
    simulationOptions = "startTime = 0.0, stopTime = 20.0, numberOfIntervals = 100, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'RLCcircuit', storeInTemp = false, noClean = false, options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false",
    messages = "Simulation failed for model: RLCcircuit
ERROR: Error writing to file RLCcircuit.cpp.
ERROR: Error writing to file RLCcircuit_functions.h.
ERROR: Error writing to file RLCcircuit_functions.cpp.
ERROR: Error writing to file RLCcircuit_records.c.
ERROR: Error writing to file RLCcircuit.makefile.
ERROR: Error writing to file RLCcircuit_init.txt.
ERROR: Error writing to file RLCcircuit.libs.
Error: Error building simulator. Buildlog: command g++ not found. Check $OPENMODELICAHOME
Error: Error building simulator. Buildlog: command \"/opt/openmodelica/share/omc/scripts/Compile\" not found. Check $OPENMODELICAHOME
",
    timeFrontend = 0.0,
    timeBackend = 0.0,
    timeSimCode = 0.0,
    timeTemplates = 0.0,
    timeCompile = 0.0,
    timeSimulation = 0.0,
    timeTotal = 0.0
end SimulationResult;
omc>

This if from within the OpenModelica Console within Eclipse version 3.6 running on Mac OS X.  I've installed openmodelica using the binary download so it's in /opt/openmodelica/ and has no spaces in the path.  I verified that the Compile script exists in the expected location (it does).  I also have g++ installed as part of the xcode install.  Running which g++ gets me:

/usr/bin/g++


Any help would be greatly appreciated as I've spent about a day getting MDT/OMC/etc. to this point and I feel I'm really close.  BTW, for those trying to get all this working on Mac OS X with OMC 1.6.0 and Eclipse, you need to set the OPENMODELICAHOME var such that eclipse recognizes it and you need to unset TMPDIR otherwise MDT will not correctly find and use OMC.

Thanks,
Martin

Re: g++ not found in omc on Eclipse for Mac OS X (10.6.x)

And the final key to the puzzle is:
OMShell, OMNotebook and OMEdit all call the command "cd("TMPDIR/OMEdit/")" or similar after startup. Because when you start a .app in OSX, the working directory is not writable.

I would not trust the simulate() command when it tells you g++ or Compile is not found (the checkSettings() command is more trustworthy).

Re: g++ not found in omc on Eclipse for Mac OS X (10.6.x)

without unsetting the TMPDIR environment variable I can't even get the OMC to load in Eclipse correctly.  What do you suggest?

Thanks,
Martin

Re: g++ not found in omc on Eclipse for Mac OS X (10.6.x)

Writing a patch to the MDT plugin to look in the system-wide temp-directory instead of assuming it is /tmp.

Re: g++ not found in omc on Eclipse for Mac OS X (10.6.x)

How have others gotten everything to work on Mac OS X?  Or is the patch you suggest an easy thing to do?

Re: g++ not found in omc on Eclipse for Mac OS X (10.6.x)

As far as I know, people unset TMPDIR to run MDT on OSX. OMNotebook also has issues on OSX (crashes if you open too large books).

Re: g++ not found in omc on Eclipse for Mac OS X (10.6.x)

I use Eclipse on OSX but have never managed to get as far as you have.   I unset TMPDIR and use Eclipse for it's editor and code completion only.  I use OMEdit (now that it behaves nicely with packages) to run, examine results and make minor edits. 

This means changing TMPDIR each time but that is the price to get the nice code completion of Eclipse plus the convenient output display of OMEdit.

There are 0 guests and 0 other users also viewing this topic
You are here: