Build orocos component with make / pkg-config ?

Does anyone have an up-to-date example of how to build an orocos
component with Makefiles and pkg-config on linux?

Context: I'm tinkering with simplifying our build system by ripping
out ROS, replacing CMake with tup (gittup.org/tup), and flattening the
directory structure within each component. If someone has a make
based build, it would be good to pattern match off of. If I achieve
something I'm happy with, I'll post about it. I know about
CMAKE_VERBOSE_MAKEFILE and generally how to reverse-engineer an
existing build, but I'm hoping someone can save me some time.

Cheers,
Andrew

Build orocos component with make / pkg-config ?

Hi Andrew,

On Tue, Nov 20, 2012 at 7:50 PM, Andrew Wagner <drewm1980 [..] ...> wrote:
> Does anyone have an up-to-date example of how to build an orocos
> component with Makefiles and pkg-config on linux?
>
> Context: I'm tinkering with simplifying our build system by ripping
> out ROS, replacing CMake with tup (gittup.org/tup), and flattening the
> directory structure within each component. If someone has a make
> based build, it would be good to pattern match off of. If I achieve
> something I'm happy with, I'll post about it. I know about
> CMAKE_VERBOSE_MAKEFILE and generally how to reverse-engineer an
> existing build, but I'm hoping someone can save me some time.

We generate .pc files for everything, RTT, OCL and each component
built with the UseOrocos.cmake macros.

If you want to go back to the old age, see the bottom of this page:

http://people.mech.kuleuven.be/~orocos/pub/stable/documentation/rtt/v1.1...

Switching build systems is extremely expensive, actually, I consider
it as the greatest underestimated thing often done.
Even if you switch to something as powerful as tup or cmake.

That's why Orocos (and ROS) provide cmake macros to make it users more
convenient (we pick up .pc flags automatically for example). Making up
your own is imho a total waste of time which you will probably never
earn back. Think about the real code you could have written...

Peter

Build orocos component with make / pkg-config ?

On Wed, Nov 21, 2012 at 10:55 PM, Peter Soetens
<peter [..] ...> wrote:
> We generate .pc files for everything, RTT, OCL and each component
> built with the UseOrocos.cmake macros.
>
> If you want to go back to the old age, see the bottom of this page:
>
> http://people.mech.kuleuven.be/~orocos/pub/stable/documentation/rtt/v1.1...

Thanks Peter! I think I was just missing the pkg-config
orocos-ocl-gnulinux; I'll try that out.

> Switching build systems is extremely expensive, actually, I consider
> it as the greatest underestimated thing often done.
> Even if you switch to something as powerful as tup or cmake.
>
> That's why Orocos (and ROS) provide cmake macros to make it users more
> convenient (we pick up .pc flags automatically for example). Making up
> your own is imho a total waste of time which you will probably never
> earn back. Think about the real code you could have written...

If you have a well maintained, well designed build setup, I agree you
should continue using it instead of starting over. This is not the
situation we're currently in. We're in good company; in the next
version ROS they are also starting from scratch with their build
configuration.

Another factor is that our code went through a phase of rapid messy
expansion, and I have already decided to dedicate a large chunk of
time to cleaning things up.

Cheers,
Andrew

Build orocos component with make / pkg-config ?

2012/11/22 Andrew Wagner <drewm1980 [..] ...>

> On Wed, Nov 21, 2012 at 10:55 PM, Peter Soetens
> <peter [..] ...> wrote:
> > We generate .pc files for everything, RTT, OCL and each component
> > built with the UseOrocos.cmake macros.
> >
> > If you want to go back to the old age, see the bottom of this page:
> >
> >
> http://people.mech.kuleuven.be/~orocos/pub/stable/documentation/rtt/v1.1...
>
> Thanks Peter! I think I was just missing the pkg-config
> orocos-ocl-gnulinux; I'll try that out.
>
> > Switching build systems is extremely expensive, actually, I consider
> > it as the greatest underestimated thing often done.
> > Even if you switch to something as powerful as tup or cmake.
> >
> > That's why Orocos (and ROS) provide cmake macros to make it users more
> > convenient (we pick up .pc flags automatically for example). Making up
> > your own is imho a total waste of time which you will probably never
> > earn back. Think about the real code you could have written...
>
> If you have a well maintained, well designed build setup, I agree you
> should continue using it instead of starting over. This is not the
> situation we're currently in. We're in good company; in the next
> version ROS they are also starting from scratch with their build
> configuration.
>

Have you considered using Autoproj?
I personally use it daily to manage the Orocos toolchain, non-Orocos libs,
3rd-party libs, dependencies, ...

It is really easy to use, will build/install your packages whatever their
build process (cmake, autotools, ruby, sources_only, ...)
It is also very easy to extend, and has a very good support ;)

Charles.

>
> Another factor is that our code went through a phase of rapid messy
> expansion, and I have already decided to dedicate a large chunk of
> time to cleaning things up.
>
> Cheers,
> Andrew
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>

Build orocos component with make / pkg-config ?

Something is wrong with my build/link, and I am getting the following
error in the deployer when I try to link the component into
deployer-gnulinux:

Deployer [S]> import ("masterTimer")
1.581 [ ERROR ][DeploymentComponent::import] Unloading
masterTimer/masterTimer.so: not a valid component library:
1.581 [ ERROR ][DeploymentComponent::import]
masterTimer/masterTimer.so: undefined symbol: createComponent
1.581 [ ERROR ][DeploymentComponent::import]
masterTimer/masterTimer.so: undefined symbol: getComponentType
1.582 [ ERROR ][DeploymentComponent::import] Unloading
./masterTimer/masterTimer.so: not a valid component library:
1.582 [ ERROR ][DeploymentComponent::import]
./masterTimer/masterTimer.so: undefined symbol: createComponent
1.582 [ ERROR ][DeploymentComponent::import]
./masterTimer/masterTimer.so: undefined symbol: getComponentType

rtt and ocl from git are installed undir /usr/local using a standard
cmake, make, make install.

Here is my build command:

clang++ -Wall -O0 -g -fPIC -DRTT_COMPONENT -DOCL_DLL_EXPORT
`pkg-config --cflags orocos-rtt-gnulinux` `pkg-config --cflags
orocos-ocl-gnulinux` -c masterTimer.cpp -o masterTimer.o

Here is my link command:

clang++ `pkg-config --libs orocos-rtt-gnulinux` `pkg-config --libs
orocos-ocl-gnulinux` -shared -Wl,-soname,masterTimer.so -o
masterTimer.so

Here is what `pkg-config --libs orocos-rtt-gnulinux
orocos-ocl-gnulinux` returns:

-L/usr/local/lib -L/usr/local/lib/orocos/gnulinux/ocl
-L/usr/local/lib/orocos/gnulinux/ocl/plugins
-L/usr/local/lib/orocos/gnulinux/ocl/types
-lorocos-ocl-common-gnulinux -lprint-gnulinux -los-gnulinux
-locl-gnulinux -lorocos-rtt-gnulinux -lpthread -lrt

I can go dig into the source and figure out what library has those
symbols, but perhaps someone knows from a glance what is missing?

Thanks!
Andrew

Build orocos component with make / pkg-config ?

On Thu, Nov 22, 2012 at 12:05 PM, Andrew Wagner <drewm1980 [..] ...> wrote:

> Something is wrong with my build/link, and I am getting the following
> error in the deployer when I try to link the component into
> deployer-gnulinux:
>
> Deployer [S]> import ("masterTimer")
> 1.581 [ ERROR ][DeploymentComponent::import] Unloading
> masterTimer/masterTimer.so: not a valid component library:
> 1.581 [ ERROR ][DeploymentComponent::import]
> masterTimer/masterTimer.so: undefined symbol: createComponent
> 1.581 [ ERROR ][DeploymentComponent::import]
> masterTimer/masterTimer.so: undefined symbol: getComponentType
> 1.582 [ ERROR ][DeploymentComponent::import] Unloading
> ./masterTimer/masterTimer.so: not a valid component library:
> 1.582 [ ERROR ][DeploymentComponent::import]
> ./masterTimer/masterTimer.so: undefined symbol: createComponent
> 1.582 [ ERROR ][DeploymentComponent::import]
> ./masterTimer/masterTimer.so: undefined symbol: getComponentType
>
>
These errors mean that the -DRTT_COMPONENT flag was missing *or* that you
forgot to use the correct macros in your .cpp file to generate these
functions.

> rtt and ocl from git are installed undir /usr/local using a standard
> cmake, make, make install.
>
> Here is my build command:
>
> clang++ -Wall -O0 -g -fPIC -DRTT_COMPONENT -DOCL_DLL_EXPORT
> `pkg-config --cflags orocos-rtt-gnulinux` `pkg-config --cflags
> orocos-ocl-gnulinux` -c masterTimer.cpp -o masterTimer.o
>

You can't use OCL_DLL_EXPORT. That's only for compiling OCL, not for you.

>
> Here is my link command:
>
> clang++ `pkg-config --libs orocos-rtt-gnulinux` `pkg-config --libs
> orocos-ocl-gnulinux` -shared -Wl,-soname,masterTimer.so -o
> masterTimer.so
>
> Here is what `pkg-config --libs orocos-rtt-gnulinux
> orocos-ocl-gnulinux` returns:
>
> -L/usr/local/lib -L/usr/local/lib/orocos/gnulinux/ocl
> -L/usr/local/lib/orocos/gnulinux/ocl/plugins
> -L/usr/local/lib/orocos/gnulinux/ocl/types
> -lorocos-ocl-common-gnulinux -lprint-gnulinux -los-gnulinux
> -locl-gnulinux -lorocos-rtt-gnulinux -lpthread -lrt
>
> I can go dig into the source and figure out what library has those
> symbols, but perhaps someone knows from a glance what is missing?
>

ORO_CREATE_COMPONENT( masterTimer )

?

Peter

Build orocos component with make / pkg-config ?

On Thu, Nov 22, 2012 at 1:23 PM, Peter Soetens <peter [..] ...> wrote:
> *or* that you forgot to use the correct macros in your .cpp file to generate these functions.

I already had that (this component is known to work), but just knowing
that those functions are generated by the ORO_CREATE_COMPONENT macro
helped guide my debugging. It turns out that my link command had the
rather embarrassing mistake of not actually including the .o file!
Thanks Peter!

Now when I import my component, I only get a rather benign warning.
It appears that the deployer is scanning my component's directory
twice because it is not aware that the directory "masterTimer" is the
same as the directory "./masterTimer". Is this a mild bug that should
be fixed in the deployer, or should I tinker more with the relevant
environment variables for OROCOS's search path?

Deployer [S]> import ("masterTimer")
44.273 [ Info ][DeploymentComponent::import] Importing directory
masterTimer ...
44.273 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/manifest_electric.xml ...not a .so library: ignored.
44.273 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/manifest_diamondback.xml ...not a .so library: ignored.
44.273 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/masterTimer.cpp ...not a .so library: ignored.
44.273 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/masterTimer.ops ...not a .so library: ignored.
44.273 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/masterTimer.hpp ...not a .so library: ignored.
44.273 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/runmasterTimer.sh ...not a .so library: ignored.
44.294 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/masterTimer.so ...Succesfully loaded masterTimer.so
44.295 [ Info ][DeploymentComponent::import] Loaded component type
'OCL::MasterTimer'
44.295 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/.gitignore ...not a .so library: ignored.
44.295 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/.Tupfile.swp ...not a .so library: ignored.
44.295 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/.manifest_electric.xml.swp ...not a .so library: ignored.
44.295 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/orocos.log ...not a .so library: ignored.
44.295 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/manifest.xml ...not a .so library: ignored.
44.295 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/masterTimer.o ...not a .so library: ignored.
44.295 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/README.txt ...not a .so library: ignored.
44.295 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/.tb_history ...not a .so library: ignored.
44.295 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/.masterTimer.cpp.swp ...not a .so library: ignored.
44.295 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/Tupfile ...not a .so library: ignored.
44.295 [ Debug ][DeploymentComponent::import] Scanning file
masterTimer/.runmasterTimer.sh.swp ...not a .so library: ignored.
44.295 [ Debug ][DeploymentComponent::import] Looking for plugins or
typekits in directory masterTimer ...
44.295 [ Debug ][DeploymentComponent::import] No such directory:
"masterTimer/types"
44.295 [ Debug ][DeploymentComponent::import] No such directory:
"masterTimer/plugins"
44.295 [ Debug ][DeploymentComponent::import] No such directory:
"masterTimer/gnulinux"
44.296 [ Info ][DeploymentComponent::import] Importing directory
./masterTimer ...
44.296 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/manifest_electric.xml ...not a .so library: ignored.
44.296 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/manifest_diamondback.xml ...not a .so library: ignored.
44.296 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/masterTimer.cpp ...not a .so library: ignored.
44.296 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/masterTimer.ops ...not a .so library: ignored.
44.296 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/masterTimer.hpp ...not a .so library: ignored.
44.296 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/runmasterTimer.sh ...not a .so library: ignored.
44.296 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/masterTimer.so ...Succesfully loaded masterTimer.so
44.296 [ Warning][DeploymentComponent::import] Component type name
OCL::MasterTimer already used: overriding.
44.296 [ Info ][DeploymentComponent::import] Loaded component type
'OCL::MasterTimer'
44.296 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/.gitignore ...not a .so library: ignored.
44.296 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/.Tupfile.swp ...not a .so library: ignored.
44.296 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/.manifest_electric.xml.swp ...not a .so library:
ignored.
44.296 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/orocos.log ...not a .so library: ignored.
44.296 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/manifest.xml ...not a .so library: ignored.
44.296 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/masterTimer.o ...not a .so library: ignored.
44.297 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/README.txt ...not a .so library: ignored.
44.297 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/.tb_history ...not a .so library: ignored.
44.297 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/.masterTimer.cpp.swp ...not a .so library: ignored.
44.297 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/Tupfile ...not a .so library: ignored.
44.297 [ Debug ][DeploymentComponent::import] Scanning file
./masterTimer/.runmasterTimer.sh.swp ...not a .so library: ignored.
44.297 [ Debug ][DeploymentComponent::import] Looking for plugins or
typekits in directory ./masterTimer ...
44.297 [ Debug ][DeploymentComponent::import] No such directory:
"./masterTimer/types"
44.297 [ Debug ][DeploymentComponent::import] No such directory:
"./masterTimer/plugins"
= true

Build orocos component with make / pkg-config ?

On Thu, Nov 22, 2012 at 2:28 PM, Andrew Wagner <drewm1980 [..] ...> wrote:

> On Thu, Nov 22, 2012 at 1:23 PM, Peter Soetens <peter [..] ...>
> wrote:
> > *or* that you forgot to use the correct macros in your .cpp file to
> generate these functions.
>
> I already had that (this component is known to work), but just knowing
> that those functions are generated by the ORO_CREATE_COMPONENT macro
> helped guide my debugging. It turns out that my link command had the
> rather embarrassing mistake of not actually including the .o file!
> Thanks Peter!
>
> Now when I import my component, I only get a rather benign warning.
> It appears that the deployer is scanning my component's directory
> twice because it is not aware that the directory "masterTimer" is the
> same as the directory "./masterTimer". Is this a mild bug that should
> be fixed in the deployer, or should I tinker more with the relevant
> environment variables for OROCOS's search path?
>

Yes, this needs fixing. It should probably sort the search directories and
remove duplicates somehow. This has always been a tricky thing, since we
wanted to be compatible with:

- RTT_COMPONENT_PATH
- local directories (ie relative to the deployer's CWD)
- ROS package directories (ie in components built in ros dir. layout)
- orogen directories (ie installed components using the orogen dir. layout)
- UseOrocos.cmake directories (ie handcoded Orocos components + cmake)

Peter