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

#2909 is not enough. hard warning from meson #2917

Open
myungjoo opened this issue Feb 5, 2025 · 4 comments · May be fixed by #2922
Open

#2909 is not enough. hard warning from meson #2917

myungjoo opened this issue Feb 5, 2025 · 4 comments · May be fixed by #2922
Assignees

Comments

@myungjoo
Copy link
Member

myungjoo commented Feb 5, 2025

After #2909

[  271s] nntrainer/meson.build:62: WARNING: include_directories sandbox violation!
[  271s] The project is trying to access the directory '../third_party/ruy' which belongs to a different
[  271s] subproject. This is a problem as it hardcodes the relative paths of these two projects.
[  271s] This makes it impossible to compile the project in any other directory layout and also
[  271s] prevents the subproject from changing its own directory layout.
[  271s] 
[  271s] Instead of poking directly at the internals the subproject should be executed and
[  271s] it should set a variable that the caller can then use. Something like:
[  271s] 
[  271s] # In subproject
[  271s] some_dep = declare_dependency(include_directories: include_directories('include'))
[  271s] 
[  271s] # In subproject wrap file
[  271s] [provide]
[  271s] some = some_dep
[  271s] 
[  271s] # In parent project
[  271s] some_dep = dependency('some')
[  271s] executable(..., dependencies: [some_dep])
[  271s] 
[  271s] This warning will become a hard error in a future Meson release.
[  271s] 
[  271s] Configuring ccapi-ml-training.pc using configuration

Plus, ...

You are not building ruy or linking ruy. You are only including its header.

@djeong20
Copy link
Contributor

djeong20 commented Feb 6, 2025

Thank you for the notice @myungjoo! I understand the problem now. I'm attempting to build Ruy using a Meson subproject.

cmake = import('cmake')
ruy_proj = cmake.subproject('ruy')

The issue is that Ruy receives the same warning from Meson when dealing with the third party, resulting in a sandbox violation error. It works perfectly fine when building with CMake.

ruy| CMake project ruy 1.10.0 has 113 build targets.
ruy| Generated Meson AST: /home/donghyeon/nntrainer/build/third_party/ruy/meson.build
ruy| Project name: ruy
ruy| Project version: 1.10.0
ruy| C compiler for the host machine: cc (gcc 13.1.0 "cc (Ubuntu 13.1.0-8ubuntu1~20.04.2) 13.1.0")
ruy| C linker for the host machine: cc ld.bfd 2.34
ruy| C++ compiler for the host machine: c++ (gcc 13.1.0 "c++ (Ubuntu 13.1.0-8ubuntu1~20.04.2) 13.1.0")
ruy| C++ linker for the host machine: c++ ld.bfd 2.34
ruy| third_party/ruy:52: WARNING: include_directories sandbox violation!
The project is trying to access the directory 'third_party/googletest/googletest/include' which belongs to a different
subproject. This is a problem as it hardcodes the relative paths of these two projects.
This makes it impossible to compile the project in any other directory layout and also
prevents the subproject from changing its own directory layout.

Instead of poking directly at the internals the subproject should be executed and
it should set a variable that the caller can then use. Something like:

# In subproject
some_dep = declare_dependency(include_directories: include_directories('include'))

# In subproject wrap file
[provide]
some = some_dep

# In parent project
some_dep = dependency('some')
executable(..., dependencies: [some_dep])

This warning will become a hard error in a future Meson release.

ruy| third_party/ruy:52: WARNING: include_directories sandbox violation!
The project is trying to access the directory 'third_party/googletest/googletest' which belongs to a different
subproject. This is a problem as it hardcodes the relative paths of these two projects.
This makes it impossible to compile the project in any other directory layout and also
prevents the subproject from changing its own directory layout.

Instead of poking directly at the internals the subproject should be executed and
it should set a variable that the caller can then use. Something like:

# In subproject
some_dep = declare_dependency(include_directories: include_directories('include'))

# In subproject wrap file
[provide]
some = some_dep

# In parent project
some_dep = dependency('some')
executable(..., dependencies: [some_dep])

This warning will become a hard error in a future Meson release.

../third_party/ruy/meson.build:55:0: ERROR: Sandbox violation: Tried to grab file gtest-all.cc from a nested subproject.

What would be the best decision we can make in this situation?

@djeong20
Copy link
Contributor

djeong20 commented Feb 6, 2025

FYI, I'm currently using Meson version 1.7.99, which I believe is causing the warning to appear as an error. When I previously worked with Meson version 0.53.0, I was able to build Ruy successfully using Meson.

@piotrrak
Copy link

piotrrak commented Feb 13, 2025

Will need to split back subprojects and third_party directories. That will be sufficient.
Main culprit is that we use 'third_party' in two roles and

subproject_dir: 'third_party'
is culprit of this situation.

In my opinion we should move *.wrap files back to subprojects directory and use third_party for git modules, while ditching this option.

This will make meson happy as third_party directory will simply part of the tree.
@gkisalapl FYI

@djeong20
Copy link
Contributor

Hi @piotrrak,

Thank you for sharing your expertise! It looks like your suggestion resolves this issue.
I made the temporary change on #2922. Please take a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants