- Install dependencies:
brew install sdl openssl gettext
- Add the
bin
folder ofgettext
to your path:export PATH=$PATH:/usr/local/Cellar/gettext/0.19.4/bin
- Go through steps 1-9 here
git clone --recursive https://github.com/tessel/openwrt-tessel.git
cd openwrt-tessel
- Replace
openwrt/tools/mkimage/Makefile
with the file included in this Gist of the similar name (an artifact of OSX being unable to link against SSL development headers). Make sure to change lines 35 and 36 with a valid link to theopenssl
librarybrew
installed in the previous step, if necessary. I created it by combining this debugging suggestion which didn't work and this updated file on master which also didn't work on its own. make V=99
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C out BUILDTYPE=Release V=99
LD_LIBRARY_PATH=/Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v4.4.3/out/Release/lib.host:/Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v4.4.3/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/tools/gyp; mkdir -p /Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v4.4.3/out/Release/obj/gen; python ../../tools/js2c.py "/Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v4.4.3/out/Release/obj/gen/libraries.cc" CORE ../../src/macros.py ../../src/messages.h ../../src/runtime.js ../../src/prologue.js ../../src/v8natives.js ../../src/symbol.js ../../src/array.js ../../src/string.js ../../src/uri.js ../../src/math.js ../../src/third_party/fdlibm/fdlibm.js ../../src/date.js ../../src/regexp.js ../../src/arraybuffer.js ../../src/typedarray.js ../../src/iterator-prototype.js ../../src/generator.js ../../src/object-observe.js ../../src/collection.js ../../src/weak-collection.js ../../src/collection-iterator.js ../../src/promise.js ../../src/messages.js ../../src/json.js ../../src/array-iterator.js ../../src/string-iterator.js ../../src/debug-debugger.js ../../src/mirror-debugger.js ../../src/liveedit-debugger.js ../../src/templates.js ../../src/harmony-array.js ../../src/harmony-typedarray.js
Traceback (most recent call last):
File "../../tools/js2c.py", line 37, in <module>
import bz2
ImportError: No module named bz2
make[6]: *** [/Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v4.4.3/out/Release/obj/gen/libraries.cc] Error 1
make[5]: *** [node] Error 2
make[4]: *** [/Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v4.4.3/.built] Error 2
make[4]: Leaving directory `/Volumes/OpenWrt/openwrt-tessel/package/node/node'
make[3]: *** [package/feeds/tessel/node/compile] Error 2
make[3]: Leaving directory `/Volumes/OpenWrt/openwrt-tessel/openwrt'
make[2]: *** [/Volumes/OpenWrt/openwrt-tessel/openwrt/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/stamp/.package_compile] Error 2
make[2]: Leaving directory `/Volumes/OpenWrt/openwrt-tessel/openwrt'
make[1]: *** [world] Error 2
make: *** [world] Error 2
Then the compilation will probably fail after a while with:
make[4]: Entering directory `/Volumes/OpenWrt/openwrt-tessel/openwrt/package/utils/bzip2'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -j1 -C /Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/host/bzip2-1.0.6 -f Makefile-libbz2_so
gcc -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 blocksort.o huffman.o crctable.o randtable.o compress.o decompress.o bzlib.o
ld: unknown option: -soname
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[5]: *** [all] Error 1
make[4]: *** [/Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/host/bzip2-1.0.6/.built] Error 2
make[4]: Leaving directory `/Volumes/OpenWrt/openwrt-tessel/openwrt/package/utils/bzip2'
make[3]: *** [package/utils/bzip2/host/compile] Error 2
make[3]: Leaving directory `/Volumes/OpenWrt/openwrt-tessel/openwrt'
make[2]: *** [/Volumes/OpenWrt/openwrt-tessel/openwrt/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/stamp/.package_compile] Error 2
make[2]: Leaving directory `/Volumes/OpenWrt/openwrt-tessel/openwrt'
make[1]: *** [world] Error 2
make: *** [world] Error 2
- To fix this, open up openwrt/build_dir/host/bzip2-1.0.6/Makefile-libbz2.so and replace line 38:
$(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS)
With the following:
$(CC) -shared -Wl, -install_name -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS)
Apparently this Makefile is using a flag (-soname
) that doesn't work on OSX so we replace it with an equivalent flag. I don't think this is the best way to fix it but I'm not sure how this file gets generated.
- Then compilation will fail because of this issue with
libpcap
trying to reference"linux/types.h"
To fix that, I added an include flag to theMAKE_FLAGS
section of theupstream-packages/lib/libcap/Makefile
withI$(BUILD_DIR_TOOLCHAIN)/linux-dev/include
. I included the entire Makefile in this Gist for convenience. I also deletedopenwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/libcap-2.24
anddl/libcap-2.24.tar.xz
just to make sure it was downloaded fresh and rebuilt. - Then I recompiled and hit this error message:
cc -fpic -I/Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/libcap-2.24/libcap/include -I/Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/linux-dev/include _makenames.c -o _makenames
In file included from _makenames.c:10:
In file included from /Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/libcap-2.24/libcap/include/sys/capability.h:24:
In file included from /Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/linux-dev/include/linux/types.h:8:
In file included from /Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/linux-dev/include/linux/posix_types.h:35:
In file included from /Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/linux-dev/include/asm/posix_types.h:12:
/Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/linux-dev/include/asm/sgidefs.h:18:2: error:
Use a Linux compiler or give up.
#error Use a Linux compiler or give up.
^
1 error generated.
make[6]: *** [_makenames] Error 1
make[5]: *** [all] Error 2
make[4]: *** [/Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/libcap-2.24/.built] Error 2
make[4]: Leaving directory `/Volumes/OpenWrt/openwrt-tessel/upstream-packages/libs/libcap'
make[3]: *** [package/feeds/packages/libcap/compile] Error 2
make[3]: Leaving directory `/Volumes/OpenWrt/openwrt-tessel/openwrt'
make[2]: *** [/Volumes/OpenWrt/openwrt-tessel/openwrt/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/stamp/.package_compile] Error 2
make[2]: Leaving directory `/Volumes/OpenWrt/openwrt-tessel/openwrt'
make[1]: *** [world] Error 2
make: *** [world] Error 2
- Take a brief moment to appreciate the snarkiness of that error
- Open
openwrt/build_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/linux-dev/include/asm/sgidefs.h
and delete or comment out the entire#ifndef __linux__
block. - Recompile and you'll run into an issue where mDNS Responder won't compile properly:
mipsel-openwrt-linux-uclibc-gcc -I../mDNSCore -I../mDNSShared -Iobjects/prod -fwrapv -W -Wall -DPID_FILE=\"/var/run/mdnsd.pid\" -DMDNS_UDS_SERVERPATH=\"/var/run/mdnsd\" -D_GNU_SOURCE -DHAVE_IPV6 -DNOT_HAVE_SA_LEN -DUSES_NETLINK -DHAVE_LINUX -DTARGET_OS_LINUX -fno-strict-aliasing -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kec -mdsp -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float dns-sd.c ClientCommon.c -I../mDNSShared -Wall -o build/dns-sd
dns-sd.c: In function 'base64Encode':
dns-sd.c:382:58: warning: unused parameter 'rdata' [-Wunused-parameter]
static void base64Encode(char *buffer, int buflen, void *rdata, unsigned int rdlen)
^
dns-sd.c:382:78: warning: unused parameter 'rdlen' [-Wunused-parameter]
static void base64Encode(char *buffer, int buflen, void *rdata, unsigned int rdlen)
^
/var/folders/s2/tcwl1vwx0m5d0z4xlwxx6_c00000gn/T//ccoPqd6B.o: In function `zonedata_resolve':
dns-sd.c:(.text+0x7bc): undefined reference to `DNSServiceRefDeallocate'
/var/folders/s2/tcwl1vwx0m5d0z4xlwxx6_c00000gn/T//ccoPqd6B.o: In function `zonedata_browse':
dns-sd.c:(.text+0x13f8): undefined reference to `DNSServiceResolve'
/var/folders/s2/tcwl1vwx0m5d0z4xlwxx6_c00000gn/T//ccoPqd6B.o: In function `RegisterService.constprop.8':
dns-sd.c:(.text+0x1bb8): undefined reference to `DNSServiceRegister'
/var/folders/s2/tcwl1vwx0m5d0z4xlwxx6_c00000gn/T//ccoPqd6B.o: In function `qr_reply':
dns-sd.c:(.text+0x2650): undefined reference to `DNSServiceReconfirmRecord'
/var/folders/s2/tcwl1vwx0m5d0z4xlwxx6_c00000gn/T//ccoPqd6B.o: In function `main':
dns-sd.c:(.text.startup+0x404): undefined reference to `DNSServiceEnumerateDomains'
dns-sd.c:(.text.startup+0x57c): undefined reference to `DNSServiceCreateConnection'
dns-sd.c:(.text.startup+0x5b0): undefined reference to `DNSServiceBrowse'
dns-sd.c:(.text.startup+0x68c): undefined reference to `DNSServiceResolve'
dns-sd.c:(.text.startup+0x768): undefined reference to `DNSServiceCreateConnection'
dns-sd.c:(.text.startup+0x8b8): undefined reference to `DNSServiceRegisterRecord'
dns-sd.c:(.text.startup+0xef8): undefined reference to `DNSServiceQueryRecord'
dns-sd.c:(.text.startup+0x1014): undefined reference to `DNSServiceRegister'
dns-sd.c:(.text.startup+0x10a0): undefined reference to `DNSServiceRegister'
dns-sd.c:(.text.startup+0x10d0): undefined reference to `DNSServiceAddRecord'
dns-sd.c:(.text.startup+0x1150): undefined reference to `DNSServiceRegister'
dns-sd.c:(.text.startup+0x1178): undefined reference to `DNSServiceUpdateRecord'
dns-sd.c:(.text.startup+0x1294): undefined reference to `DNSServiceNATPortMappingCreate'
dns-sd.c:(.text.startup+0x1314): undefined reference to `DNSServiceGetAddrInfo'
dns-sd.c:(.text.startup+0x1360): undefined reference to `DNSServiceCreateConnection'
dns-sd.c:(.text.startup+0x13b8): undefined reference to `DNSServiceBrowse'
dns-sd.c:(.text.startup+0x1404): undefined reference to `DNSServiceBrowse'
dns-sd.c:(.text.startup+0x1478): undefined reference to `DNSServiceRegister'
dns-sd.c:(.text.startup+0x14ac): undefined reference to `DNSServiceUpdateRecord'
dns-sd.c:(.text.startup+0x14ec): undefined reference to `DNSServiceAddRecord'
dns-sd.c:(.text.startup+0x1514): undefined reference to `DNSServiceRemoveRecord'
dns-sd.c:(.text.startup+0x1558): undefined reference to `DNSServiceGetProperty'
dns-sd.c:(.text.startup+0x1640): undefined reference to `DNSServiceRefSockFD'
dns-sd.c:(.text.startup+0x1664): undefined reference to `DNSServiceRefSockFD'
dns-sd.c:(.text.startup+0x1788): undefined reference to `DNSServiceProcessResult'
dns-sd.c:(.text.startup+0x1820): undefined reference to `DNSServiceAddRecord'
dns-sd.c:(.text.startup+0x1860): undefined reference to `DNSServiceUpdateRecord'
dns-sd.c:(.text.startup+0x1890): undefined reference to `DNSServiceRemoveRecord'
dns-sd.c:(.text.startup+0x1914): undefined reference to `DNSServiceUpdateRecord'
dns-sd.c:(.text.startup+0x1958): undefined reference to `DNSServiceAddRecord'
dns-sd.c:(.text.startup+0x1a2c): undefined reference to `DNSServiceRefDeallocate'
dns-sd.c:(.text.startup+0x1a40): undefined reference to `DNSServiceRefDeallocate'
collect2: error: ld returned 1 exit status
make[6]: *** [build/dns-sd] Error 1
make[5]: *** [../Clients/build/dns-sd] Error 2
make[4]: *** [/Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/mDNSResponder-567/.built] Error 2
make[4]: Leaving directory `/Volumes/OpenWrt/openwrt-tessel/upstream-packages/net/mdnsresponder'
make[3]: *** [package/feeds/packages/mdnsresponder/compile] Error 2
make[3]: Leaving directory `/Volumes/OpenWrt/openwrt-tessel/openwrt'
make[2]: *** [/Volumes/OpenWrt/openwrt-tessel/openwrt/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/stamp/.package_compile] Error 2
make[2]: Leaving directory `/Volumes/OpenWrt/openwrt-tessel/openwrt'
make[1]: *** [world] Error 2
make: *** [world] Error 2
- I removed
PACKAGES += tessel-mdns
andPACKAGES += mdns-utils
frompackages.mk
to avoid building mdnsresponder. - Recompiled again with
make world
and... fail:
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C out BUILDTYPE=Release V=99
LD_LIBRARY_PATH=/Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v4.4.3/out/Release/lib.host:/Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v4.4.3/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/tools/gyp; mkdir -p /Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v4.4.3/out/Release/obj/gen; python ../../tools/js2c.py "/Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v4.4.3/out/Release/obj/gen/libraries.cc" CORE ../../src/macros.py ../../src/messages.h ../../src/runtime.js ../../src/prologue.js ../../src/v8natives.js ../../src/symbol.js ../../src/array.js ../../src/string.js ../../src/uri.js ../../src/math.js ../../src/third_party/fdlibm/fdlibm.js ../../src/date.js ../../src/regexp.js ../../src/arraybuffer.js ../../src/typedarray.js ../../src/iterator-prototype.js ../../src/generator.js ../../src/object-observe.js ../../src/collection.js ../../src/weak-collection.js ../../src/collection-iterator.js ../../src/promise.js ../../src/messages.js ../../src/json.js ../../src/array-iterator.js ../../src/string-iterator.js ../../src/debug-debugger.js ../../src/mirror-debugger.js ../../src/liveedit-debugger.js ../../src/templates.js ../../src/harmony-array.js ../../src/harmony-typedarray.js
Traceback (most recent call last):
File "../../tools/js2c.py", line 37, in <module>
import bz2
ImportError: No module named bz2
make[6]: *** [/Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v4.4.3/out/Release/obj/gen/libraries.cc] Error 1
make[5]: *** [node] Error 2
make[4]: *** [/Volumes/OpenWrt/openwrt-tessel/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v4.4.3/.built] Error 2
make[4]: Leaving directory `/Volumes/OpenWrt/openwrt-tessel/package/node/node'
make[3]: *** [package/feeds/tessel/node/compile] Error 2
make[3]: Leaving directory `/Volumes/OpenWrt/openwrt-tessel/openwrt'
make[2]: *** [/Volumes/OpenWrt/openwrt-tessel/openwrt/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/stamp/.package_compile] Error 2
make[2]: Leaving directory `/Volumes/OpenWrt/openwrt-tessel/openwrt'
make[1]: *** [world] Error 2
make: *** [world] Error 2
Still investigating...