« Return to Thread: Compiling Plugin Driver
Thanks for your help. I have now been able to compile it and "insert it" into
player as a plugin driver using the example Makefile as suggested.
My makefile looks like this:
// ------------------------------------- Beginning of Makefile
----------------------------------------//
CXX = g++
CXXLD = g++
LIBTOOL = libtool
PLAYER_CFLAGS = `pkg-config --cflags playercore`
INSTALL_DIR = /home/jakob/PSG/PSG_Source/player/plugins/vmc
all: libvmc.la
libvmc.la: vmc.lo vmc_serial.lo
$(LIBTOOL) --mode=link $(CXXLD) -rpath $(INSTALL_DIR) -module
-export-dynamic -version-info 0:0:0 $< -o $@
%.lo: %.cc
$(LIBTOOL) --mode=compile $(CXX) -c $(PLAYER_CFLAGS) $<
clean:
rm -rf *.o *.lo *.la .libs
// ------------------------------------- End of Makefile
----------------------------------------//
I am now getting the following output when running player with a file called
vmc.cfg:
// ------------------------------------- Beginning of output
----------------------------------------//
...
trying to load /home/jakob/PSG/PSG_Source/player/plugins/vmc/./libvmc...
success
invoking player_driver_init()...
VMC driver initializing
VMC driver done
success
Maximum velocity is: 0.500 m/s
listening on 6665
Listening on ports: 6665
// ------------------------------------- End of output
-----------------------------------------------//
The .cfg file looks like this:
// ------------------------------------- Beginning of cfg
--------------------------------------------//
driver
(
name "vmc"
plugin "libvmc"
provides ["position3d:0"]
# port "/dev/ttyS1"
)
// ------------------------------------- End of cfg
---------------------------------------------------//
I then run a test program which tries to connect to the position3d interface
provided by the driver.
The file looks like this:
// ------------------------------------- Beginning of file
-------------------------------------------//
#include "args.h"
using namespace PlayerCc;
using namespace std;
// Main function controlling the behaviour of the master robot
int main(int argc, char **argv)
{
// We throw exceptions on creation if we fail
try
{
PlayerClient robot(gHostname, 6665);
std::cout << "Robot: " << robot << std::endl;
Position3dProxy pp3(&robot, 0);
std::cout << "Pos: " << pp3 << std::endl;
// Infinite loop
while(1)
{
robot.Read();
}
}
catch (PlayerCc::PlayerError e)
{
std::cerr << e << std::endl;
return -1;
}
}
// ------------------------------------- End of File
--------------------------------------------------//
However, when I run the test program I get the following output in the
player window:
// ------------------------------------- Beginning of output
----------------------------------------//
accepted TCP client 0 on port 6665, fd 6
Trying to subscribe
VMC driver initialising
player: symbol lookup error:
/home/jakob/PSG/PSG_Source/player/plugins/vmc/./.libs/libvmc.so.0: undefined
symbol: _ZN9VMCSerialC1EPci
// ------------------------------------- End of output
-----------------------------------------------//
Any ideas what could be wrong?
because your original makefile is trying to build an executable it is
requiring all symbols to be bound, and also requiring the start up method,
i.e. main to be present. You should build plugins as .so's not as an
application.
Toby
On 19/10/2007, AASS <bananen_6@...> wrote:
>
>
> As I understand it, this creates an .so file using the available .o file.
> However, I am unable to get a .o file since I get the errors mentioned in
> the previous post.
>
> I get the following:
> make: *** No rule to make target `vmc_driver.o', needed by
> `vmc_driver.so'.> >> all: clean driver serial
> Stop.
>
>
>
> Toby Collett-3 wrote:
> >
> > try looking at the Makefile.example which is included with the example
> > plugin...
> >
> > # Desc: Example plugin makefile
> > # CVS: $Id: Makefile.example,v 1.6 2005/08/17 23:55:59 gerkey Exp $
> >
> > all: libexampledriver.so
> >
> > %.o: %.cc
> > $(CXX) -Wall -fpic -g3 `pkg-config --cflags playercore` -c $<
> >
> > libexampledriver.so: exampledriver.o
> > $(CXX) -shared -nostartfiles -o $@ $<
> >
> > clean:
> > rm -f *.o *.so
> >
> >
> > On 19/10/2007, AASS < bananen_6@...> wrote:
> >>
> >>
> >> I'm having problems compiling a driver I have written.
> >>
> >> I have read several posts regarding how to get the driver into the
> plugin
> >> drivers but I am having problems even compiling to get the .o files. I
> >> get
> >> the following error:
> >>
> >> /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crt1.o: In function
> >> `_start':
> >> (.text+0x18): undefined reference to `main'
> >> /tmp/ccrhEQex.o: In function `Alfred::Alfred(ConfigFile*, int)':
> >> alfred_driver.cc:(.text+0x77): undefined reference to
> >> `Driver::Driver(ConfigFile*, int, bool, unsigned int, int)'
> >> /tmp/ccrhEQex.o: In function `Alfred::Alfred(ConfigFile*, int)':
> >> alfred_driver.cc:(.text+0xbb): undefined reference to
> >> `Driver::Driver(ConfigFile*, int, bool, unsigned int, int)'
> >> /tmp/ccrhEQex.o: In function `Driver::Update()':
> >> alfred_driver.cc:(.text._ZN6Driver6UpdateEv[Driver::Update()]+0x17):
> >> undefined reference to `Driver::ProcessMessages()'
> >> /tmp/ccrhEQex.o: In function `Alfred::~Alfred()':
> >> alfred_driver.cc:(.text._ZN6AlfredD0Ev[Alfred::~Alfred()]+0x17):
> >> undefined
> >> reference to `Driver::~Driver()'
> >> /tmp/ccrhEQex.o: In function `Alfred::~Alfred()':
> >> alfred_driver.cc:(.text._ZN6AlfredD1Ev[Alfred::~Alfred()]+0x17):
> >> undefined
> >> reference to `Driver::~Driver()'
> >> /tmp/ccrhEQex.o:(.rodata._ZTV6Alfred[vtable for Alfred]+0x8): undefined
> >> reference to `Driver::StartThread()'
> >> /tmp/ccrhEQex.o:(.rodata._ZTV6Alfred[vtable for Alfred]+0xc): undefined
> >> reference to `Driver::StopThread()'
> >> ...
> >> (and a lot more undefined reference errors)
> >>
> >> I even tried compiling exampledriver.cc found in
> player/examples/plugins/
> >> but I get the same results. I suspect it is the makefile I am using,
> >> (which
> >> is my own as I cannot really understand the provided makefile in the
> >> example). It looks like this:
> >>
> >> // ---- Start of Makefile ------///
> >>--
> >>
> >> clean:
> >> \rm -f *.o *~ vmc_serial vmc_driver
> >>
> >> serial: vmc_serial.cc
> >> g++ -Wall `pkg-config --cflags playerc++` -o vmc_serial
> >> vmc_serial.cc `pkg-config --libs playerc++`
> >>
> >> driver: vmc_driver.cc
> >> g++ -Wall `pkg-config --cflags playerc++` -o vmc_driver
> >> vmc_driver.cc `pkg-config --libs playerc++`
> >>
> >> // ---- End of Makefile ------///
> >>
> >> Any help would be greatly appreciated.
> >>
View this message in context: http://www.nabble.com/Compiling-Plugin-Driver-tf4648834.html#a13362258
Sent from the playerstage-users mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Playerstage-users mailing list
Playerstage-users@...
https://lists.sourceforge.net/lists/listinfo/playerstage-users
« Return to Thread: Compiling Plugin Driver
| Free embeddable forum powered by Nabble | Forum Help |