Đối với những người như tôi sẽ bỏ ra hàng giờ tìm kiếm tài liệu cho những lá cờ cấu hình tiêu chuẩn (cho chạy ./configure make make install)
./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
Bây giờ sau đó để giải quyết vấn đề.
1) Lấy phiên bản mới nhất của freetds http://www.freetds.org/
2) Bước tiếp theo là làm cho các file bash shell của riêng bạn mà một cách chính xác chạy freetds ./configure. Bạn sẽ cần hai như mô phỏng là kiến trúc i386/i686 và một thiết bị táo (iPhone, iPod, vv) là kiến trúc ARM. Ngoài ra, các tệp/phiên bản trình biên dịch của bạn trong thư mục phát triển iPhone có thể khác nhau, chỉ cần tìm những gì tạo ra ý nghĩa logic và có quy ước đặt tên tương tự. Kiến trúc máy chủ mac được cung cấp với lệnh uname -p.
Dưới đây là ví dụ của tôi để xây dựng để sử dụng trên trình giả lập (i386) build_for_simulator_i386.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
Ví dụ về cấu hình cho ARM biên soạn (build_for_device_armv7.sh):
#!/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) Tiếp theo cd vào thư mục freetds gốc dẫn đến việc giải nén tải xuống freetds, tôi đã freetds_0.91
4) Chạy một trong các tập lệnh của bạn. Bạn chỉ có thể biên dịch cho ONE kiến trúc tại một thời điểm
sh build_for_(desiered build)
this runs ./configure for you with the correct options
(tds version 7 required for NTLM authentication)
5) Khi quá trình cấu hình đã hoàn tất bạn phải hack các tập tin cấu hình. Mở freetds_0.91/include/config.h sau đó trên đường dây 172 thay đổi #define HAVE_ICONV 1 để #define HAVE_ICONV 0
6) Nếu trước đó bạn đã chạy./ cấu hình, thực hiện, thực hiện cài đặt rồi chạy các lệnh này. Đặc biệt là nếu bạn kiến trúc chuyển mạch như bạn sẽ nhận được các lỗi chạy thực hiện mà không làm điều này
sudo make clean
sudo make uninstall
7) Thực hiện việc biên soạn sử dụng làm
make all
sudo make install
Thủ tục làm không thông qua một số lỗi trên mục đích, nhưng nếu bạn nhìn thấy các lỗi trong vòng sáu hoặc bảy dòng dấu nhắc trình bao, sau khi nó trả về, bạn có vấn đề và cần sửa chúng trước khi tiếp tục. Cho phép chỉ nói nhiều điều có thể đi sai vào thời điểm này.
8) Sau khi cài đặt tệp nhị phân tuân thủ, đó là đỉnh điểm của tất cả các tệp .o nhỏ mà freetds tạo là /usr/local/lib/libsybdb.a Tin tưởng tôi không muốn kéo. o chỉ cho thư viện bạn muốn. Sao chép /usr/local/lib/libsybdb.a vào thư mục thích hợp trong dự án của bạn. Những gì tôi đã làm là có hai thư mục riêng biệt, mỗi thư mục một kiến trúc, có tên là "compiled_freetds-0.91_simulator_i386" và "compiled_freetds-0.91_device_armv7".
9) Vì bạn muốn làm cho cuộc sống của bạn trở nên dễ dàng và có xcode tìm ra tệp đã biên dịch nào sử dụng theo tập hợp con các bước này để thực hiện liên kết động.
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) Bước cuối cùng dường như tránh vấn đề lỗi liên kết động liên quan đến libsybdb.5.dylib khi chạy mã trên thiết bị là gỡ cài đặt. Ngoài ra, khi chạy trên thiết bị, bạn cũng sẽ nhận được rất nhiều cảnh báo, với số gia 36, về CPU_SUBTYPE_ARM_ALL không được chấp nhận, điều đó là bình thường, nhưng gây phiền nhiễu.
sudo make uninstall
Tôi hy vọng điều này sẽ hữu ích.
Điều này thật tuyệt! Nhưng tôi đã sử dụng iSQL SDK bởi mobilefoo. – Hackmodford
@AmigableClarkKant Điều đó sẽ có ý nghĩa hơn rất nhiều. – Tristan