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

Failed Linking CXX executable due to undefined references #6347

Open
AndreyKulikov2022 opened this issue Sep 13, 2023 · 4 comments
Open

Failed Linking CXX executable due to undefined references #6347

AndreyKulikov2022 opened this issue Sep 13, 2023 · 4 comments

Comments

@AndreyKulikov2022
Copy link

Expected Behavior

CMakeLists.txt:

cmake_minimum_required(VERSION 3.19)
project(my_hpx)
find_package(HPX REQUIRED)
add_executable(my_hpx main.cpp)
target_link_libraries(my_hpx HPX::hpx HPX::wrap_main HPX::iostreams_component)

main.cpp:
#include <hpx/hpx_main.hpp>
#include <hpx/iostream.hpp>

int main() {
hpx::cout << "Hello, World!\n" << std::flush;
return 0;
}

vcpkg.json
{
"name" : "my-hpx",
"version-string" : "1.0.0",
"builtin-baseline" : "962e5e39f8a25f42522f51fffc574e05a3efd26b",
"dependencies" : [ {
"name" : "hpx",
"version>=" : "1.9.1"
} ]
}

Expecting it to write "Hello, World!"

Actual Behavior

[1/1] Linking CXX executable my_hpx
FAILED: my_hpx
: && /usr/bin/g++ -g -pthread -Wl,-z,defs -fvisibility=hidden -Wl,-rpath -Wl,/home/a.kulikov/CLionProjects/my_hpx/cmake-build-debug/vcpkg_installed/x64-linux/lib -Wl,--enable-new-dtags -L/home/a.kulikov/CLionProjects/my_hpx/cmake-build-debug/vcpkg_installed/x64-linux/lib CMakeFiles/my_hpx.dir/main.cpp.o -o my_hpx -Wl,-rpath,/home/a.kulikov/CLionProjects/my_hpx/cmake-build-debug/vcpkg_installed/x64-linux/debug/lib vcpkg_installed/x64-linux/debug/lib/libhpx_iostreams_componentd.a vcpkg_installed/x64-linux/debug/lib/libhpx_wrapd.a -Wl,-wrap=main vcpkg_installed/x64-linux/debug/lib/libhpx_initd.a vcpkg_installed/x64-linux/debug/lib/libhpxd.a vcpkg_installed/x64-linux/debug/lib/libhpx_checkpointd.a vcpkg_installed/x64-linux/debug/lib/libhpx_executors_distributedd.a vcpkg_installed/x64-linux/debug/lib/libhpx_included.a vcpkg_installed/x64-linux/debug/lib/libhpx_computed.a vcpkg_installed/x64-linux/debug/lib/libhpx_init_runtimed.a vcpkg_installed/x64-linux/debug/lib/libhpx_collectivesd.a vcpkg_installed/x64-linux/debug/lib/libhpx_lcos_distributedd.a vcpkg_installed/x64-linux/debug/lib/libhpx_parcelport_mpid.a vcpkg_installed/x64-linux/debug/lib/libhpx_parcelport_tcpd.a vcpkg_installed/x64-linux/debug/lib/libhpx_resiliency_distributedd.a vcpkg_installed/x64-linux/debug/lib/libhpx_runtime_distributedd.a vcpkg_installed/x64-linux/debug/lib/libhpx_segmented_algorithmsd.a vcpkg_installed/x64-linux/debug/lib/libhpx_distribution_policiesd.a vcpkg_installed/x64-linux/debug/lib/libhpx_performance_countersd.a vcpkg_installed/x64-linux/debug/lib/libhpx_runtime_componentsd.a vcpkg_installed/x64-linux/debug/lib/libhpx_agasd.a vcpkg_installed/x64-linux/debug/lib/libhpx_async_colocatedd.a vcpkg_installed/x64-linux/debug/lib/libhpx_agas_based.a vcpkg_installed/x64-linux/debug/lib/libhpx_async_distributedd.a vcpkg_installed/x64-linux/debug/lib/libhpx_parcelsetd.a vcpkg_installed/x64-linux/debug/lib/libhpx_actionsd.a vcpkg_installed/x64-linux/debug/lib/libhpx_namingd.a vcpkg_installed/x64-linux/debug/lib/libhpx_checkpoint_based.a vcpkg_installed/x64-linux/debug/lib/libhpx_plugin_factoriesd.a vcpkg_installed/x64-linux/debug/lib/libhpx_command_line_handlingd.a vcpkg_installed/x64-linux/debug/lib/libhpx_componentsd.a vcpkg_installed/x64-linux/debug/lib/libhpx_actions_based.a vcpkg_installed/x64-linux/debug/lib/libhpx_components_based.a vcpkg_installed/x64-linux/debug/lib/libhpx_parcelset_based.a vcpkg_installed/x64-linux/debug/lib/libhpx_naming_based.a vcpkg_installed/x64-linux/debug/lib/libhpx_statisticsd.a vcpkg_installed/x64-linux/debug/lib/libhpx_cored.a -Wl,--whole-archive -Wl,--no-whole-archive vcpkg_installed/x64-linux/debug/lib/libhpx_async_mpid.a vcpkg_installed/x64-linux/debug/lib/libhpx_batch_environmentsd.a vcpkg_installed/x64-linux/debug/lib/libhpx_cached.a vcpkg_installed/x64-linux/debug/lib/libhpx_include_locald.a vcpkg_installed/x64-linux/debug/lib/libhpx_compute_locald.a vcpkg_installed/x64-linux/debug/lib/libhpx_init_runtime_locald.a vcpkg_installed/x64-linux/debug/lib/libhpx_algorithmsd.a vcpkg_installed/x64-linux/debug/lib/libhpx_lcos_locald.a vcpkg_installed/x64-linux/debug/lib/libhpx_mpi_based.a vcpkg_installed/x64-linux/debug/lib/libhpx_resiliencyd.a vcpkg_installed/x64-linux/debug/lib/libhpx_runtime_locald.a vcpkg_installed/x64-linux/debug/lib/libhpx_command_line_handling_locald.a vcpkg_installed/x64-linux/debug/lib/libhpx_asiod.a vcpkg_installed/x64-linux/debug/lib/libhpx_static_reinitd.a vcpkg_installed/x64-linux/debug/lib/libhpx_testingd.a vcpkg_installed/x64-linux/debug/lib/libhpx_threadmanagerd.a vcpkg_installed/x64-linux/debug/lib/libhpx_thread_pool_utild.a vcpkg_installed/x64-linux/debug/lib/libhpx_async_locald.a vcpkg_installed/x64-linux/debug/lib/libhpx_timed_executiond.a vcpkg_installed/x64-linux/debug/lib/libhpx_executorsd.a vcpkg_installed/x64-linux/debug/lib/libhpx_executiond.a vcpkg_installed/x64-linux/debug/lib/libhpx_async_combinatorsd.a vcpkg_installed/x64-linux/debug/lib/libhpx_pack_traversald.a vcpkg_installed/x64-linux/debug/lib/libhpx_io_serviced.a vcpkg_installed/x64-linux/debug/lib/libhpx_propertiesd.a vcpkg_installed/x64-linux/debug/lib/libhpx_resource_partitionerd.a vcpkg_installed/x64-linux/debug/lib/libhpx_runtime_configurationd.a vcpkg_installed/x64-linux/debug/lib/libhpx_inid.a vcpkg_installed/x64-linux/debug/lib/libhpx_program_optionsd.a vcpkg_installed/x64-linux/debug/lib/libhpx_thread_poolsd.a vcpkg_installed/x64-linux/debug/lib/libhpx_schedulersd.a vcpkg_installed/x64-linux/debug/lib/libhpx_threadingd.a vcpkg_installed/x64-linux/debug/lib/libhpx_futuresd.a vcpkg_installed/x64-linux/debug/lib/libhpx_synchronizationd.a vcpkg_installed/x64-linux/debug/lib/libhpx_threading_based.a vcpkg_installed/x64-linux/debug/lib/libhpx_affinityd.a vcpkg_installed/x64-linux/debug/lib/libhpx_topologyd.a vcpkg_installed/x64-linux/debug/lib/libhpx_async_based.a vcpkg_installed/x64-linux/debug/lib/libhpx_coroutinesd.a vcpkg_installed/x64-linux/debug/lib/libhpx_memoryd.a vcpkg_installed/x64-linux/debug/lib/libhpx_concurrencyd.a vcpkg_installed/x64-linux/debug/lib/libhpx_allocator_supportd.a vcpkg_installed/x64-linux/debug/lib/libhpx_execution_based.a vcpkg_installed/x64-linux/debug/lib/libhpx_hashingd.a vcpkg_installed/x64-linux/debug/lib/libhpx_lock_registrationd.a vcpkg_installed/x64-linux/debug/lib/libhpx_utild.a vcpkg_installed/x64-linux/debug/lib/libhpx_versiond.a vcpkg_installed/x64-linux/debug/lib/libhpx_prefixd.a vcpkg_installed/x64-linux/debug/lib/libhpx_plugind.a vcpkg_installed/x64-linux/debug/lib/libhpx_string_utild.a vcpkg_installed/x64-linux/debug/lib/libhpx_iterator_supportd.a vcpkg_installed/x64-linux/debug/lib/libhpx_functionald.a vcpkg_installed/x64-linux/debug/lib/libhpx_datastructuresd.a vcpkg_installed/x64-linux/debug/lib/libhpx_itt_notifyd.a vcpkg_installed/x64-linux/debug/lib/libhpx_tag_invoked.a vcpkg_installed/x64-linux/debug/lib/libhpx_serializationd.a vcpkg_installed/x64-linux/debug/lib/libhpx_debuggingd.a vcpkg_installed/x64-linux/debug/lib/libhpx_errorsd.a vcpkg_installed/x64-linux/debug/lib/libhpx_loggingd.a vcpkg_installed/x64-linux/debug/lib/libhpx_filesystemd.a vcpkg_installed/x64-linux/debug/lib/libhpx_timingd.a vcpkg_installed/x64-linux/debug/lib/libhpx_hardwared.a vcpkg_installed/x64-linux/debug/lib/libhpx_thread_supportd.a vcpkg_installed/x64-linux/debug/lib/libhpx_type_supportd.a vcpkg_installed/x64-linux/debug/lib/libhpx_assertiond.a vcpkg_installed/x64-linux/debug/lib/libhpx_formatd.a vcpkg_installed/x64-linux/debug/lib/libhpx_conceptsd.a vcpkg_installed/x64-linux/debug/lib/libhpx_configd.a vcpkg_installed/x64-linux/debug/lib/libhpx_preprocessord.a vcpkg_installed/x64-linux/debug/lib/libhpx_config_registryd.a vcpkg_installed/x64-linux/debug/lib/libmpi.so vcpkg_installed/x64-linux/debug/lib/libtcmalloc_minimal.a vcpkg_installed/x64-linux/debug/lib/libhwloc.a -latomic -ldl -lrt && :
/usr/bin/ld: vcpkg_installed/x64-linux/debug/lib/libhpx_agas_based.a(primary_namespace.cpp.o): in function hpx::agas::primary_namespace::route(hpx::parcelset::parcel&&, hpx::function<void (std::error_code const&, hpx::parcelset::parcel const&), false>&&)': /home/a.kulikov/.vcpkg-clion/vcpkg/buildtrees/hpx/src/v1.9.1-d67aefad9f.clean/libs/full/agas_base/src/primary_namespace.cpp:221: undefined reference to hpx::agas::server::primary_namespace::route(hpx::parcelset::parcel&&)'
/usr/bin/ld: vcpkg_installed/x64-linux/debug/lib/libhpx_agas_based.a(primary_namespace.cpp.o): in function void hpx::actions::action<void (hpx::agas::server::primary_namespace::*)(hpx::parcelset::parcel&&), &hpx::agas::server::primary_namespace::route, hpx::agas::server::primary_namespace::route_action>::invoke<hpx::parcelset::parcel>(void*, int, hpx::parcelset::parcel&&)': /home/a.kulikov/.vcpkg-clion/vcpkg/buildtrees/hpx/src/v1.9.1-d67aefad9f.clean/libs/full/actions_base/include/hpx/actions_base/component_action.hpp:102: undefined reference to hpx::agas::server::primary_namespace::route(hpx::parcelset::parcel&&)'
/usr/bin/ld: vcpkg_installed/x64-linux/debug/lib/libhpx_parcelsetd.a(parcelhandler.cpp.o): in function hpx::parcelset::init_static_parcelport_factories(std::vector<hpx::plugins::parcelport_factory_base*, std::allocator<hpx::plugins::parcelport_factory_base*> >&)': /home/a.kulikov/.vcpkg-clion/vcpkg/buildtrees/hpx/x64-linux-dbg/libs/full/parcelset/include/hpx/parcelset/static_parcelports.hpp:27: undefined reference to parcelport_mpi_factory_init(std::vector<hpx::plugins::parcelport_factory_base*, std::allocatorhpx::plugins::parcelport_factory_base* >&)'
/usr/bin/ld: /home/a.kulikov/.vcpkg-clion/vcpkg/buildtrees/hpx/x64-linux-dbg/libs/full/parcelset/include/hpx/parcelset/static_parcelports.hpp:28: undefined reference to `parcelport_tcp_factory_init(std::vector<hpx::plugins::parcelport_factory_base*, std::allocatorhpx::plugins::parcelport_factory_base* >&)'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

CMake log:
/snap/clion/249/bin/cmake/linux/x64/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/snap/clion/249/bin/ninja/linux/x64/ninja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_TOOLCHAIN_FILE=/home/a.kulikov/.vcpkg-clion/vcpkg/scripts/buildsystems/vcpkg.cmake -G Ninja -S /home/a.kulikov/CLionProjects/my_hpx -B /home/a.kulikov/CLionProjects/my_hpx/cmake-build-debug
-- Running vcpkg install
Detecting compiler hash for triplet x64-linux...
All requested packages are currently installed.
Total install time: 463 ns
The port hpx provides CMake targets:

find_package(HPX REQUIRED)
target_link_libraries(main PRIVATE HPX::hpx)

-- Running vcpkg install - done
-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Asio: /home/a.kulikov/CLionProjects/my_hpx/cmake-build-debug/vcpkg_installed/x64-linux/include (found suitable version "1.28.0", minimum required is "1.12.0")
-- Found TCMalloc: /home/a.kulikov/CLionProjects/my_hpx/cmake-build-debug/vcpkg_installed/x64-linux/debug/lib/libtcmalloc_minimal.a
-- Using tcmalloc allocator.
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found Boost: /home/a.kulikov/CLionProjects/my_hpx/cmake-build-debug/vcpkg_installed/x64-linux/include (found suitable version "1.82.0", minimum required is "1.71")
CMake Warning at /snap/clion/249/bin/cmake/linux/x64/share/cmake-3.26/Modules/FindBoost.cmake:1384 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
/snap/clion/249/bin/cmake/linux/x64/share/cmake-3.26/Modules/FindBoost.cmake:1508 (_Boost_COMPONENT_DEPENDENCIES)
/snap/clion/249/bin/cmake/linux/x64/share/cmake-3.26/Modules/FindBoost.cmake:2119 (_Boost_MISSING_DEPENDENCIES)
cmake-build-debug/vcpkg_installed/x64-linux/share/boost/vcpkg-cmake-wrapper.cmake:11 (_find_package)
/home/a.kulikov/.vcpkg-clion/vcpkg/scripts/buildsystems/vcpkg.cmake:813 (include)
cmake-build-debug/vcpkg_installed/x64-linux/share/hpx/HPX_SetupBoostIostreams.cmake:12 (find_package)
cmake-build-debug/vcpkg_installed/x64-linux/share/hpx/HPXConfig.cmake:138 (include)
/home/a.kulikov/.vcpkg-clion/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)
CMakeLists.txt:3 (find_package)

CMake Warning at /snap/clion/249/bin/cmake/linux/x64/share/cmake-3.26/Modules/FindBoost.cmake:1384 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
/snap/clion/249/bin/cmake/linux/x64/share/cmake-3.26/Modules/FindBoost.cmake:1508 (_Boost_COMPONENT_DEPENDENCIES)
/snap/clion/249/bin/cmake/linux/x64/share/cmake-3.26/Modules/FindBoost.cmake:2119 (_Boost_MISSING_DEPENDENCIES)
cmake-build-debug/vcpkg_installed/x64-linux/share/boost/vcpkg-cmake-wrapper.cmake:11 (_find_package)
/home/a.kulikov/.vcpkg-clion/vcpkg/scripts/buildsystems/vcpkg.cmake:813 (include)
cmake-build-debug/vcpkg_installed/x64-linux/share/hpx/HPX_SetupBoostIostreams.cmake:12 (find_package)
cmake-build-debug/vcpkg_installed/x64-linux/share/hpx/HPXConfig.cmake:138 (include)
/home/a.kulikov/.vcpkg-clion/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)
CMakeLists.txt:3 (find_package)

-- Found Boost: /home/a.kulikov/CLionProjects/my_hpx/cmake-build-debug/vcpkg_installed/x64-linux/include (found suitable version "1.82.0", minimum required is "1.71") found components: iostreams regex
-- iostreams
-- Found Hwloc: /home/a.kulikov/CLionProjects/my_hpx/cmake-build-debug/vcpkg_installed/x64-linux/debug/lib/libhwloc.a
-- MPI version: 3.1
-- Configuring done (15.7s)
-- Generating done (0.0s)
-- Build files have been written to: /home/a.kulikov/CLionProjects/my_hpx/cmake-build-debug

[Finished]

Steps to Reproduce the Problem

I am running the project with Clion, the corresponding comand:
/snap/clion/249/bin/cmake/linux/x64/bin/cmake --build /home/a.kulikov/CLionProjects/my_hpx/cmake-build-debug --target my_hpx -j 14

Specifications

... Please describe your environment

  • HPX Version:1.9.1
  • Platform (compiler, OS): g++, ubuntu 22.04.2 LTS
  • IDE: Clion
@hkaiser
Copy link
Member

hkaiser commented Feb 23, 2024

@AndreyKulikov2022 Sorry for the late response... I believe this has been fixed on HPX master. Could you please try again?

@AndreyKulikov2022
Copy link
Author

I am installing hpx 1.9.1 via vcpkg. I've checked the problem with the latest version that vcpkg provides. Unfortunately the same error remains.

@hkaiser
Copy link
Member

hkaiser commented Mar 28, 2024

I am installing hpx 1.9.1 via vcpkg. I've checked the problem with the latest version that vcpkg provides. Unfortunately the same error remains.

You could build HPX using vcpkg using the --head option, which would pull from HPX' latest stable branch (not quite master, but almost). If you edit the ports/hpx/portfile.cmake to HEAD_REF master you'll get top of master instead.

@AndreyKulikov2022
Copy link
Author

Thank you, it works. Had to give up on manifest mode for vcpkg, though.

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

No branches or pull requests

2 participants