How do I build command-line binaries for tvOS?

Issues relating to the upcoming LiberTV TvOS < 11.2 JB. NO MORON "wen eta" though - unless you want to be banned.
Forum rules
  • NO IDIOTIC QUESTIONS ABOUT "WEN ETA JB".
  • Read the FAQ before asking.
  • Otherwise, open discussion and/or requests welcome.

How do I build command-line binaries for tvOS?

Postby RiotNrrrd » Sat Mar 11, 2017 11:48 pm

I'm trying to build some stuff for tvOS 10.1 but I'm not having much luck.

I can build things on my Mac easily enough but I can't seem to get it to use the tvOS toolchain to build tvOS binaries instead of Mac binaries.

If I want to build an Xcode project (e.g. Fugu or NTP) and I run Xcode 7.2.1 on my Yosemite Mac mini that is connected to the Apple TV 4, when I choose the ATV as a Device in Xcode it complains that it "Could not find the Developer Disk Image", since I'm using 7.2.1 instead of 8.2.

It feels like the only way I can build things for tvOS 10.1 is to have Xcode 8 installed and therefore be running El Capitan or (probably) Sierra, neither of which I want to do right now.

(The Mac mini is my LP & cassette ripping station and Yosemite is the last OS to fully support my FireWire Apogee Duet.)
RiotNrrrd
 
Posts: 13
Joined: Sun Feb 26, 2017 11:19 pm

Re: How do I build command-line binaries for tvOS?

Postby morpheus » Sun Mar 12, 2017 1:58 pm

The bootstrap.tar in the jailbreak contains pretty much every single binary you'd need - I built them myself. If you want to build your own, follow the directions in the code samples page on NewOSXBook.com, but replace the SDK to that of TvOS.
morpheus
Site Admin
 
Posts: 532
Joined: Thu Apr 11, 2013 6:24 pm

Re: How do I build command-line binaries for tvOS?

Postby RiotNrrrd » Fri Mar 31, 2017 5:15 am

morpheus wrote:If you want to build your own, follow the directions in the code samples page on NewOSXBook.com, but replace the SDK to that of TvOS.

I'm not getting very far with that, Jonathan. (Sorry for the delay in replying - I've been sick quite a bit of late.)

I tried a massaged version of your gcc script from the book code samples page, but I immediately ran into problems with ports like lsof that want to set $CC on their own:

Code: Select all
~/src/lsof-0.53 % cat /usr/local/bin/gcc-tvOS
#!/bin/sh
#SDK=iPhoneOS9.0.sdk
SDK=AppleTVOS9.1.sdk
export SDK

#PLATFORM=iPhoneOS
PLATFORM=AppleTVOS
export PLATFORM

XCODE=/Applications/Xcode.app/Contents
export XCODE

export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}.sdk
#XCODE_DEVELOPER_USR_PATH=/Developer   # don't really need this..

#PLATFORM_ARCH=armv7
PLATFORM_ARCH=arm64
export PLATFORM_ARCH

gcc -arch $PLATFORM_ARCH
   -framework IOKit -framework CoreFoundation \
   -F ${XCODE}/Developer/Platforms/${PLATFORM}.platform/Developer/SDKs/$SDK/System/Library/Frameworks \
   -I ${XCODE}/Developer/Platforms/${PLATFORM}.platform/DeviceSupport/Latest/Symbols/usr/include  \
   -L ${XCODE}/Developer/Platforms/${PLATFORM}.platform/Developer/SDKs/$SDK/usr/lib
   -L ${XCODE}/Developer/Platforms/${PLATFORM}.platform/Developer/SDKs/$SDK/usr/lib/system $*

~/src/lsof-53 % setenv CC gcc-tvOS

~/src/lsof-53 % make
Installing source for lsof...
echo "Creating pseudo-copy of sources in the build directory...";
Creating pseudo-copy of sources in the build directory...
*** patching Configure
*** patching dialects/darwin/libproc/Makefile
Configuring lsof...
Configuring libproc-based Darwin lsof
rm -f ddev.c dfile.c dlsof.h dmnt.c dnode*.c dproc.c dproto.h dsock.c dstore.c dzfs.h kernelbase.h machine.h machine.h.old new_machine.h __lseek.s Makefile Makefile.zfs ./tests/config.cflags
rm -f ./tests/config.cc ./tests/config.xobj ./tests/config.ldflags
Testing C library for localtime() and strftime(), using /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc ... present
ln -s dialects/darwin/libproc/dlsof.h dlsof.h
ln -s dialects/darwin/libproc/ddev.c ddev.c
ln -s dialects/darwin/libproc/dfile.c dfile.c
ln -s dialects/darwin/libproc/dmnt.c dmnt.c
ln -s dialects/darwin/libproc/dproc.c dproc.c
ln -s dialects/darwin/libproc/dproto.h dproto.h
ln -s dialects/darwin/libproc/dsock.c dsock.c
ln -s dialects/darwin/libproc/dstore.c dstore.c
ln -s dialects/darwin/libproc/machine.h machine.h
Makefile and lib/Makefile created.
./tests/config.cc created
./tests/config.cflags created
./tests/config.ldflags created
./tests/config.xobj created
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory
make: [/tmp/lsof/Build/configure-stamp] Error 64 (ignored)
*** patching Makefile
xcodebuild: error: -sdk must be supplied with an argument unless used with -version
xcrun: error: unable to find utility "dsymutil", not a developer tool or in PATH
*** patching lib/Makefile
*** patching dialects/darwin/kmem/machine.h
*** patching dialects/darwin/libproc/machine.h
Building lsof...
(cd lib; /Applications/Xcode.app/Contents/Developer/usr/bin/make DEBUG="-Os -g" CFGF="-DHASIPv6 -DHASUTMPX -DDARWINV=1400 -DHAS_STRFTIME -DLSOF_VSTR=\"14.5.0\"")
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc  -DHASIPv6 -DHASUTMPX -DDARWINV=1400 -DHAS_STRFTIME -DLSOF_VSTR="14.5.0"  -Os -g   -c -o ckkv.o ckkv.c
[...]

As you can see, several small errors at first, and then it just uses its own default toolchain cc and builds a Mac binary in /tmp/lsof/Build/lsof instead of an ARM one.
RiotNrrrd
 
Posts: 13
Joined: Sun Feb 26, 2017 11:19 pm


Return to LiberTV

Who is online

Users browsing this forum: No registered users and 1 guest

cron