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

Avoid for binaries that depend on HPX to directly link against internal modules #3828

Merged
merged 1 commit into from May 2, 2019

Conversation

hkaiser
Copy link
Member

@hkaiser hkaiser commented Apr 27, 2019

Currently we propagate link dependencies on the HPX module to any binary that depends on HPX. This is not necessary and not desirable. External binaries should depend on the HPX core binaries (libhpx and friends) only. At the same time however, external modules need to be able to find the header files of the modules as those might be indirectly included through HPX API headers. Thus the the corresponding include directories must be exported publicly.

@hkaiser hkaiser added this to the 1.3.0 milestone Apr 27, 2019
@hkaiser hkaiser added this to TODO in HPX modularization via automation Apr 27, 2019
@hkaiser hkaiser moved this from TODO to In Progress in HPX modularization Apr 27, 2019
src/CMakeLists.txt Show resolved Hide resolved
# integrate the hpx modules with the main library
set(_modules hpx_preprocessor)
foreach(_module ${_modules})
# add module binaries as PRIVATE dependencies to the core hpx library to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use HPX_LIBS instead of _modules here (

hpx/libs/CMakeLists.txt

Lines 8 to 11 in 18ab489

set(HPX_LIBS
preprocessor
CACHE INTERNAL "" FORCE
)
). Can definitely be renamed as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, fair point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, while the hpx target should link to all modules, hpx_init and hpx_wrap might not need to once we have more of them.

# add module include directories as PRIVATE to the hpx_init library to
# enable its compilation against indirectly included headers
get_target_property(_module_includes ${_module} INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(hpx_init PRIVATE ${_module_includes})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we explicitly not want to link against the modules? Same for hpx_wrap.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While compiling hpx_init (and hpx_wrap) the module include directories are needed. Applications using those libraries will see the include directories through the dependency on HPX itself.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant why would target_link_libraries(hpx_init PRIVATE ${_module}) not be enough?

Copy link
Member Author

@hkaiser hkaiser Apr 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. That should do the trick as well. The rationale for my change was that hpx_init and friends do not need to link against the modules, they only need to see the includes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Either is good, just wanted to make sure I understand since this is more code.

@msimberg
Copy link
Contributor

Looks good in general, but I'm wondering if you could give a bit more detail about where this becomes a problem? It must be in the build tree only, since we don't expose the modules from the installed config files. So tests and examples link unnecessarily to the internal modules?

@hkaiser
Copy link
Member Author

hkaiser commented Apr 29, 2019

Looks good in general, but I'm wondering if you could give a bit more detail about where this becomes a problem? It must be in the build tree only, since we don't expose the modules from the installed config files. So tests and examples link unnecessarily to the internal modules?

That was exactly the problem. The libraries where listed as (public and transitive) dependencies on the HPX libraries. Thus any binary that depends on HPX wanted to link against the modules as well.

@msimberg
Copy link
Contributor

Looks good in general, but I'm wondering if you could give a bit more detail about where this becomes a problem? It must be in the build tree only, since we don't expose the modules from the installed config files. So tests and examples link unnecessarily to the internal modules?

That was exactly the problem. The libraries where listed as (public and transitive) dependencies on the HPX libraries. Thus any binary that depends on HPX wanted to link against the modules as well.

Ok, sounds reasonable. Just to clarify, this didn't cause any compilation problems (on Windows?), it was just unnecessary? In other words, did we miss anything with our testing?

@hkaiser
Copy link
Member Author

hkaiser commented Apr 29, 2019

Ok, sounds reasonable. Just to clarify, this didn't cause any compilation problems (on Windows?), it was just unnecessary? In other words, did we miss anything with our testing?

I did see problems on CircleCI while building Phylanx. There ninja was complaining about not being able to find hpx_preprocessor.a even if libhpx.so depended on it.

@hkaiser hkaiser merged commit b566415 into master May 2, 2019
HPX modularization automation moved this from In Progress to Done May 2, 2019
@hkaiser hkaiser deleted the module_linking branch May 2, 2019 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants