Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install openstudio to bin directory so it can be found relative to lib #699

Merged
merged 3 commits into from
Mar 28, 2024

Conversation

macumber
Copy link
Collaborator

@macumber macumber commented Mar 26, 2024

Install openstudio to bin directory so it can be found relative to lib, fixes #695

Basically, the openstudio CLI loads the libs from the lib folder, then getOpenStudioCLI looks for the CLI based on the libs paths.

@macumber
Copy link
Collaborator Author

macumber commented Mar 26, 2024

@jmarrec this seems like the best thing to do in the short term. We can try to find a better fix later but the layout in the OpenStudio Application install has to match what getOpenStudioCLI is expecting. My thought was we should add an environment variable that the app could use to pass the path into getOpenStudioCLI. Or just check if the current binary is the openstudio CLI and use that....

@macumber
Copy link
Collaborator Author

@jmarrec I'll go ahead and merge this tomorrow unless you object

@jmarrec
Copy link
Collaborator

jmarrec commented Mar 27, 2024

I don't want to make a copy of the executable. It's big. We should symlink instead.

@jmarrec
Copy link
Collaborator

jmarrec commented Mar 27, 2024

Hum, the CLI is only 3 MB now that it doesn't statically link ruby. That's not too bad.

but I still went ahead (before I realized it was only 3 MB) and tried to make the symlink approach work. The arm64 build failed, not sure if related. My mac needs a Qt upgrade to build and I'm on slow internet, so I'll try again later today once it's installed. If I can make it work under 30 min, I'll do it, otherwise I'll revert back to your changes.

@macumber
Copy link
Collaborator Author

I think the right way to fix this would be to move the content of the lib folder into the Mac bundle, the idea is you can move the bundle around and it still works. However, the Mac bundle doesn't use a bin, lib layout. The important thing is that the openstudio CLI be located relative to the lib files as expected here https://github.com/NREL/OpenStudio/blob/develop/src/utilities/core/ApplicationPathHelpers.cxx.in

@jmarrec
Copy link
Collaborator

jmarrec commented Mar 27, 2024

Tested locally on my mac after installing the dmg:

$ pwd
/Applications/OpenStudioApplication-1.7.0-test/bin
$ ls -la
total 304
drwxr-xr-x   4 julien  admin     128 Mar 27 14:36 .
drwxr-xr-x  20 julien  admin     640 Mar 27 15:20 ..
-rwxr-xr-x   1 julien  admin  152432 Sep 27  2023 install_utility
lrwxr-xr-x   1 julien  admin      46 Mar 27 14:36 openstudio -> ../OpenStudioApp.app/Contents/MacOS/openstudio
$ ./openstudio --version
3.7.0+d5269793f1

Running the test_os_cli from #695 (comment)

Class Name: TestGetOpenStudioCLI
Measure Type: ModelMeasure
Measure Language: Ruby
Current step has 0 arguments
argumentMap={}
Searching for CLI in '/Applications/OpenStudioApplication-1.7.0-test/lib/../openstudio'
Searching for CLI in '/Applications/OpenStudioApplication-1.7.0-test/lib/../bin/openstudio'
Found CLI at '/Applications/OpenStudioApplication-1.7.0-test/OpenStudioApp.app/Contents/MacOS/openstudio'
OpenStudio.getOpenStudioCLI=/Applications/OpenStudioApplication-1.7.0-test/OpenStudioApp.app/Contents/MacOS/openstudio
Step Result: Success
Finished applying OpenStudio Measures.

@macumber
Copy link
Collaborator Author

@jmarrec this works for me, changes to fully self-contain the bundle would be too high risk right now

@macumber macumber merged commit ad34c9c into develop Mar 28, 2024
8 checks passed
@macumber macumber deleted the fix_695 branch March 28, 2024 04:07
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when running Create Typical Building from Model Measures
2 participants