linking error with gsl

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

linking error with gsl

Benoist Laurent
Hi,

I'm a begginner with CMake.
I've got a project with all sources written and I want to switch to a CMake building process.
My project is quite small :
  - 5 sources in myProject/src directory
  - 5 headers in myProject/include directory

The problem is that is need to link with the gsl libraries.
I used the FindGSL.cmake file that I found here http://www.cmake.org/pipermail/cmake/2006-March/008628.html.

But when I type make, this error occurs :
Linking C executable myExe
i686-apple-darwin9-gcc-4.0.1: `/usr/local/bin/gsl-config: No such file or directory
make[2]: *** [myExe] Error 1
make[1]: *** [CMakeFiles/myExe.dir/all] Error 2
make: *** [all] Error 2

It's quite strange because the program /usr/local/bin/gsl-config does exist and prints -L/usr/local/lib -lgsl -lgslcblas -lm.
This is my CMakeLists.txt file :

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(PROJET)

FIND_PACKAGE(GSL REQUIRED)

SET(PROJET_SRCS
    ./src/FN_functions.c
    ./src/HH_functions.c
    ./src/HR_functions.c
    ./src/Iz_functions.c
    ./src/main.c
    ./src/misc.c
    ./src/ML_functions.c
    ./src/parsing.c
    ./src/stim.c
)   

SET(INCLUDE_DIRS
    ${PROJET_SOURCE_DIR}/include
    ${GSL_INCLUDE_DIRS}
)

SET(LIBS ${LIBS} ${GSL_LIBRARIES})

INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
ADD_DEFINITIONS(-Wall -ansi -pedantic -02)
ADD_EXECUTABLE(myExe ${PROJET_SRCS})

TARGET_LINK_LIBRARIES(myExe ${LIBS})

--------------

Do you see the problem ?



Achetez un nouveau PC et bénéficiez de Windows 7 dès sa sortie ! En savoir plus
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: linking error with gsl

Philip Lowman
Have you tried using "make VERBOSE=1" to get the full command line being executed?

It looks like `/usr/local/bin/gsl-config might be being passed to the linker via target_link_libraries()?
CMake doesn't evaluate backticks, you'll have to use a command like execute_process().

There might be a problem in the FindGSL module you're using.  This might take some debugging with the message() command to trace down.  There are several find modules shipped with CMake 2.6.4 that use a "foo-config" style program to parse include directories and libraries which may be helpful.  One is FindFLTK.cmake for example.

On Sun, Sep 13, 2009 at 4:05 PM, Benoist Laurent <[hidden email]> wrote:
Hi,

I'm a begginner with CMake.
I've got a project with all sources written and I want to switch to a CMake building process.
My project is quite small :
  - 5 sources in myProject/src directory
  - 5 headers in myProject/include directory

The problem is that is need to link with the gsl libraries.
I used the FindGSL.cmake file that I found here http://www.cmake.org/pipermail/cmake/2006-March/008628.html.

But when I type make, this error occurs :
Linking C executable myExe
i686-apple-darwin9-gcc-4.0.1: `/usr/local/bin/gsl-config: No such file or directory
make[2]: *** [myExe] Error 1
make[1]: *** [CMakeFiles/myExe.dir/all] Error 2
make: *** [all] Error 2

It's quite strange because the program /usr/local/bin/gsl-config does exist and prints -L/usr/local/lib -lgsl -lgslcblas -lm.
This is my CMakeLists.txt file :

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(PROJET)

FIND_PACKAGE(GSL REQUIRED)

SET(PROJET_SRCS
    ./src/FN_functions.c
    ./src/HH_functions.c
    ./src/HR_functions.c
    ./src/Iz_functions.c
    ./src/main.c
    ./src/misc.c
    ./src/ML_functions.c
    ./src/parsing.c
    ./src/stim.c
)   

SET(INCLUDE_DIRS
    ${PROJET_SOURCE_DIR}/include
    ${GSL_INCLUDE_DIRS}
)

SET(LIBS ${LIBS} ${GSL_LIBRARIES})

INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
ADD_DEFINITIONS(-Wall -ansi -pedantic -02)
ADD_EXECUTABLE(myExe ${PROJET_SRCS})

TARGET_LINK_LIBRARIES(myExe ${LIBS})

--------------

Do you see the problem ?



Achetez un nouveau PC et bénéficiez de Windows 7 dès sa sortie ! En savoir plus

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake



--
Philip Lowman

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: linking error with gsl

Benoist Laurent
You were actually right the problem was the FindGSL.cmake file.
Like I said earlier, I took it from the net.
The line SET(GSL_LIBRARIES `${GSL_CONFIG} --libs`) did not returned the expected result.
I replaced it by
EXEC_PROGRAM(${GSL_CONFIG}
          ARGS --libs
          OUTPUT_VARIABLE GSL_LIBRARIES)

It works well.

Thank you very much.
Best regards,
Ben



Date: Mon, 14 Sep 2009 07:26:03 -0400
Subject: Re: [CMake] linking error with gsl
From: [hidden email]
To: [hidden email]
CC: [hidden email]

Have you tried using "make VERBOSE=1" to get the full command line being executed?

It looks like `/usr/local/bin/gsl-config might be being passed to the linker via target_link_libraries()?
CMake doesn't evaluate backticks, you'll have to use a command like execute_process().

There might be a problem in the FindGSL module you're using.  This might take some debugging with the message() command to trace down.  There are several find modules shipped with CMake 2.6.4 that use a "foo-config" style program to parse include directories and libraries which may be helpful.  One is FindFLTK.cmake for example.

On Sun, Sep 13, 2009 at 4:05 PM, Benoist Laurent <[hidden email]> wrote:
Hi,

I'm a begginner with CMake.
I've got a project with all sources written and I want to switch to a CMake building process.
My project is quite small :
  - 5 sources in myProject/src directory
  - 5 headers in myProject/include directory

The problem is that is need to link with the gsl libraries.
I used the FindGSL.cmake file that I found here http://www.cmake.org/pipermail/cmake/2006-March/008628.html.

But when I type make, this error occurs :
Linking C executable myExe
i686-apple-darwin9-gcc-4.0.1: `/usr/local/bin/gsl-config: No such file or directory
make[2]: *** [myExe] Error 1
make[1]: *** [CMakeFiles/myExe.dir/all] Error 2
make: *** [all] Error 2

It's quite strange because the program /usr/local/bin/gsl-config does exist and prints -L/usr/local/lib -lgsl -lgslcblas -lm.
This is my CMakeLists.txt file :

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(PROJET)

FIND_PACKAGE(GSL REQUIRED)

SET(PROJET_SRCS
    ./src/FN_functions.c
    ./src/HH_functions.c
    ./src/HR_functions.c
    ./src/Iz_functions.c
    ./src/main.c
    ./src/misc.c
    ./src/ML_functions.c
    ./src/parsing.c
    ./src/stim.c
)   

SET(INCLUDE_DIRS
    ${PROJET_SOURCE_DIR}/include
    ${GSL_INCLUDE_DIRS}
)

SET(LIBS ${LIBS} ${GSL_LIBRARIES})

INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
ADD_DEFINITIONS(-Wall -ansi -pedantic -02)
ADD_EXECUTABLE(myExe ${PROJET_SRCS})

TARGET_LINK_LIBRARIES(myExe ${LIBS})

--------------

Do you see the problem ?



Achetez un nouveau PC et bénéficiez de Windows 7 dès sa sortie ! En savoir plus

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake



--
Philip Lowman


Vous cherchez l'intégrale des clips de Michael Jackson ? Bing ! Trouvez !
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake