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

Wrong library order in pkgconfig #976

Closed
eschnett opened this issue Oct 21, 2013 · 5 comments

Comments

Projects
None yet
2 participants
@eschnett
Copy link
Contributor

commented Oct 21, 2013

When integrating HPX with Cactus, I build HPX not with cmake, but by querying pkgconfig for build and link options. In particular, I use "pkg-config hpx_application --libs-only-other" to get the list of libraries necessary for linking. This leads to

HPX_LIBS     = -lhpx -lhpx_init -lhpx_serialization -lboost_date_time -lboost_filesystem -lboost_program_options -lboost_regex -lboost_serialization -lboost_system -lboost_thread -lboost_atomic -lboost_chrono -lmpi_cxx -lmpi -lopen-rte -lopen-pal -lnsl -lutil -lm -ldl

This leads to the linker error

/xfs1/eschnetter/compute/Cbeta/configs/hpx-debug/scratch/external/HPX/include/hpx/hpx_init_impl.hpp:29: error: undefined reference to 'hpx::init(int (*)(boost::program_options::variables_map&), boost::program_options::options_description const&, int, char**, std::vector<std::string, std::allocator<std::string> > const&, hpx::util::function_nonser<void ()> const&, hpx::util::function_nonser<void ()> const&, hpx::runtime_mode)'

I checked; this function is defined in the dynamic library hpx, and is called from a function in the static library hpx_init. Thus I assume that the order of libraries should maybe be

hpx hpx_init hpx

i.e. that "hpx" should be repeated.

@hkaiser

This comment has been minimized.

Copy link
Member

commented Oct 21, 2013

Does it link if you manually supply the libraries in the order you suggested? I thought that the times were a linker only forward-resolves symbols from libraries are long gone, but I might be wrong...

@eschnett

This comment has been minimized.

Copy link
Contributor Author

commented Oct 21, 2013

I haven't corrected the problem yet. My first approach would be to simply duplicate the library list that pkgconfig suggests.

No, these times are not over, this is still very much the Unix standard. Certain linkers have options to avoid this, e.g. --whole-archive or --begin-group/--end-group for GNU binutils, but this is not portable.

@eschnett

This comment has been minimized.

Copy link
Contributor Author

commented Oct 21, 2013

(I am using the fixing_588 branch.)

I did not look at the undefined closely enough. The undefined reference is to

/xfs1/eschnetter/compute/Cbeta/configs/hpx-debug/scratch/external/HPX/include/hpx/hpx_init_impl.hpp:29: error: undefined reference to 'hpx::init(int (*)(boost::program_options::variables_map&), boost::program_options::options_description const&, int, char**, std::vector<std::string, std::allocator<std::string> > const&, hpx::util::function_nonser<void ()> const&, hpx::util::function_nonser<void ()> const&, hpx::runtime_mode)'

and this function does indeed not exist in any HPX library generated on my system.

The function that is provided and that confused me is

0000000000bc1230 T hpx::init(hpx::util::function_nonser<int (boost::program_options::variables_map&)> const&, boost::program_options::options_description const&, int, char**, std::vector<std::string, std::allocator<std::string> > const&, hpx::util::function_nonser<void ()> const&, hpx::util::function_nonser<void ()> const&, hpx::runtime_mode)

I don't know how closely this function is related to the problem.

@hkaiser

This comment has been minimized.

Copy link
Member

commented Oct 21, 2013

Are you sure you recompiled everything? We modified a couple of those hpx::init prototypes recently which might cause your issue.

@eschnett

This comment has been minimized.

Copy link
Contributor Author

commented Oct 21, 2013

D'oh. Yes, a rebuild helped. I'm losing my touch -- sorry for the noise.

@eschnett eschnett closed this Oct 21, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.