JoowonCHA / openzwave-control-panel

Automatically exported from code.google.com/p/openzwave-control-panel
0 stars 0 forks source link

Cross compilation for Asus RT-N16 fails #2

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I have Asus RT-N16 (running on Broadcom 47xx, linux). Trying to cross-compile 
that on Ubuntu 10.04 (thru VMWare Player).

What steps will reproduce the problem?
1. Download toochain from 
http://code.google.com/p/wl500g/downloads/list?can=3&q=hndtools-mipsel-uclibc-4.
4.6-K26&colspec=Filename+Summary+Uploaded+Size+DownloadCount
2. Add that to the path:
PATH=$PATH:/home/user/hndtools-mipsel-uclibc-4.4.6-K26/bin/
3. Install subversion:
sudo apt-get install subversion
4. Checkout all needed files:
svn checkout http://openzwave-control-panel.googlecode.com/svn/trunk/ 
openzwave-control-panel
svn checkout http://open-zwave.googlecode.com/svn/trunk/ open-zwave
svn checkout https://gnunet.org/svn/libmicrohttpd/ libmicrohttpd
5. Change the Makefile
CC     := mipsel-linux-gcc
CXX    := mipsel-linux-g++
LD     := mipsel-linux-g++
6. Run make:
user@ubuntu1004desktop:~/openzwave-control-panel$ make
linux-mipsel-g++ -c -Wall -Wno-format -g -DDEBUG -Werror -I 
../open-zwave/cpp/src -I ../open-zwave/cpp/src/command_classes/ -I 
../open-zwave/cpp/src/value_classes/ -I ../open-zwave/cpp/src/platform/ -I 
../open-zwave/cpp/src/platform/unix -I ../open-zwave/cpp/tinyxml/ -I 
../libmicrohttpd/src/include -o ozwcp.o ozwcp.cpp
make: linux-mipsel-g++: Command not found
make: *** [ozwcp.o] Error 127
user@ubuntu1004desktop:~/openzwave-control-panel$ make
/home/user/hndtools-mipsel-uclibc-4.4.6-K26/bin/linux-mipsel-g++ -c -Wall 
-Wno-format -g -DDEBUG -Werror -I ../open-zwave/cpp/src -I 
../open-zwave/cpp/src/command_classes/ -I ../open-zwave/cpp/src/value_classes/ 
-I ../open-zwave/cpp/src/platform/ -I ../open-zwave/cpp/src/platform/unix -I 
../open-zwave/cpp/tinyxml/ -I ../libmicrohttpd/src/include -o ozwcp.o ozwcp.cpp
make: /home/user/hndtools-mipsel-uclibc-4.4.6-K26/bin/linux-mipsel-g++: Command 
not found
make: *** [ozwcp.o] Error 127
user@ubuntu1004desktop:~/openzwave-control-panel$ make
mipsel-linux-g++ -c -Wall -Wno-format -g -DDEBUG -Werror -I 
../open-zwave/cpp/src -I ../open-zwave/cpp/src/command_classes/ -I 
../open-zwave/cpp/src/value_classes/ -I ../open-zwave/cpp/src/platform/ -I 
../open-zwave/cpp/src/platform/unix -I ../open-zwave/cpp/tinyxml/ -I 
../libmicrohttpd/src/include -o ozwcp.o ozwcp.cpp
mipsel-linux-g++ -c -Wall -Wno-format -g -DDEBUG -Werror -I 
../open-zwave/cpp/src -I ../open-zwave/cpp/src/command_classes/ -I 
../open-zwave/cpp/src/value_classes/ -I ../open-zwave/cpp/src/platform/ -I 
../open-zwave/cpp/src/platform/unix -I ../open-zwave/cpp/tinyxml/ -I 
../libmicrohttpd/src/include -o webserver.o webserver.cpp
mipsel-linux-g++ -c -Wall -Wno-format -g -DDEBUG -Werror -I 
../open-zwave/cpp/src -I ../open-zwave/cpp/src/command_classes/ -I 
../open-zwave/cpp/src/value_classes/ -I ../open-zwave/cpp/src/platform/ -I 
../open-zwave/cpp/src/platform/unix -I ../open-zwave/cpp/tinyxml/ -I 
../libmicrohttpd/src/include -o zwavelib.o zwavelib.cpp
mipsel-linux-g++ -o ozwcp -g ozwcp.o webserver.o zwavelib.o   
../libmicrohttpd/src/daemon/.libs/libmicrohttpd.a -pthread -framework IOKit 
-framework CoreFoundation
mipsel-linux-g++: ../libmicrohttpd/src/daemon/.libs/libmicrohttpd.a: No such 
file or directory
mipsel-linux-g++: IOKit: No such file or directory
mipsel-linux-g++: CoreFoundation: No such file or directory
make: *** [ozwcp] Error 1

What am I doing wrong?

Original issue reported on code.google.com by and7ey@gmail.com on 4 Sep 2011 at 8:49

GoogleCodeExporter commented 8 years ago
OK, I've fixed the issue with ../libmicrohttpd/src/daemon/.libs/libmicrohttpd.a 
(just compiled libmicrohttpd).
Need to find IOKit for Ubuntu...

Original comment by and7ey@gmail.com on 4 Sep 2011 at 2:02

GoogleCodeExporter commented 8 years ago
After Makefile correction, I got another error:

user@ubuntu1004desktop:~/openzwave-control-panel$ make
g++ -o ozwcp -g ozwcp.o webserver.o zwavelib.o   
../libmicrohttpd/src/daemon/.libs/libmicrohttpd.a -pthread -ludev
/usr/bin/ld: ozwcp.o: Relocations in generic ELF (EM: 8)
ozwcp.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [ozwcp] Error 1

working on this now

Original comment by and7ey@gmail.com on 4 Sep 2011 at 2:19

GoogleCodeExporter commented 8 years ago
ok, 'make clean' helped

Original comment by and7ey@gmail.com on 4 Sep 2011 at 3:56

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Here is the way to compile openzwave-control-panel for Ubuntu 10.04 (probably, 
it can be added to the project wiki):

1. sudo apt-get install subversion

*** open-zwave: ***
2. svn checkout http://open-zwave.googlecode.com/svn/trunk/ open-zwave
3. sudo apt-get install libudev-dev
4. user@ubuntu1004desktop:~/open-zwave/cpp/build/linux$ make

*** libmicrohttpd: ***
5. svn checkout https://gnunet.org/svn/libmicrohttpd/ libmicrohttpd - it 
doesn't work, since svn doesn't contain all files needed, so download 
libmicrohttpd manually from http://freshmeat.net/projects/libmicrohttpd (direct 
link - http://freshmeat.net/urls/6aaea0ce4467311c086c225d761fd5fa) and unpack 
to libmicrohttpd folder
6. user@ubuntu1004desktop:~/libmicrohttpd$ ./configure
7. user@ubuntu1004desktop:~/libmicrohttpd$ make

*** openzwave-control-panel: ***
8. svn checkout http://openzwave-control-panel.googlecode.com/svn/trunk/ 
openzwave-control-panel
9. modify openzwave-control-panel Makefile (comment Mac-related lines and 
uncomment Linux related)
10. user@ubuntu1004desktop:~/openzwave-control-panel$ make clean
11. user@ubuntu1004desktop:~/openzwave-control-panel$ make

Will try to compile that on Asus RT-N16 later on.

Original comment by and7ey@gmail.com on 4 Sep 2011 at 8:47

GoogleCodeExporter commented 8 years ago
I was able to compile after following comment #5 and adding #include 
<algorithm> to ozwcp.cpp(I know that's bad, but it worked).
I like the panel a lot even though I just started with Z-Wave and still try to 
find out the basics.

Original comment by j.hoeks...@gmail.com on 27 Oct 2011 at 12:08

GoogleCodeExporter commented 8 years ago
Downloaded and compiled under FC-14.  After some? pain I was able to get a 
executable after I added "-lgcrypt -lgnutls" to the Linux section of Makefile.

         LIBUSB := -ludev -lgcrypt -lgnutls

Original comment by cal.lidd...@gmail.com on 5 Nov 2011 at 3:28

GoogleCodeExporter commented 8 years ago
What is FC-14?

Original comment by and7ey@gmail.com on 5 Nov 2011 at 3:38

GoogleCodeExporter commented 8 years ago
Maybe it is Fedora Core 14  

Original comment by kondors...@gmail.com on 12 Nov 2011 at 9:18

GoogleCodeExporter commented 8 years ago
Also of note is that once everything was compiled, I needed to create a folder, 
"config" at the root of the control-panel folder. Then I copied over the 
device_classes.xml in to it in order for the discovery to work correctly for my 
scene controller.

There is still a zwbutton.xml not found error that I am trying to figure out.

Original comment by jay.pear...@gmail.com on 29 Jul 2012 at 6:16

GoogleCodeExporter commented 8 years ago
My libmicrohttpd download is still refusing to build the .a file I need for the 
control panel.

Any ideas? Running ubuntu 12.04. Followed steps in comment #5, made sure to 
download source from second location, not svn.

Original comment by omegac...@gmail.com on 25 Feb 2014 at 8:38

GoogleCodeExporter commented 8 years ago
Ok, I found the .a file. In the most recent release (0.9.34) the lib files have 
moved to libmicrohttpd/src/microhttpd/.libs/

Now the build is failing due to undefined references to a bunch of gnutls 
functions or something, eg. 'gnutls_priority_deinit'

I've already tried installing the libgnutls-dev package, and 
libcurl4-gnutls-dev. Any ideas?

Original comment by omegac...@gmail.com on 25 Feb 2014 at 9:07

GoogleCodeExporter commented 8 years ago
uncomment the # in the GNUTLS makefile.

if it is not enough, try compiling libmicrohttpd with a configure --with-gnutls

Original comment by emmanuel...@gmail.com on 21 Mar 2014 at 12:40

GoogleCodeExporter commented 8 years ago
hi,
is there a actual documentation or tutorial to compile 
>openzwave-control-panel<?
i have a problems with the make command

System Odroid U3 - Ubuntu 13.10 

make file:
#
# Makefile for OpenzWave Control Panel application
# Greg Satz

# GNU make only

.SUFFIXES:  .cpp .o .a .s

CC     := $(CROSS_COMPILE)gcc
CXX    := $(CROSS_COMPILE)g++
LD     := $(CROSS_COMPILE)g++
AR     := $(CROSS_COMPILE)ar rc
RANLIB := $(CROSS_COMPILE)ranlib

DEBUG_CFLAGS    := -Wall -Wno-unknown-pragmas -Wno-inline -Werror -Wno-format 
-g -DDEBUG
RELEASE_CFLAGS  := -Wall -Wno-unknown-pragmas -Werror -Wno-format -O3 -DNDEBUG

DEBUG_LDFLAGS   := -g

# Change for DEBUG or RELEASE
CFLAGS  := -c $(DEBUG_CFLAGS)
#LDFLAGS    := $(DEBUG_LDFLAGS)

OPENZWAVE := /open-zwave
LIBMICROHTTPD := /libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a

INCLUDES := -I $(OPENZWAVE)/cpp/src -I $(OPENZWAVE)/cpp/src/command_classes/ \
    -I $(OPENZWAVE)/cpp/src/value_classes/ -I $(OPENZWAVE)/cpp/src/platform/ \
    -I $(OPENZWAVE)/cpp/src/platform/unix -I $(OPENZWAVE)/cpp/tinyxml/ \
    -I ../libmicrohttpd/src/include

# Remove comment below for gnutls support
GNUTLS := -lgnutls

# for Linux uncomment out next three lines
LIBZWAVE := $(wildcard $(OPENZWAVE)/cpp/lib/linux/*.a)
LIBUSB := -ludev
LIBS := $(LIBZWAVE) $(GNUTLS) $(LIBMICROHTTPD) -pthread $(LIBUSB)

# for Mac OS X comment out above 2 lines and uncomment next 5 lines
#ARCH := -arch i386 -arch x86_64
#CFLAGS += $(ARCH)
#LIBZWAVE := $(wildcard $(OPENZWAVE)/cpp/lib/mac/*.a)
#LIBUSB := -framework IOKit -framework CoreFoundation
#LIBS := $(LIBZWAVE) $(GNUTLS) $(LIBMICROHTTPD) -pthread $(LIBUSB) $(ARCH)

%.o : %.cpp
    $(CXX) $(CFLAGS) $(INCLUDES) -o $@ $<

%.o : %.c
    $(CC) $(CFLAGS) $(INCLUDES) -o $@ $<

all: defs ozwcp

defs:
ifeq ($(LIBZWAVE),)
    @echo Please edit the Makefile to avoid this error message.
    @exit 1
endif

ozwcp.o: ozwcp.h webserver.h $(OPENZWAVE)/cpp/src/Options.h 
$(OPENZWAVE)/cpp/src/Manager.h \
    $(OPENZWAVE)/cpp/src/Node.h $(OPENZWAVE)/cpp/src/Group.h \
    $(OPENZWAVE)/cpp/src/Notification.h $(OPENZWAVE)/cpp/src/platform/Log.h

webserver.o: webserver.h ozwcp.h $(OPENZWAVE)/cpp/src/Options.h 
$(OPENZWAVE)/cpp/src/Manager.h \
    $(OPENZWAVE)/cpp/src/Node.h $(OPENZWAVE)/cpp/src/Group.h \
    $(OPENZWAVE)/cpp/src/Notification.h $(OPENZWAVE)/cpp/src/platform/Log.h

ozwcp:  ozwcp.o webserver.o zwavelib.o
    $(LD) -o $@ $(LDFLAGS) ozwcp.o webserver.o zwavelib.o $(LIBS)

dist:   ozwcp
    rm -f ozwcp.tar.gz
    tar -c --exclude=".svn" -hvzf ozwcp.tar.gz ozwcp config/ cp.html cp.js openzwavetinyicon.png README

clean:
    rm -f ozwcp *.o

Original comment by seve...@elmecker.net on 23 Jul 2014 at 8:50

GoogleCodeExporter commented 8 years ago
I was able to follow the instructions in comment #5 to build openzwave control 
panel for the odroid C1, with the following caveats:

open-zwave
- no issues

libmicrohttpd
- needed to install 'autoconf'
- needed to run 'autoreconf -fi' per README
- needed to run './configure' per README (implied)
I bet the one already installed in the OS would be sufficient (it is not quite 
as new as the trunk, obviously).

openzwave-control-panel
- edited Makefile as follows:
  - uncommented the three Linux lines for LIBZWAVE, LIBUSB, LIBS
  - changed some definitions to deal with different library locations
    LIBMICROHTTPD := ../libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a
    LIBZWAVE := $(wildcard $(OPENZWAVE)/*.a)
- edited webserver.cpp
  - line 976, replaced first %x with %lx, replace 2nd and 3rd %x with %p.
- To run, you will need to symlink the open-zwave configuration files into the
control panel directory, e.g.
  ln -s ../open-zwave/config .

Original comment by Richard....@gmail.com on 23 Jan 2015 at 10:20