I am working on building and compiling Align-It for our research informatics team with the company I work for, and running into some errors on a Linux 2023 AMI instance. We have successfully installed Shape-It on a Rocky Linux server before, and the RI team wanted to utilize Align-It as well, and looks like it should be a similar compile and build process, so not sure if there's something different among my Linux dev box, versus the Rocky Linux box. That would have to be tested next week.. I am hoping to gain any insight on the 'undefined reference' errors I am receiving at the end of the 'make' command for my align-it project.
/usr/bin/ld: CMakeFiles/align-it.dir/src/result.cpp.o: in function Result::Result()': result.cpp:(.text+0x170): undefined reference toOpenBabel::OBMol::OBMol()'
/usr/bin/ld: CMakeFiles/align-it.dir/src/utilities.cpp.o: in function positionMolecule(OpenBabel::OBMol*, SiMath::Matrix&, SolutionInfo&)': utilities.cpp:(.text+0x1920): undefined reference toOpenBabel::OBMol::BeginAtom(gnu_cxx::__normal_iterator<OpenBabel::OBAtom*, std::vector<OpenBabel::OBAtom, std::allocator<OpenBabel::OBAtom*> > >&)'
/usr/bin/ld: utilities.cpp:(.text+0x1b93): undefined reference to OpenBabel::OBAtom::SetVector(double, double, double)' /usr/bin/ld: utilities.cpp:(.text+0x1ba0): undefined reference toOpenBabel::OBMol::NextAtom(gnu_cxx::normal_iterator<OpenBabel::OBAtom*, std::vector<OpenBabel::OBAtom, std::allocator<OpenBabel::OBAtom> > >&)'
/usr/bin/ld: CMakeFiles/align-it.dir/src/utilities.cpp.o: in function `TransformMolecule(OpenBabel::OBMol, SiMath::Matrix&, Coordinate&, Coordinate&)':
utilities.cpp:(.text+0x1e74): undefined reference to `OpenBabel::OBMol::BeginAtom(__gnu_cxx::normal_iterator<OpenBabel::OBAtom, std::vector<OpenBabel::OBAtom, std::allocator<OpenBabel::OBAtom> > >&)'
/usr/bin/ld: utilities.cpp:(.text+0x1f94): undefined reference to OpenBabel::OBAtom::SetVector(double, double, double)' /usr/bin/ld: utilities.cpp:(.text+0x1fa1): undefined reference toOpenBabel::OBMol::NextAtom(__gnu_cxx::__normal_iterator<OpenBabel::OBAtom, std::vector<OpenBabel::OBAtom, std::allocator<OpenBabel::OBAtom> > >&)'
collect2: error: ld returned 1 exit status
make[2]: [CMakeFiles/align-it.dir/build.make:593: align-it] Error 1
make[1]: [CMakeFiles/Makefile2:83: CMakeFiles/align-it.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
Thank you in advance for any help! I have been searching for possible solutions online but have not found anything helpful. I believe I have all the necessary components installed, but unsure if there's something incorrect or missing from my CMakeLists.txt file.
Project name
project (align-it)
Specify additional module paths for finding packages
set (CPACK_PACKAGE_NAME ${PROJECT_NAME})
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Align-it - a program for aligning molecules")
set (CPACK_PACKAGE_VENDOR "Silicos-it, a division of Imacosi bvba")
set (CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set (CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set (CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING.LESSER")
set (CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README")
set (CPACK_RESOURCE_FILE_INSTALL "${PROJECT_SOURCE_DIR}/INSTALL")
set (CPACK_SOURCE_GENERATOR "TGZ")
Ignore files and directories when packaging the source
Good afternoon,
I am working on building and compiling Align-It for our research informatics team with the company I work for, and running into some errors on a Linux 2023 AMI instance. We have successfully installed Shape-It on a Rocky Linux server before, and the RI team wanted to utilize Align-It as well, and looks like it should be a similar compile and build process, so not sure if there's something different among my Linux dev box, versus the Rocky Linux box. That would have to be tested next week.. I am hoping to gain any insight on the 'undefined reference' errors I am receiving at the end of the 'make' command for my align-it project.
/home/ec2-user/openbabel/include/openbabel/math/vector3.h:274:10: note: declared here 274 | bool operator== ( const vector3& ) const; | ^
~~~ [100%] Linking CXX executable align-itbut then started going into errors like this:
/usr/bin/ld: CMakeFiles/align-it.dir/src/result.cpp.o: in function
Result::Result()': result.cpp:(.text+0x170): undefined reference to
OpenBabel::OBMol::OBMol()' /usr/bin/ld: CMakeFiles/align-it.dir/src/utilities.cpp.o: in functionpositionMolecule(OpenBabel::OBMol*, SiMath::Matrix&, SolutionInfo&)': utilities.cpp:(.text+0x1920): undefined reference to
OpenBabel::OBMol::BeginAtom(gnu_cxx::__normal_iterator<OpenBabel::OBAtom*, std::vector<OpenBabel::OBAtom, std::allocator<OpenBabel::OBAtom*> > >&)' /usr/bin/ld: utilities.cpp:(.text+0x1b93): undefined reference toOpenBabel::OBAtom::SetVector(double, double, double)' /usr/bin/ld: utilities.cpp:(.text+0x1ba0): undefined reference to
OpenBabel::OBMol::NextAtom(gnu_cxx::normal_iterator<OpenBabel::OBAtom*, std::vector<OpenBabel::OBAtom, std::allocator<OpenBabel::OBAtom> > >&)' /usr/bin/ld: CMakeFiles/align-it.dir/src/utilities.cpp.o: in function `TransformMolecule(OpenBabel::OBMol, SiMath::Matrix&, Coordinate&, Coordinate&)': utilities.cpp:(.text+0x1e74): undefined reference to `OpenBabel::OBMol::BeginAtom(__gnu_cxx::normal_iterator<OpenBabel::OBAtom, std::vector<OpenBabel::OBAtom, std::allocator<OpenBabel::OBAtom> > >&)' /usr/bin/ld: utilities.cpp:(.text+0x1f94): undefined reference toOpenBabel::OBAtom::SetVector(double, double, double)' /usr/bin/ld: utilities.cpp:(.text+0x1fa1): undefined reference to
OpenBabel::OBMol::NextAtom(__gnu_cxx::__normal_iterator<OpenBabel::OBAtom, std::vector<OpenBabel::OBAtom, std::allocator<OpenBabel::OBAtom> > >&)' collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/align-it.dir/build.make:593: align-it] Error 1 make[1]: [CMakeFiles/Makefile2:83: CMakeFiles/align-it.dir/all] Error 2 make: *** [Makefile:156: all] Error 2Thank you in advance for any help! I have been searching for possible solutions online but have not found anything helpful. I believe I have all the necessary components installed, but unsure if there's something incorrect or missing from my CMakeLists.txt file.
Project name
project (align-it)
Specify additional module paths for finding packages
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules /home/ec2-user/align-it-ob3/cmake/modules /home/ec2-user/openbabel/cmake/modules)
Specify prefix path for finding OpenBabel during build
set(CMAKE_PREFIX_PATH "/home/ec2-user/openbabel/build")
Find the OpenBabel3 package using FindOPENBABEL3.cmake
find_package (OPENBABEL3 REQUIRED)
Version information for the project
set (VERSION_MAJOR 1) set (VERSION_MINOR 0) set (VERSION_PATCH 4) file (WRITE ${PROJECT_SOURCE_DIR}/include/config.h "#define ALIGNIT_VERSION ${VERSION_MAJOR}\n") file (APPEND ${PROJECT_SOURCE_DIR}/include/config.h "#define ALIGNIT_RELEASE ${VERSION_MINOR}\n") file (APPEND ${PROJECT_SOURCE_DIR}/include/config.h "#define ALIGNIT_SUBRELEASE ${VERSION_PATCH}\n")
Build type (Release in this case)
set (CMAKE_BUILD_TYPE Release)
Source files (all .cpp files in the src directory)
file (GLOB_RECURSE sourcefiles "${PROJECT_SOURCE_DIR}/src/*.cpp")
Set the path to OpenBabel lib
set(OPENBABEL3_LIBRARIES "/home/ec2-user/openbabel/build/lib")
Set the path to OpenBabel include directory
set(OPENBABEL3_INCLUDE_DIRS "/home/ec2-user/openbabel/build/include/openbabel-3.0.0;/home/ec2-user/openbabel/include;/home/ec2-user/openbabel/build/include")
Include directories for the project
include_directories(${PROJECT_SOURCE_DIR}/include) include_directories(${OPENBABEL3_INCLUDE_DIRS})
Executable target
add_executable (${PROJECT_NAME} ${sourcefiles})
Link the executable with OpenBabel libraries
target_link_libraries(${PROJECT_NAME} -Wl,--start-group ${OPENBABEL3_LIBRARIES} -Wl,--end-group)
Installation destination for the executable
install (TARGETS ${PROJECT_NAME} DESTINATION bin) message ("Installation directory of executable: ${CMAKE_INSTALL_PREFIX}/bin")
Testing (commented out)
enable_testing()
include(${CMAKE_MODULE_PATH}/IncludeAllTests.cmake)
Packaging information for CPack
set (CPACK_PACKAGE_NAME ${PROJECT_NAME}) set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Align-it - a program for aligning molecules") set (CPACK_PACKAGE_VENDOR "Silicos-it, a division of Imacosi bvba") set (CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR}) set (CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}) set (CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}) set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING.LESSER") set (CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README") set (CPACK_RESOURCE_FILE_INSTALL "${PROJECT_SOURCE_DIR}/INSTALL") set (CPACK_SOURCE_GENERATOR "TGZ")
Ignore files and directories when packaging the source
set (CPACK_SOURCE_IGNORE_FILES ".DS_Store"; ".git"; "${PROJECT_NAME}$" "${PROJECT_NAME}-1.0.0.tar.gz$" "${PROJECT_NAME}-1.0.1.tar.gz$" "${PROJECT_NAME}-1.0.2.tar.gz$" "${PROJECT_NAME}-1.0.3.tar.gz$" "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.tar.gz$" "CMakeCache.txt$"; "CMakeFiles"; "CPackConfig.cmake$"; "CPackSourceConfig.cmake$"; "CTestTestfile.cmake$"; "Makefile$"; "Testing"; "_CPack_Packages"; "cmake_install.cmake$"; "install_manifest.txt$" )
Set source package file name
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
Include CPack module
include (CPack)