2012-07-11 25 views
32

को FreeTDS संकलन के बाद से यह सवाल अनुत्तरित है और मैं एक सेमेस्टर यह लगाना के बहुमत मैंने सोचा कि मैं iPhone ARMv6, ARMv7 वास्तुकला के लिए FreeTDS 0.91 संकलन पार करने के लिए कैसे पोस्ट होगा बिताया। यह एक्सकोड 4.2 और आईओएस 5 एसडीके का उपयोग करके किया गया था।क्रॉस iPhone

इस सवाल से पूछा गया है क्योंकि आप एक आईओएस डिवाइस के लिए एक ऐप विकसित कर रहे हैं जिसके लिए मिर्कोसॉफ्ट एसक्यूएल सेवर से कनेक्ट करने की आवश्यकता है, जिसके लिए टैब्यूलर डेटा स्ट्रीम (टीडीएस) प्रोटोकॉल का उपयोग करने की आवश्यकता है क्योंकि यह माइक्रोसॉफ्ट स्वामित्व है।

मैंने देखा कि आपने भी इस प्रयास करने के लिए तकनीकी कौशल के कुछ स्तर की आवश्यकता का उल्लेख होगा। यह एक बहुत ही संघनित संस्करण है जो मुझे पता लगाने के लिए लगभग दो महीने ले गया (मैंने उन सभी चीजों को छोड़ दिया जो आपको नहीं करना चाहिए)।

अन्य प्रलेखन इस से संबंधित:

बेसिक कैसे FreeTDS का उपयोग कर http://www.freetds.org/userguide/samplecode.htm

माइक्रोसॉफ्ट के टीडीएस API दस्तावेज़ों पर करने के लिए http://msdn.microsoft.com/en-us/library/aa936985(v=sql.80)

मेरा उत्तर नीचे देखें।

एक्सकोड 4.5 अपडेट की गई फ़ाइलों के लिए saskathex उत्तर भी देखें।

+1

यह बहुत अच्छा है! लेकिन मैं मोबाइलफू द्वारा iSQL एसडीके का उपयोग कर समाप्त हुआ। – Hackmodford

+0

@AmigableClarkKant इससे बहुत अधिक समझदारी होगी। – Tristan

उत्तर

4

मेरे जैसे उन है कि (मेक स्थापित कर कॉन्फ़िगर चलाने के लिए) घंटे खर्च करेगा इन मानक कॉन्फ़िगर झंडे के लिए दस्तावेज़ खोजने के लिए

 ./configure --build is used for specifing the architecture you want to complie for 
     ./configure --host is used to specify the ark of the machine doing the compileing (running xcode) 
     ./configure --target seems to be an alias 

अब तो समस्या को हल करने के लिए।

1) FreeTDS http://www.freetds.org/

2) अगले कदम है कि सही ढंग से FreeTDS कॉन्फ़िगर चलाने अपनी खुद की पार्टी खोल फ़ाइलें बनाने के लिए है के नवीनतम संस्करण प्राप्त करें। आपको दो की आवश्यकता होगी क्योंकि सिम्युलेटर i386/i686 आर्किटेक्चर और एक सेब डिवाइस (आईफोन, आईपॉड, इत्यादि) एआरएम आर्किटेक्चर है। साथ ही, आईफोन विकास निर्देशिकाओं के भीतर आपकी कंपाइलर फाइल/संस्करण अलग-अलग हो सकता है, केवल यह पता लगाएं कि तार्किक अर्थ क्या है और समान नामकरण सम्मेलन है। मैक होस्ट आर्किटेक्चर को uname -p कमांड के साथ आपूर्ति की जाती है।

#!/bin/sh 

# unset some shell variables 
unset CC 
unset CFLAGS 
unset CPP 

export buildPath=`pwd` 

# make arm target 
export CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 

export CFLAGS="-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk" 

export CPP=/usr/bin/cpp 


./configure --build=arm-apple-darwin10 --host=x86_64-apple-darwin11.3.0 --target=armv7 --with-tdsver=7.1 

3): एआरएम संकलन (build_for_device_armv7.sh) के लिए विन्यस्त करने के लिए

#!/bin/sh 

#unset some shell variables 
unset CC 
unset CFLAGS 
unset CPP 

export buildPath=`pwd` 

# make i386 (Simulator) target 
export CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/i686-apple-darwin11-llvm-gcc-4.2 

export CFLAGS="-isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk" 

# if you want Windows Authentication (NTLM) support you must use at least tds version 7 
# the default is 5 
./configure --build=i386 --host=i386 --target=i386 --with-tdsver=7.1 

उदाहरण:

यहाँ सिम्युलेटर (i386) build_for_simulator_i386.sh पर उपयोग के लिए निर्माण के लिए मेरे उदाहरण है जड़ freetds निर्देशिका कि अनज़िप freetds डाउनलोड से हुई करने के लिए अगला सीडी, मेरा freetds_0.91

4) अपने लिपियों में से एक चलाया गया था। आप एक समय

sh build_for_(desiered build) 
     this runs ./configure for you with the correct options 
     (tds version 7 required for NTLM authentication) 

5) एक बार कॉन्फ़िगर प्रक्रिया को पूरा करता आप विन्यास फाइल को हैक करने के लिए है पर एक वास्तुकला के लिए संकलन कर सकते हैं। ओपन freetds_0.91// करने के लिए #define HAVE_ICONV 0

6) अगर आपने पहले भाग गया तो लाइन 172 परिवर्तन #define HAVE_ICONV 1 पर config.h शामिल हैं।/ कॉन्फ़िगर करें, बनाएं, इंस्टॉल करें, फिर इन आदेशों को चलाएं। अपने आर्किटेक्चर स्विचिंग खास तौर पर अगर के रूप में आपके द्वारा चलाए जा त्रुटियों कर इस

sudo make clean 
    sudo make uninstall 

7) संकलन का उपयोग कर प्रदर्शन कर

make all 
    sudo make install 

मेकअप प्रक्रिया उद्देश्य पर कुछ त्रुटि के माध्यम से करता है बिना बनाने के मिल जाएगा, लेकिन अगर आप देख शेल प्रॉम्प्ट की छः या सात पंक्तियों के भीतर त्रुटियां, एक बार यह लौटने के बाद, आपको समस्याएं होती हैं और आगे बढ़ने से पहले उन्हें ठीक करने की आवश्यकता होती है। आइए बस इस बिंदु पर कई चीजें गलत हो सकती हैं।

8) द्विआधारी पालन फ़ाइल सभी छोटी ओ फ़ाइलों की परिणति बनाता freetds कि /usr/local/lib/libsybdb.a ट्रस्ट मुझे आप नहीं एक खींचने के लिए चाहते है कि स्थापित करने के बाद। ओ सिर्फ पुस्तकालय के लिए फ़ाइल जो आप चाहते हैं। अपनी परियोजना में उचित फ़ोल्डर में /usr/local/lib/libsybdb.a कॉपी करें। मैंने जो किया वह दो अलग फ़ोल्डर्स था, एक प्रति वास्तुकला, जिसका नाम "compiled_freetds-0.91_simulator_i386" और "compiled_freetds-0.91_device_armv7" था।

9) चूंकि आप जीवन को आसान बनाना चाहते हैं और xcode आंकड़ा है जो फ़ाइल का उपयोग करने के लिए संकलित है, गतिशील लिंक करने के लिए चरणों के इस सबसेट का पालन करें।

a) Select you project settings on the left had side of xcode 
(the blue think with the name of your project on it) 

b) Select the Target (usual the same name as your app) 

c) Navigate to **build settings**, scroll down to **linking > other linker flags** 

d) On the left side of Other Linker Flags a mouse over will reveal an expander,  
expanding will reveal Debug and Release rows. 

e) Add the appriate architectures by selecting the plus on the right side of 
either Debug or Release. When the new row appears select the architecture, 
double click the first editable field from the right to open an entry box 
that you can then drag the appropriate complied file into it to be dynamically  
linked. You must do this for both files and when done correctly the file 
under ARMv7 will be used when building for the device and the one for Any iOS 
Simulator SDK will be used when running on the simulator. 
**Note:** You may also need to add the -all_load flag to resolve linking issues. 

10) जो libsybdb.5.dylib शामिल जब डिवाइस पर कोड चलाने गतिशील लिंक करने में त्रुटि की समस्या से बचने के लिए लगता है अंतिम चरण की स्थापना रद्द करने के लिए है। साथ ही, डिवाइस पर चलने पर आपको 36 की वृद्धि में बहुत सी चेतावनियां भी मिलेंगी, CPU_SUBTYPE_ARM_ALL को बहिष्कृत किया जा रहा है, यह सामान्य है, लेकिन परेशान है।

sudo make uninstall 

मुझे उम्मीद है कि इससे मदद मिलती है।

+0

मुझे पता है कि आप इसमें काम के ढेर डालते हैं, इसलिए मुझे आपको यह बताने में खेद है कि, लेकिन आपको --/configure मिश्रित करने के लिए --build और --host पैरामीटर उपयोग मिल गया है। यह इसके विपरीत है, या नहीं तो मैंने आपकी व्याख्या को गलत समझा। इस टिप्पणी के अंत में लिंक देखें, जो इसे अच्छी तरह से समझाता है। और - लक्ष्य एक उपनाम नहीं है, लेकिन इसके बजाए इसका उपयोग केवल टूलचेन्स बनाने के दौरान किया जाता है, जैसे कंपाइलर्स या डिबगर्स - उदा। जब आप एक कंपाइलर संकलित कर रहे हैं। किसी और चीज के लिए, लक्ष्य लक्ष्य अप्रासंगिक है। http://stackoverflow.com/questions/5139403/whats-the-difference-of-configure-option-build-host-and- लक्ष्य; शुभकामनाएँ और मज़े करें! –

3

मैंने उपरोक्त बैश फ़ाइलों का उपयोग किया लेकिन XCode 4.5 के बाद से डेवलपर टूल ऐप बंडल के अंदर हैं। तो मैं स्क्रिप्ट मेरे MacOS शेर और वर्तमान XCode संस्करण "4.5.2 (4G2008a)" के साथ चलाने के लिए संशोधित

build_for_simulator_i386.sh:

#!/bin/sh 

# unset some shell variables 
unset CC 
unset CFLAGS 
unset CPP 

# make i386 (Simulator) target 
export CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/i686-apple-darwin11-llvm-gcc-4.2 
export CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk" 
export CPP=/usr/bin/cpp 

./configure -build=i686-apple-darwin11 --host=i686-apple-darwin11 --target=i686-apple-darwin11 --with-tdsver=7.1 

build_for_device_armv7.sh:

#!/bin/sh 

# unset some shell variables 
unset CC 
unset CFLAGS 
unset CPP 

# make arm target 
export CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 
export CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk" 
export CPP=/usr/bin/cpp 

./configure --build=arm-apple-darwin10 --host=x86_64-apple-darwin11 --target=armv7 --with-tdsver=7.1 

एक अच्छा ऐड-ऑन lipinfo द्वारा

lipo compiled_freetds-0.91_device_armv7/libsybdb.a compiled_freetds-0.91_simulator_i386/libsybdb.a -create -output universal_libsybdb.a 

और एक में दो स्थिर पुस्तकालयों मर्ज करने के लिए उपयोग करने के लिए है बस इसे परियोजना की सेटिंग्स में जोड़ना।

इसे साझा करना चाहता था, क्योंकि उपर्युक्त स्क्रिप्ट ने मुझे बहुत समय बचाया था।