janwilmans / nowindlibraries

Support libraries for nowind interface and developer emulation environment
https://github.com/janwilmans/nowindlibraries
MIT License
1 stars 0 forks source link

failure to compile under Ubuntu (12.04) #16

Closed GoogleCodeExporter closed 8 years ago

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

* Follow the compiling instructions (install required tools, libraries) 
(compile-readme.txt)
* do 'cmake -G 'Unix Makefiles' (gives no errors)
* next, doing 'make' gives the following output:

[  9%] Built target nwgeneral
[ 63%] Built target nwhost
[ 78%] Built target ftdx
[ 87%] Built target nowind
Linking CXX executable nwhostapp
../ftdx/libftdx.a(ConLibFtdi.cpp.o): In function `ftdx::ConLibFtdi::open()':
ConLibFtdi.cpp:(.text+0xe1): undefined reference to `ftdi_init'
ConLibFtdi.cpp:(.text+0xff): undefined reference to `ftdi_usb_open'
ConLibFtdi.cpp:(.text+0x129): undefined reference to `ftdi_set_latency_timer'
../ftdx/libftdx.a(ConLibFtdi.cpp.o): In function `ftdx::ConLibFtdi::close()':
ConLibFtdi.cpp:(.text+0x17d): undefined reference to `ftdi_usb_close'
ConLibFtdi.cpp:(.text+0x18b): undefined reference to `ftdi_deinit'
../ftdx/libftdx.a(ConLibFtdi.cpp.o): In function 
`ftdx::ConLibFtdi::readExact(unsigned char*, unsigned long)':
ConLibFtdi.cpp:(.text+0x1c7): undefined reference to `ftdi_read_data'
../ftdx/libftdx.a(ConLibFtdi.cpp.o): In function 
`ftdx::ConLibFtdi::readBlocking(unsigned char*, unsigned long)':
ConLibFtdi.cpp:(.text+0x2dd): undefined reference to `ftdi_read_data'
../ftdx/libftdx.a(ConLibFtdi.cpp.o): In function 
`ftdx::ConLibFtdi::write(unsigned char*, unsigned long, unsigned long*)':
ConLibFtdi.cpp:(.text+0x34c): undefined reference to `ftdi_write_data'
ConLibFtdi.cpp:(.text+0x363): undefined reference to `ftdi_get_error_string'
../ftdx/libftdx.a(ConLibFtdi.cpp.o): In function `ftdx::ConLibFtdi::reset()':
ConLibFtdi.cpp:(.text+0x392): undefined reference to `ftdi_usb_reset'
../ftdx/libftdx.a(ConLibFtdi.cpp.o): In function `ftdx::ConLibFtdi::purgeRx()':
ConLibFtdi.cpp:(.text+0x3b8): undefined reference to `ftdi_usb_purge_rx_buffer'
../ftdx/libftdx.a(ConLibFtdi.cpp.o): In function `ftdx::ConLibFtdi::purgeTx()':
ConLibFtdi.cpp:(.text+0x3ce): undefined reference to `ftdi_usb_purge_tx_buffer'
collect2: ld returned 1 exit status
make[2]: *** [nwhostapp/nwhostapp] Error 1
make[1]: *** [nwhostapp/CMakeFiles/nwhostapp.dir/all] Error 2
make: *** [all] Error 2

What is the expected output? What do you see instead?

Expected output is a fully compiled and working nwhostapp, but 'make' fails 
with 'undefined reference' errors

What version of the product are you using? On what operating system?

Latest nowindlibraries source from svn, Ubuntu 12.04.

Please provide any additional information below.

Disgerarding Boost and cmake, but using the following as 'Makefile' in the 
nowindlibraries-read-only directory and using only 'make' will compile 
nwhostapp. Some warnings might be shown, but nwhostapp will work correctly.
nwhostapp must be run as root (sudo)

CXX = g++
LD = ld
RM = rm -f
RMDIR = rm -rf
MAKE = make
CXXFLAGS += -g -Wall
LDFLAGS = 
MKDIR = mkdir -p

general_SOURCES := $(wildcard general/*.cpp)
general_HEADERS := $(wildcard general/*.h)
general_OBJECTS := $(general_SOURCES:%.cpp=%.o)

nwhost_SOURCES := $(wildcard nwhost/*.cpp nwhost/*.cc)
nwhost_HEADERS := $(wildcard nwhost/*.h nwhost/*.hh)
nwhost_OBJECTS := $(nwhost_SOURCES:%.cpp=%.o)
nwhost_OBJECTS := $(nwhost_OBJECTS:%.cc=%.o)
nwhost_INCLUDES:= -Igeneral

ftdx_SOURCES := ftdx/ftdx.cpp ftdx/UsbStream.cpp ftdx/ConLibFtdi.cpp 
ftdx/ConFtdiSio.cpp
ftdx_HEADERS := $(wildcard ftdx/*.h)
ftdx_OBJECTS := $(ftdx_SOURCES:%.cpp=%.o)
ftdx_INCLUDES:= -Igeneral

nowind_SOURCES := nowind/Attribute.cpp nowind/NwhostService.cpp 
nowind/nowind.cpp
nowind_HEADERS := $(wildcard nowind/*.h)
nowind_OBJECTS := $(nowind_SOURCES:%.cpp=%.o)
nowind_INCLUDES:= -Igeneral -Inwhost -Iftdx

nwhostapp_SOURCES := $(wildcard nwhostapp/*.cpp)
nwhostapp_HEADERS := $(wildcard nwhostapp/*.h)
nwhostapp_OBJECTS := $(nwhostapp_SOURCES:%.cpp=%.o)
nwhostapp_APPNAME := nwhostapp/nwhostapp
nwhostapp_INCLUDES:= -Igeneral -Inwhost -Iftdx -Inowind
nwhostapp_LIBS    := -lftdi -lboost_system -lboost_filesystem

.PHONY: all clean

all: $(nwhostapp_APPNAME)

clean:
    @echo Cleaning general
    @$(RM) general/*.o
    @echo Cleaning nwhost
    @$(RM) nwhost/*.o
    @echo Cleaning ftdx
    @$(RM) ftdx/*.o
    @echo Cleaning nwhost
    @$(RM) nowind/*.o
    @echo Cleaning nwhostapp
    @$(RM) nwhostapp/*.o $(nwhostapp_APPNAME)

# nwhostapp 

$(nwhostapp_APPNAME): $(general_OBJECTS) $(nwhost_OBJECTS) $(ftdx_OBJECTS) 
$(nowind_OBJECTS) $(nwhostapp_OBJECTS)
    @echo Linking nwhostapp
    @$(CXX) -o $(nwhostapp_APPNAME) $(nwhostapp_OBJECTS) $(general_OBJECTS) $(nwhost_OBJECTS) \
               $(ftdx_OBJECTS) $(nowind_OBJECTS)  $(nwhostapp_LIBS)

general/%.o: general/%.cpp $(nwhostapp_HEADERS) $(general_HEADERS) 
$(nwhost_HEADERS) $(ftdx_HEADERS) $(nowind_HEADERS) 
    @echo Compiling $<
    @$(CXX) -o $@ $(CXXFLAGS) $(nwhostapp_INCLUDES) -c $<

nwhost/%.o: nwhost/%.cpp $(general_HEADERS) $(nwhost_HEADERS)
    @echo Compiling $<
    @$(CXX) -o $@ $(CXXFLAGS) $(nwhostapp_INCLUDES) -c $<

nwhost/%.o: nwhost/%.cc $(general_HEADERS) $(nwhost_HEADERS)
    @echo Compiling $<
    @$(CXX) -o $@ $(CXXFLAGS) $(nwhostapp_INCLUDES) -c $<

ftdx/%.o: ftdx/%.cpp $(general_HEADERS) $(ftdx_HEADERS)
    @echo Compiling $<
    @$(CXX) -o $@ $(CXXFLAGS) $(nwhostapp_INCLUDES) -c $<

nowind/%.o: nowind/%.cpp $(general_HEADERS) $(nwhost_HEADERS) $(ftdx_HEADERS) 
$(nowind_HEADERS) 
    @echo Compiling $<
    @$(CXX) -o $@ $(CXXFLAGS) $(nwhostapp_INCLUDES) -c $<

nwhostapp/%.o: nwhostapp/%.cpp $(general_HEADERS) $(nwhost_HEADERS) 
$(ftdx_HEADERS) $(nowind_HEADERS) $(nwhostapp_HEADERS)
    @echo Compiling $<
    @$(CXX) -o $@ $(CXXFLAGS) $(nwhostapp_INCLUDES) -c $<

Original issue reported on code.google.com by ainoya...@gmail.com on 24 Jul 2012 at 7:34

GoogleCodeExporter commented 8 years ago
cmake > 2.8.0 seems to be more sensitive to newlines and non-ascii chars, i 
have moved several thinks onto single lines, it seems to fix the issue

Original comment by janwilm...@gmail.com on 24 Jul 2012 at 8:27