marcus905 / libnfc

Automatically exported from code.google.com/p/libnfc
GNU Lesser General Public License v3.0
0 stars 0 forks source link

git-head cmake linux build fails #240

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

xantares@fujitsu-l64:~/projects/libnfc/build$ cmake .. 
-DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_C_COMPILER=/usr/bin/clang
-- The C compiler identification is Clang 3.2.0
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.3.1") 
-- Found Doxyfile.in: /home/xantares/projects/libnfc/Doxyfile.in  
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28") 
-- checking for module 'libpcsclite'
--   found libpcsclite, version 1.8.8
-- Found PCSC: pcsclite  
-- checking for module 'libusb'
--   found libusb, version 0.1.12
-- Found LIBUSB: usb 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xantares/projects/libnfc/build

xantares@fujitsu-l64:~/projects/libnfc/build$ make install -j1
Scanning dependencies of target nfc
[  2%] Building C object libnfc/CMakeFiles/nfc.dir/nfc.c.o
[  5%] Building C object libnfc/CMakeFiles/nfc.dir/nfc-device.c.o
[  8%] Building C object libnfc/CMakeFiles/nfc.dir/nfc-emulation.c.o
[ 11%] Building C object libnfc/CMakeFiles/nfc.dir/nfc-internal.c.o
[ 14%] Building C object libnfc/CMakeFiles/nfc.dir/conf.c.o
[ 17%] Building C object libnfc/CMakeFiles/nfc.dir/iso14443-subr.c.o
[ 20%] Building C object libnfc/CMakeFiles/nfc.dir/mirror-subr.c.o
[ 23%] Building C object libnfc/CMakeFiles/nfc.dir/target-subr.c.o
[ 26%] Building C object libnfc/CMakeFiles/nfc.dir/log.c.o
[ 29%] Building C object libnfc/CMakeFiles/nfc.dir/drivers/acr122_pcsc.c.o
[ 32%] Building C object libnfc/CMakeFiles/nfc.dir/drivers/pn53x_usb.c.o
[ 35%] Building C object libnfc/CMakeFiles/nfc.dir/drivers/arygon.c.o
[ 38%] Building C object libnfc/CMakeFiles/nfc.dir/buses/uart.c.o
[ 41%] Building C object libnfc/CMakeFiles/nfc.dir/chips/pn53x.c.o
[ 44%] Building C object libnfc/CMakeFiles/nfc.dir/log_posix.c.o
Linking C shared library libnfc.so
[ 44%] Built target nfc
Scanning dependencies of target nfcutils
[ 47%] Building C object utils/CMakeFiles/nfcutils.dir/nfc-utils.c.o
Linking C static library libnfcutils.a
[ 47%] Built target nfcutils
Scanning dependencies of target nfc-emulate-forum-tag4
[ 50%] Building C object 
utils/CMakeFiles/nfc-emulate-forum-tag4.dir/nfc-emulate-forum-tag4.c.o
Linking C executable nfc-emulate-forum-tag4
../libnfc/libnfc.so.0: error: undefined reference to 'usb_prepare'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [utils/nfc-emulate-forum-tag4] Error 1
make[1]: *** [utils/CMakeFiles/nfc-emulate-forum-tag4.dir/all] Error 2
make: *** [all] Error 2

Please provide any additional information below.
The LIBUSB_FOUND variable is used before the libusb detection is performed, to 
decide which BUSES_SOURCES get included @libnfc/CMakeLists.txt:15 
The embedded patch moves the 'LibnfcDriver' module inclusion in the root 
CMakeLists, before subdirectories recursion.

Regards.

Original issue reported on code.google.com by julien.s...@gmail.com on 11 Mar 2013 at 7:45

Attachments:

GoogleCodeExporter commented 9 years ago
Thank you.
Stupid question as I'm not familiar with cmake:
Any reason to move the include to the top CMakefile rather than just a few 
lines upper before the IF(LIBUSB_FOUND) ?

Original comment by yob...@gmail.com on 12 Mar 2013 at 5:51

GoogleCodeExporter commented 9 years ago
Hi,

I think so because I you need the libusb vars in the top namespace to link
test executables if libusb is dso referenced in a custom path.

That being said we can see why my patch is wrong, the include should be
moved @CMakeLists.txt:113  : before pcsc and libusb vars are used:

INCLUDE(LibnfcDrivers) -> find_package(pscs) ; find_package(libusb)

IF(PCSC_INCLUDE_DIRS)
....

IF(LIBUSB_INCLUDE_DIRS)
...

Cheers!

Original comment by julien.s...@gmail.com on 12 Mar 2013 at 6:28

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 8485996f131d.

Original comment by yob...@gmail.com on 12 Mar 2013 at 7:57