how to configure data dir

261 views
Skip to first unread message

Chris Kees

unread,
Nov 19, 2016, 1:46:58 PM11/19/16
to ProjectChrono
Hi,

I always get these sorts of warnings when running the demos:

Could not load font because the file does not exist: ../data/fonts/arial8.xml
Could not open file of texture: ../data/logo_chronoengine_alpha.png
Could not open file of texture: ../data/skybox/sky_lf.jpg
Could not open file of texture: ../data/skybox/sky_dn.jpg
Could not open file of texture: ../data/skybox/sky_up.jpg
-

I hacked my tutorial setup to properly find the data dir, but I'm wondering if there's a way to fix this at the cmake configuration phase or with an environment variable. My install root is  ./linux2 so the demos are in ./linux2/bin and the data is in ./linux2/share/data.

Thanks,
Chris

Radu Serban

unread,
Nov 20, 2016, 4:34:59 AM11/20/16
to projec...@googlegroups.com

Hi Chris,

This is a bug that was introduced recently in an attempt to formalize the installation directories to use standard targets on a *nix system.  Unfortunately, that broke the installed demos which cannot find the installed Chrono data files.

We will work on a proper fix for this.

Thanks,
Radu

--
You received this message because you are subscribed to the Google Groups "ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email to projectchron...@googlegroups.com.
To post to this group, send email to projec...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Radu Serban

unread,
Nov 23, 2016, 9:23:13 AM11/23/16
to projec...@googlegroups.com

Chris,

I just pushed a fix to this issue.  With this, the various install directories should be as follows:

Windows:
include headers:  ${prefix}/include
libraries: ${prefix}/lib64
runtime files: ${prefix}/bin    (this is for the Chrono DLLs)
data files: ${prefix}/data
demo executables: ${prefix}/bin
     
Linux:
include headers:  ${prefix}/include
libraries: ${prefix}/lib64
runtime files: ${prefix}/bin    (nothing should go there on Linux)
data files: ${prefix}/share/chrono/data
demo executables: ${prefix}/share/chrono/bin

Note that the Chrono demos are no longer installed under ${prefix}/bin/ on a Linux system (not an appropriate place for mere demos, especially if using the default installation target /usr/local/).

The project configuration scripts (ChronoConfig.cmake) were also fixed to properly reflect the new locations of the 'data' directory.

Please let me know if you see any other issues related to this.

Thanks,
Radu
Message has been deleted

lz shu

unread,
May 25, 2017, 9:20:40 PM5/25/17
to ProjectChrono
Hi Chris,
I had the same problem on windows, and a forcible way for solving this is put the data dir on the following directories:
1.  Chrono_build/src/demos/vehicle
2. Chrono_build/src/demos
This may not be the best way but the simplest one. And it works. I think it is the same on linux.
Thanks,
lz

在 2016年11月20日星期日 UTC+8上午2:46:58,Chris Kees写道:

Radu Serban

unread,
May 26, 2017, 5:11:01 AM5/26/17
to projec...@googlegroups.com
Hi LZ,

The Chrono data directory should be copied automatically at CMake configuration time from the source tree into the build tree, under <chrono_build>/bin/data/ (Windows) and <chrono_build>/data/  (Linux).   What you did works because the default is for all Chrono demos to look for data files with a relative path ../data/ (and, on Windows binaries are created in <chrono_build>/bin/Release/, <chrono_build>/bin/Debug/, etc., depending on the build type, while on Linux all binaries are created in <chrono_build>/bin/).

Can you check if the data files are in the above location in the build tree?

One last question: are you talking about the demos provided with Chrono not being able to find the data files?  Or are you talking about your own project that links to Chrono?

--Radu
--

lz shu

unread,
May 26, 2017, 8:13:38 AM5/26/17
to ProjectChrono
Hi Radu,

Thanks for your timely reply and exhaustive explanation. First of all, what I'm talking about are the demos provided with Chrono. 

After CMake configuration,  I compiled Chrono(ALL_BUILD) on Visual Studio 2013 on both debug mode and release mode without any change. And actually,  the data files were automatically copied under <chrono_build>/bin/data/. However, when I used debug mode(F5) to run a specific demos on Visual Studio, it told me those warnings just like Chris'. 

So, I thought the data files must be lost on the relative path, and when I copied the data files on those two paths(<chrono_build>/src/demos/data and <chrono_build>/src/demos/data/vehicle/data), it loaded fonts and texture successfully, and demos that the files' name beginning with demo_IRR or demo_VEH could display normally. 

Still, I don't know why it works.

So, I'd appreciate any information you could give me.

Sincerely,
LZ Shu


在 2017年5月26日星期五 UTC+8下午5:11:01,Radu Serban写道:

Radu Serban

unread,
May 26, 2017, 8:56:56 AM5/26/17
to projec...@googlegroups.com

When you run from within Visual Studio, you must properly set the "Working Directory"  which is by default $(ProjectDir):

  • right click on your project (the demo you want to debug/run using F5 or Ctrl+F5) in the Solution Explorer, select Properties
  • go to 'Configuration Properties->Debugging'
  • change 'Working Directory' to $(OutDir)

Unfortunately, this property is not stored in the Visual Studio project files, so there is no way to set it through CMake.

--Radu

Shubhankar Kulkarni

unread,
Jun 24, 2022, 6:33:37 PM6/24/22
to ProjectChrono
Hello Radu,

While working on a project generated on my own that uses chrono api, I'm facing the same issue as Chris.
I'm using VS 2022 on Windows to build the project and have modified the "Working Directory" as you mentioned above to $(OutDir) and have my data folder in the directory of .exe as well as in my src.
I'm right now trying to set the absolute path in the target_compile_definitions of CMakeLists.txt for "CHRONO_DATA_DIR" but running into some parsing issues while building.
What approach should I take?

Thanks,
Shubhankar

Shubhankar Kulkarni

unread,
Jun 24, 2022, 7:08:07 PM6/24/22
to ProjectChrono
I was looking through my build output, I'm seeing the CHRONO_DATA_DIR to be pointing to the chrono src even though I've built my folder to be outside the default src in a seperate directory
CHRONO_DATA_DIR          (Path to Chrono data folder): C:/Chrono Workspace/chrono-develop-SRC/data/
My other includes from the chrono src are getting picked except this one directory.

Radu Serban

unread,
Jun 26, 2022, 4:06:04 AM6/26/22
to ProjectChrono

Shubhankar,

 

The mention of CHRONO_DATA_DIR indicates that your situation is not the same as the one I discussed in that reply back in 2017.

 

You are building a separate project and link to the Chrono libraries.  Based on what you get for CHRONO_DATA_DIR, I take it you are linking against the Chrono build directory, as opposed to an install directory.  In this case, it is indeed intended to point to the data/ directory in the Chrono source tree.

 

You must make an explicit call to the function chrono::SetChronoDataPath() and pass it the path contained in that CMake variable.  See my_example.cpp in the Chrono distribution (under “template_project”).

 

If you already do this, there must be some other problem.  You mention “some parsing issues while building”.  Could you provide more details?  Maybe it has to do with the space in this path, within “Chrono Workspace”.

 

--Radu

Shubhankar Kulkarni

unread,
Jul 7, 2022, 12:26:01 AM7/7/22
to ProjectChrono
Radu,

Thanks for pointing to the workaround. It worked for me.

Sincerely,
Shubhankar

Reply all
Reply to author
Forward
0 new messages