Linking component to external library

Dear all,

I'm trying to make a orocos-component (to use in combination with iTaSC) in which mosek, a numerical optimizer, is used. This program uses specific types of variables that are loaded by including a file "mosek.h". I'm getting compilation errors because there are undefined reference to these specific variables in the .o-file created during compilation.

I assume i have to link to moseklibraries somewhere during the compilation. Is it correct that this needs to happen in the "CMakelist.txt"-file with the command add_library or add_definitions? The mosek libraries have a .o or .so extension (libmosek.so.6.o to be more exactly), is it possible that this type isn't compatible with orocos? I have tried some different ways of linking but i'm getting errors like:

- CMake Error: Cannot determine link language for target "<mosek>"
- Cannot find source file "libmosek.so.6.o". Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx
- c++: cannot specify -o with -c or -S with multiple files

Many thanks in advance.
Marijn Goossens

Linking component to external library

2012/1/28 Marijn Goossens <marijn [dot] goossens1 [..] ...>:
> Dear all,
>
> I'm trying to make a orocos-component (to use in combination with iTaSC) in
> which mosek, a numerical optimizer, is used. This program uses specific
> types of variables that are loaded by including a file "mosek.h". I'm
> getting compilation errors because there are undefined reference to these
> specific variables in the .o-file created during compilation.
>
> I assume i have to link to moseklibraries somewhere during the compilation.
> Is it correct that this needs to happen in the "CMakelist.txt"-file with the
> command add_library or add_definitions? The mosek libraries have a .o or .so
> extension (libmosek.so.6.o to be more exactly), is it possible that this
> type isn't compatible with orocos? I have tried some different ways of
> linking but i'm getting errors like:

The command is

target_link_libraries(<name-of-orocos-lib> libmosek.so)

Where libmosek.so needs to be in your CMAKE library include path.

Steven

>
> - CMake Error: Cannot determine link language for target "<mosek>"
> - Cannot find source file "libmosek.so.6.o".  Tried extensions .c .C .c++
> .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx
> - c++: cannot specify -o with -c or -S with multiple files
>
> Many thanks in advance.
> Marijn Goossens
>
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>

Linking component to external library

2012/1/28 Marijn Goossens <marijn [dot] goossens1 [..] ...>:
> 2012/1/28 Steven Bellens <steven [dot] bellens [..] ...>:
>
>> 2012/1/28 Marijn Goossens <marijn [dot] goossens1 [..] ...>:
>> > Dear all,
>> >
>> > I'm trying to make a orocos-component (to use in combination with iTaSC) in
>> > which mosek, a numerical optimizer, is used. This program uses specific
>> > types of variables that are loaded by including a file "mosek.h". I'm
>> > getting compilation errors because there are undefined reference to these
>> > specific variables in the .o-file created during compilation.
>> >
>> > I assume i have to link to moseklibraries somewhere during the compilation.
>> > Is it correct that this needs to happen in the "CMakelist.txt"-file with the
>> > command add_library or add_definitions? The mosek libraries have a .o or .so
>> > extension (libmosek.so.6.o to be more exactly), is it possible that this
>> > type isn't compatible with orocos? I have tried some different ways of
>> > linking but i'm getting errors like:
>>
>> The command is
>>
>> target_link_libraries(<name-of-orocos-lib> libmosek.so)
>>
>> Where libmosek.so needs to be in your CMAKE library include path.
>>
>> Steven
>
> I added/edited to commands:
>
> - include(${OROCOS-RTT_USE_FILE_PATH}/UseOROCOS-RTT.cmake ~/Documents/Robotics/mosek/6/tools/platform/linux32x86/bin/libmosek.so)
> - target_link_libraries(optimization libmosek.so)
>
> and get the error:
>
> Cannot specify link libraries for target "optimization" which is not built by this project.
>
> The library created during compiling is called liboptimization-gnulinux.so (does'nt exist yet because compiling has never succeeded) but this also doesn't work, i also tried liboptimization-gnulinux.

Can you send us your CMakeLists.txt?

Steven

>
> Marijn
>
>> >
>> > - CMake Error: Cannot determine link language for target "<mosek>"
>> > - Cannot find source file "libmosek.so.6.o".  Tried extensions .c .C .c++
>> > .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx
>> > - c++: cannot specify -o with -c or -S with multiple files
>> >
>> > Many thanks in advance.
>> > Marijn Goossens
>

Linking component to external library

2012/1/28 Steven Bellens <steven [dot] bellens [..] ...>:
> 2012/1/28 Marijn Goossens <marijn [dot] goossens1 [..] ...>:
> > 2012/1/28 Steven Bellens <steven [dot] bellens [..] ...>:
> >
> > > 2012/1/28 Marijn Goossens <marijn [dot] goossens1 [..] ...>:
>> > > Dear all,
>> > >
>> > > I'm trying to make a orocos-component (to use in combination with iTaSC) in
>> > > which mosek, a numerical optimizer, is used. This program uses specific
>> > > types of variables that are loaded by including a file "mosek.h". I'm
>> > > getting compilation errors because there are undefined reference to these
>> > > specific variables in the .o-file created during compilation.
>> > >
>> > > I assume i have to link to moseklibraries somewhere during the compilation.
>> > > Is it correct that this needs to happen in the "CMakelist.txt"-file with the
>> > > command add_library or add_definitions? The mosek libraries have a .o or .so
>> > > extension (libmosek.so.6.o to be more exactly), is it possible that this
>> > > type isn't compatible with orocos? I have tried some different ways of
>> > > linking but i'm getting errors like:
>> >
>> > The command is
>>
>> > target_link_libraries(<name-of-orocos-lib> libmosek.so)
>>
>> > Where libmosek.so needs to be in your CMAKE library include path.
>> >
>> > Steven
> >
> > I added/edited to commands:
> >
> > - include(${OROCOS-RTT_USE_FILE_PATH}/UseOROCOS-RTT.cmake ~/Documents/Robotics/mosek/6/tools/platform/linux32x86/bin/libmosek.so)
> > - target_link_libraries(optimization libmosek.so)
> >
> > and get the error:
> >
> > Cannot specify link libraries for target "optimization" which is not built by this project.
> >
> > The library created during compiling is called liboptimization-gnulinux.so (does'nt exist yet because compiling has never succeeded) but this also doesn't work, i also tried liboptimization-gnulinux.
>
> Can you send us your CMakeLists.txt?
>
> Steven

It's attached to this mail.

Marijn

> >
> > Marijn
> >
>> > >
>> > > - CMake Error: Cannot determine link language for target "<mosek>"
>> > > - Cannot find source file "libmosek.so.6.o". Tried extensions .c .C .c++
>> > > .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx
>> > > - c++: cannot specify -o with -c or -S with multiple files
>> > >
>> > > Many thanks in advance.
>> > > Marijn Goossens

Linking component to external library

[...]
>>
>> Can you send us your CMakeLists.txt?
>>
>> Steven
>
> It's attached to this mail.

Move the target_link_libraries below the orocos_component statement.
The moment you want to link it, CMake doesn't now about the library
yet.

Steven

>
> Marijn
>
>> >
>> > Marijn
>> >
>>> > >
[...]