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

Undefined Reference to bitpit::ParaTree::ParaTree #456

Open
myermo opened this issue Mar 15, 2024 · 1 comment
Open

Undefined Reference to bitpit::ParaTree::ParaTree #456

myermo opened this issue Mar 15, 2024 · 1 comment

Comments

@myermo
Copy link

myermo commented Mar 15, 2024

Hi there,

I hope this message finds you well. I'm encountering an issue while attempting to use the Paratree object in my project. Whenever I compile my code, I encounter the following error:

/usr/bin/ld: /tmp/cc5WslX9.ltrans0.ltrans.o: in function `main':
<artificial>:(.text+0x6bb85): undefined reference to `bitpit::ParaTree::ParaTree(unsigned char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'

It seems like there's an undefined reference to bitpit::ParaTree::ParaTree during the linking phase. I've checked my code and made sure that I'm including all necessary headers and linking against the appropriate libraries, but I'm still encountering this issue.

Here's a brief overview of my setup:

  • Compiler: g++ 13.2.1
  • Operating System: Arch Linux with Kernel 6.7.8

Steps to reproduce:

  1. Include <bitpit/ParaTree.hpp> in a file.
  2. Try to build the Paratree with bitpit::ParaTree pt(2);

I've tried various solutions such as checking the include paths, ensuring the correct libraries are linked, and confirming that the necessary functions are declared and defined properly, but the problem persists.

The only library I have to link bitpit is libbitpit_MPI.so. Also, I'm compiling the library enabling MPI support with -D BITPIT_ENABLE_MPI=on.

Could you please provide guidance on how to resolve this issue? Any help would be greatly appreciated.

Thank you for your time and assistance.

Best regards,
myermo

@andrea-iob
Copy link
Member

Are you using cmake to compile your application? If so, how do you add the bitpit library to your targets? The preferred way to use bitpit in cmake is to find the bitpit library with find_package and then add it to your targets with target_link_libraries:

find_package(BITPIT REQUIRED)
include(${BITPIT_USE_FILE})
target_link_libraries(name_of_your_target PRIVATE bitpit::bitpit)

After doing this, a new variable called BITPIT_DIR will appear in cmake GUI, this variable should be set to "BITPIT_INSTALL_PATH/share/bitpit/cmake" (with BITPIT_INSTALL_PATH being the directory where bitpit has been installed).

I'm attaching an archive that contains both the cmake file and the source code needed to run a minimal PABLO example. You can run it with:

tar -zxvf pablo_test.tar.gz
mkdir build
cd build/
ccmake ../
<<<< Here you need to configure cmake to find your bitpit installation >>>>
VERBOSE=1 make
./test

Can you try it and check if it works for you?

pablo_test.tar.gz

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

No branches or pull requests

2 participants