Compiling PCIe driver source code

Hi All,

I want to compile the source code, given on
http://li5.ziti.uni-heidelberg.de/mprace/pciDriver.tar.gz
using the given makefile, instructed as on the given manual.

Driver and the library source can be compiled without any problem. However, the test program, which uses the given library and the driver interface can not be compiled due to a bunch of "undefined reference to" errors. I have checked the makefiles and the related gcc/g++ options, everything seems to be correct. I can not figure out the possible "pcidriver" library linking issue. I would be really thankful if someone could help me with that problem.

Best regards,
Aziz
Please post the error messages
Warning/Error Messages:
root@ubuntu:/home/demirezen/work/mprace_rd/software/pciDriver# make all
...
-e CC testCppInterface.cpp
testCppInterface.cpp: In function ‘void testUserMemory(pciDriver::PciDevice*)’:
testCppInterface.cpp:247:44: warning: ignoring return value of ‘int posix_memalign(void**, size_t, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
testCppInterface.cpp:269:43: warning: ignoring return value of ‘int posix_memalign(void**, size_t, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
-e LD /home/demirezen/work/mprace_rd/software/pciDriver/bin/testCppInterface
/home/demirezen/work/mprace_rd/software/pciDriver/obj/testCppInterface.o: In function `testPCIconfig(pciDriver::PciDevice*)':
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:95: undefined reference to `pciDriver::PciDevice::open()'
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:103: undefined reference to `pciDriver::PciDevice::readConfigByte(unsigned int)'
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:115: undefined reference to `pciDriver::PciDevice::readConfigWord(unsigned int)'
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:127: undefined reference to `pciDriver::PciDevice::readConfigDWord(unsigned int)'
/home/demirezen/work/mprace_rd/software/pciDriver/obj/testCppInterface.o: In function `testPCImmap(pciDriver::PciDevice*)':
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:145: undefined reference to `pciDriver::PciDevice::open()'
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:150: undefined reference to `pciDriver::PciDevice::mapBAR(unsigned int)'
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:152: undefined reference to `pciDriver::PciDevice::unmapBAR(unsigned int, void*)'
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:154: undefined reference to `pciDriver::PciDevice::getBARsize(unsigned int)'
/home/demirezen/work/mprace_rd/software/pciDriver/obj/testCppInterface.o: In function `testKernelMemory(pciDriver::PciDevice*)':
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:179: undefined reference to `pciDriver::PciDevice::open()'
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:184: undefined reference to `pciDriver::PciDevice::allocKernelMemory(unsigned int)'
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:191: undefined reference to `pciDriver::KernelMemory::sync(pciDriver::KernelMemory::sync_dir)'
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:213: undefined reference to `pciDriver::KernelMemory::sync(pciDriver::KernelMemory::sync_dir)'
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:225: undefined reference to `pciDriver::KernelMemory::~KernelMemory()'
/home/demirezen/work/mprace_rd/software/pciDriver/obj/testCppInterface.o: In function `pciDriver::Exception::toString()':
/home/demirezen/work/mprace_rd/software/pciDriver/include/lib/Exception.h:53: undefined reference to `pciDriver::Exception::descriptions'
/home/demirezen/work/mprace_rd/software/pciDriver/obj/testCppInterface.o: In function `testUserMemory(pciDriver::PciDevice*)':
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:241: undefined reference to `pciDriver::PciDevice::open()'
/home/demirezen/work/mprace_rd/software/pciDriver/obj/testCppInterface.o: In function `pciDriver::PciDevice::mapUserMemory(void*, unsigned int)':
/home/demirezen/work/mprace_rd/software/pciDriver/include/lib/PciDevice.h:66: undefined reference to `pciDriver::PciDevice::mapUserMemory(void*, unsigned int, bool)'
/home/demirezen/work/mprace_rd/software/pciDriver/obj/testCppInterface.o: In function `testUserMemory(pciDriver::PciDevice*)':
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:256: undefined reference to `pciDriver::UserMemory::~UserMemory()'
/home/demirezen/work/mprace_rd/software/pciDriver/obj/testCppInterface.o: In function `pciDriver::PciDevice::mapUserMemory(void*, unsigned int)':
/home/demirezen/work/mprace_rd/software/pciDriver/include/lib/PciDevice.h:66: undefined reference to `pciDriver::PciDevice::mapUserMemory(void*, unsigned int, bool)'
/home/demirezen/work/mprace_rd/software/pciDriver/obj/testCppInterface.o: In function `testUserMemory(pciDriver::PciDevice*)':
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:281: undefined reference to `pciDriver::UserMemory::~UserMemory()'
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:288: undefined reference to `pciDriver::PciDevice::close()'
/home/demirezen/work/mprace_rd/software/pciDriver/obj/testCppInterface.o: In function `pciDriver::Exception::toString()':
/home/demirezen/work/mprace_rd/software/pciDriver/include/lib/Exception.h:53: undefined reference to `pciDriver::Exception::descriptions'
/home/demirezen/work/mprace_rd/software/pciDriver/include/lib/Exception.h:53: undefined reference to `pciDriver::Exception::descriptions'
/home/demirezen/work/mprace_rd/software/pciDriver/obj/testCppInterface.o: In function `testDevice(int)':
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:59: undefined reference to `pciDriver::PciDevice::PciDevice(int)'
/home/demirezen/work/mprace_rd/software/pciDriver/obj/testCppInterface.o: In function `pciDriver::Exception::toString()':
/home/demirezen/work/mprace_rd/software/pciDriver/include/lib/Exception.h:53: undefined reference to `pciDriver::Exception::descriptions'
/home/demirezen/work/mprace_rd/software/pciDriver/obj/testCppInterface.o: In function `testPCIconfig(pciDriver::PciDevice*)':
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:135: undefined reference to `pciDriver::PciDevice::close()'
/home/demirezen/work/mprace_rd/software/pciDriver/obj/testCppInterface.o: In function `testPCImmap(pciDriver::PciDevice*)':
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:169: undefined reference to `pciDriver::PciDevice::close()'
/home/demirezen/work/mprace_rd/software/pciDriver/obj/testCppInterface.o: In function `testKernelMemory(pciDriver::PciDevice*)':
/home/demirezen/work/mprace_rd/software/pciDriver/src/tests/testCppInterface.cpp:232: undefined reference to `pciDriver::PciDevice::close()'
collect2: ld returned 1 exit status
make[1]: *** [/home/demirezen/work/mprace_rd/software/pciDriver/bin/testCppInterface] Error 1
make: *** [tests] Error 2
In src/tests/Makefile make the output verbose (erase the $(Q)
It should output something like
CC      testCppInterface.cpp
LD      ~/pciDriver/bin/testCppInterface
g++ -L ~/pciDriver/lib -lpthread -lpcidriver -O2 -g  -I ~/pciDriver/include -I ../../include -o ~/pciDriver/bin/testCppInterface ~/pciDriver/obj/testCppInterface.o

I can't reproduce your error.
Those functions should be defined in pciDribver/lib/libpcidriver.{a,so} ¿Do you have those files?

I don't think that is a good idea to build as root.
Thank you very much for your reply.
I have the library files (.a and .so). Verbose produces the same g++ line as yours, however the errors are still there. I do not build as root all the time, but I need to become root in order to install the compiled driver.

I use Ubuntu 11.10 with the latest stable kernel 3.3.3. My toolchain is also up-to-date.
Did you manage to compile it on an older configuration?

Regards,
Aziz
Topic archived. No new replies allowed.