evaleev / libint

Libint: high-performance library for computing Gaussian integrals in quantum mechanics
Other
225 stars 95 forks source link

add_library cannot create ALIAS target X because target Y is IMPORTED #175

Closed mdav2 closed 4 years ago

mdav2 commented 4 years ago

I am trying to work on a Julia interface for Libint2. After struggling with the C API for a few weeks I'm trying the C++ API and CxxWrap.jl . However, I am unable to use cmake to even find the library (it was properly installed with cmake --build . --target install). Admittedly, I am a novice with C++/cmake, but I after reading the wiki a number of times I don't see anything wrong with my simple example:

contents of CMakeLists.txt (minimal example):

(base) mmd01986@davis-ws:~/Dropbox/dev/cxxwraptest/test$ cat CMakeLists.txt 
cmake_minimum_required(VERSION 2.8.12)
find_package(Libint2)

Which produces the following result,

(base) mmd01986@davis-ws:~/Dropbox/dev/cxxwraptest/test$ cmake .
CMake Error at /usr/local/lib/cmake/libint2/libint2-config.cmake:74 (add_library):
  add_library cannot create ALIAS target "Libint2::int2" because target
  "Libint2::libint2" is IMPORTED.
Call Stack (most recent call first):
  /usr/local/lib/cmake/libint2/libint2-config.cmake:79 (alias_target)
  CMakeLists.txt:1 (find_package)

CMake Error at /usr/local/lib/cmake/libint2/libint2-config.cmake:74 (add_library):
  add_library cannot create ALIAS target "Libint2::int2-static" because
  target "Libint2::libint2-static" is IMPORTED.
Call Stack (most recent call first):
  /usr/local/lib/cmake/libint2/libint2-config.cmake:80 (alias_target)
  CMakeLists.txt:1 (find_package)

CMake Error at /usr/local/lib/cmake/libint2/libint2-config.cmake:74 (add_library):
  add_library cannot create ALIAS target "Libint2::int2_static" because
  target "Libint2::libint2-static" is IMPORTED.
Call Stack (most recent call first):
  /usr/local/lib/cmake/libint2/libint2-config.cmake:81 (alias_target)
  CMakeLists.txt:1 (find_package)

It goes on like that for a while.

Any guidance on solving this issue would be appreciated.

mdav2 commented 4 years ago

I am also unable to compile even a minimal program with initialize and finalize calls. I'm getting the following error:

(base) mmd01986@davis-ws:~/Dropbox/dev/cxxwraptest/test2$ g++ test.cc -I/usr/local/include -I/usr/local/include/libint2 -L/usr/local/lib -I/usr/include/eigen3/ -I/home/mmd01986/.julia/artifacts/d54a2909808f0f05123ef98f8eef4fcde1073e52/include -I/home/mmd01986/Dropbox/bin/julia-1.4.1/include/julia/ 
/tmp/ccCRBqKR.o: In function `libint2::detail::__initializer::__initializer()':
test.cc:(.text._ZN7libint26detail13__initializerC2Ev[_ZN7libint26detail13__initializerC5Ev]+0xd): undefined reference to `libint2_static_init'
/tmp/ccCRBqKR.o: In function `libint2::detail::__initializer::~__initializer()':
test.cc:(.text._ZN7libint26detail13__initializerD2Ev[_ZN7libint26detail13__initializerD5Ev]+0xd): undefined reference to `libint2_static_cleanup'
collect2: error: ld returned 1 exit status

Perhaps these two issues are related?

mdav2 commented 4 years ago

I have no idea how, but the problem seems to have resolved itself. 🤷‍♂️

evaleev commented 4 years ago

Those are the best kinds of problems ;-) Thanks for trying and reporting. Glad it's working now.

On Sun, May 31, 2020 at 3:08 PM Matthew McAllister Davis < notifications@github.com> wrote:

I have no idea how, but the problem seems to have resolved itself. 🤷‍♂️

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/evaleev/libint/issues/175#issuecomment-636514476, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQXIZYXISNVSCH5K343XE3RUKTL5ANCNFSM4NO7PCBA .

-- web: valeyev.net