This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 493 - FindUmfpack.cmake bug
Summary: FindUmfpack.cmake bug
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - general (show other bugs)
Version: unspecified
Hardware: All Linux
: Normal Unknown
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-25 15:14 UTC by daviddoria
Modified: 2019-12-04 11:48 UTC (History)
3 users (show)



Attachments

Description daviddoria 2012-07-25 15:14:37 UTC
If find_package(Umfpack) is called twice (which could happen accidentally, or worse, if a project has a submodule that also requires Umfpack), a very cryptic error occurs:

CMake Error at FindUmfpack.cmake:22 (get_filename_component):
  get_filename_component unknown component /usr/lib/libamd.so

You can generate this error with simply:


cmake_minimum_required(VERSION 2.6)

PROJECT(TestEigen)

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR})

FIND_PACKAGE(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIR})

FIND_PACKAGE(Umfpack REQUIRED)
include_directories(${UMFPACK_INCLUDES})

# Include Umfpack again
FIND_PACKAGE(Umfpack REQUIRED)
include_directories(${UMFPACK_INCLUDES})

ADD_EXECUTABLE(TestEigen TestEigen.cpp)
Comment 1 Desire NUENTSA 2012-08-01 17:43:22 UTC
During the first call, UMFPACK_LIBRARIES is set to something like  "/usr/lib/libamd.so/usr/lib/libumfpack.so/usr/lib/libcolamd.so" and target_link_libraries() deal easily with this kind of string. 

At the second call, UMFPACK_LIBRARIES still has its old value but it seems that get_filename_component() is not able to deal with that kind of string. 

You can check this behaviour by commenting out the following lines 
    set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${AMD_LIBRARY})
    set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${COLAMD_LIBRARY})

One solution might be to prevent multiple calls to this file.
Define a variable at the end of the file
SET(FIND_UMFPACK_CALLED TRUE)

and check its value before everything 
if(FIND_UMFPACK_CALLED)
return()
endif(FIND_UMFPACK_CALLED)
Comment 2 Gael Guennebaud 2012-08-02 09:19:59 UTC
What about skipping the get_filename_component call if UMFPACK_LIBDIR is already set?
Comment 3 Desire NUENTSA 2012-08-02 09:57:19 UTC
Yes, that is a cleaner alternative.
Comment 4 Desire NUENTSA 2012-08-02 10:02:53 UTC
https://bitbucket.org/eigen/eigen/changeset/35ee74757514/
changeset:   35ee74757514
branch:      3.1
user:        dnuentsa
date:        2012-08-02 10:00:23
summary:     Bug 493 : multiple calls to FindUmfPack
affected #:  1 file
Comment 5 Nobody 2019-12-04 11:48:16 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/493.

Note You need to log in before you can comment on or make changes to this bug.