| Ticket UUID: | d19aef1487a940bbf8ce7553b4aacc88e5ae9621 | |||
| Title: | Does not cross-compile for iOS 6 - patch included. | |||
| Type: | Bug | Version: | 8.6.1 | |
| Submitter: | anonymous | Created on: | 2014-07-29 09:21:24 | |
| Subsystem: | 52. Portability Support | Assigned To: | kevin_walzer | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Open | Last Modified: | 2014-07-31 07:47:36 | |
| Resolution: | None | Closed By: | nobody | |
| Closed on: | ||||
| Description: |
When building for iOS 6 as target (--host=arm-apple-darwin) with load disabled (--disable-load), two problems occur:
* The declaration of TclpLoadMemory differs from its definition.
* Some defines do not distinguish between __APPLE__ and ios/macosx.
diff -rupN tcl8.6.1.orig/generic/tclLoadNone.c tcl8.6.1/generic/tclLoadNone.c
--- tcl8.6.1.orig/generic/tclLoadNone.c 2013-09-19 21:04:14.000000000 +0200
+++ tcl8.6.1/generic/tclLoadNone.c 2014-07-29 08:57:30.000000000 +0200
@@ -104,7 +104,7 @@ TclpLoadMemory(
int size, /* Dummy: unused by this implementation */
int codeSize, /* Dummy: unused by this implementation */
Tcl_LoadHandle *loadHandle, /* Dummy: unused by this implementation */
- Tcl_FSUnloadFileProc **unloadProcPtr)
+ Tcl_FSUnloadFileProc **unloadProcPtr, int flags)
/* Dummy: unused by this implementation */
{
Tcl_SetObjResult(interp, Tcl_NewStringObj("dynamic loading from memory "
diff -rupN tcl8.6.1.orig/unix/tclUnixPort.h tcl8.6.1/unix/tclUnixPort.h
--- tcl8.6.1.orig/unix/tclUnixPort.h 2013-09-19 21:04:17.000000000 +0200
+++ tcl8.6.1/unix/tclUnixPort.h 2014-07-29 11:01:56.000000000 +0200
@@ -541,7 +541,11 @@ extern int errno;
*---------------------------------------------------------------------------
*/
-#if defined(__APPLE__) && defined(__DYNAMIC__)
+#ifdef __APPLE__
+#include "TargetConditionals.h"
+#endif
+
+#if defined(__APPLE__) && defined(__DYNAMIC__) && TARGET_OS_MAC
# include <crt_externs.h>
# define environ (*_NSGetEnviron())
# define USE_PUTENV 1
| |||
| User Comments: |
anonymous (claiming to be bef) added on 2014-07-31 07:47:36:
It looks like your configuration is trying to link against the wrong architecture (i386) instead of arm. Maybe there are some files remaining from a previous build? (make distclean) Or the 'configure' was not set to cross-compile, e.g. --host=arm-apple-darwin As far as testing is concerned, the ARM build of Tcl for iOS works only on a jailbroken device out of the box. However It may be possible to build the Tcl library as framework for iOS (--enable-framework) and use it in a sample iOS application. This application will then have to be signed and deployed on a registered developer device, which requires an Apple developer account (charges apply - approx $100/y). kevin_walzer added on 2014-07-31 02:06:13: I've opened an ios branch for these patches, but I'm not sure I'm doing the build right. I get these errors when running make per your instructions:
ld: warning: ignoring file tclAppInit.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): tclAppInit.o
ld: warning: ignoring file /Users/kevin/tcl-ios/unix/libtcl8.6.a, file was built for archive which is not the architecture being linked (i386): /Users/kevin/tcl-ios/unix/libtcl8.6.a
ld: warning: ignoring file libtclstub8.6.a, file was built for archive which is not the architecture being linked (i386): libtclstub8.6.a
Undefined symbols for architecture i386:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture i386
Also, I'm not sure how to test the build once I get something build--I refuse to jailbreak my iPhone. Do you know of a way to run this in the simulator, assuming I can get it to build?
dgp added on 2014-07-30 13:38:37: Just glancing from the side, it appears that bitrot has caused --disable-load to stop working. At a minimum that requires a fix, and is important not only on Apple systems. It's an exciting opportunity to add a new platform too. We appreciate the patience and assistance working through the startup pains anonymous (claiming to be bef) added on 2014-07-30 06:58:13: compile with (Makefile syntax) in <tcldir>/unix/:
GCC_BIN=$(shell xcrun --sdk iphoneos --find gcc)
IOS_SDK=$(shell xcrun --sdk iphoneos --show-sdk-path)
CFLAGS=-arch armv7 -Os -F$(IOS_SDK)/System/Library/Frameworks -isysroot "$(IOS_SDK)" -Wimplicit -pipe -miphoneos-version-min=6.1 -no-cpp-precomp -I$(IOS_SDK)/usr/include/
all:
./configure CC="$(GCC_BIN)" CFLAGS="$(CFLAGS)" --host=arm-apple-darwin --disable-load
make
make install DESTDIR=/tmp/tcl-root
Note: The unsigned software runs on a jailbroken iOS device, e.g. iPod touch 4g, iPhone 4, ...
Also, the first of the proposed changes may allow --disable-load for other platforms as well. This is not iOS or Apple specific. The second of the proposed changes (#ifdef...) does no harm whatsoever, as long as Tcl still compiles on OSX.
kevin_walzer added on 2014-07-29 21:27:50: iOS is not a supported platform and I am not familiar with steps required to compile for it, or test builds. Please provide more information on the steps you are following to achieve these ends. aku added on 2014-07-29 17:24:35: Assigned to our Apple person. | |||