Export to GitHub

btstack - issue #82

Getting Started Instructions Fails to Build against 4.1


Posted on Sep 24, 2010 by Massive Rabbit

What steps will reproduce the problem? 1. Following instructions from http://code.google.com/p/btstack/wiki/GettingStarted 2. svn checkout http://btstack.googlecode.com/svn/trunk/ btstack 3. cd btstack 4. in bootstrap.sh: change aclocal to aclocal -I /opt/local/share/aclocal 5. ./bootstrap.sh 6. ./configure --target=iphone --with-sdk-version=4.1 --with-gcc-version=4.2.1 7. make

What is the expected output? What do you see instead?

I get: Making all in src /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1 -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/include -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/lib/gcc/arm-apple-darwin10/4.2.1/include -F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/System/Library/Frameworks -Werror -I../include -o BTdaemon btstack.c hci_cmds.c linked_list.c run_loop.c run_loop_posix.c run_loop_embedded.c run_loop_cocoa.m sdp_util.c socket_connection.c utils.c bt_control_iphone.m daemon.c hci.c hci_dump.c hci_transport_h4.c l2cap.c l2cap_signaling.c remote_device_db_iphone.m platform_iphone.c sdp.c ../SpringBoardAccess/SpringBoardAccess.c -framework CoreFoundation -framework Foundation -F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/System/Library/Frameworks -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/lib -framework Foundation -framework CoreFoundation -framework UIKit -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/System/Library/Frameworks/IOKit.framework/Versions/A /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/System/Library/PrivateFrameworks/BluetoothManager.framework/BluetoothManager -lIOKit -lobjc In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/include/mach/mach_types.h:98, from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/include/mach/mach.h:66, from bt_control_iphone.m:66: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/include/mach/clock_types.h:84:1: error: "NSEC_PER_USEC" redefined In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/include/dispatch/dispatch.h:48, from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFMessagePort.h:11, from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:53, from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6, from bt_control_iphone.m:63: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/include/dispatch/time.h:51:1: error: this is the location of the previous definition In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/include/mach/mach_types.h:98, from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/include/mach/mach.h:66, from bt_control_iphone.m:66: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/include/mach/clock_types.h:85:1: error: "USEC_PER_SEC" redefined In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/include/dispatch/dispatch.h:48, from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFMessagePort.h:11, from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:53, from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6, from bt_control_iphone.m:63: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/include/dispatch/time.h:50:1: error: this is the location of the previous definition In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/include/mach/mach_types.h:98, from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/include/mach/mach.h:66, from bt_control_iphone.m:66: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/include/mach/clock_types.h:86:1: error: "NSEC_PER_SEC" redefined In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/include/dispatch/dispatch.h:48, from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFMessagePort.h:11, from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:53, from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6, from bt_control_iphone.m:63: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk/usr/include/dispatch/time.h:48:1: error: this is the location of the previous definition make[1]: * [BTdaemon] Error 1 make: * [all-recursive] Error 1

What version of the product are you using? On what operating system?

Mac OS 10.6.4 ios sdk 4.1 jailbroken 3G

Please provide any additional information below.

There are a few different xcode projects in the distro - it is not at all clear which ones I would use to make a program that can write to a bluetooth printer on an iphone. That's all I need. Discover a printer, open a connection, and write stuff to it. Should be easy. I'm clueless which pieces I'm supposed to put together to do this.

Comment #1

Posted on Sep 24, 2010 by Swift Ox

hi. I recommend SDK 3.0 to compile BTstack and/or build JB apps that use it. AFAIK it builds against SDK 4.0 with the syntax you used in configure. I'll be happy to commit fixes if you figure out why it doesn't build on 4.1 - personally, I still didn't install Xcode 4 or SDK 4 :)

as for you application, opening a connection to printer should be easy, but it then depends on the actual protocol being used. Think of opening a Bluetooth (L2CAP) connection as a TCP-Socket. Some Bluetooth printers use OBEX to send them files, I'm working on OBEX integration for iOS which we hope to release soon. It works e.g. with the Polaroid PoGo printer.

For developer questions, please join the BTstack Google Group.

Comment #2

Posted on Sep 24, 2010 by Massive Rabbit

Found it - in bt_control_iphone.m change includes around line 65-ish to undef the symbols as shown below.

include

if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_2_0

undef NSEC_PER_USEC

undef USEC_PER_SEC

undef NSEC_PER_SEC

include

and it builds against 4.1

Comment #3

Posted on Sep 24, 2010 by Swift Ox

thanks for the fix. r945 adds your fix.

Status: Verified

Labels:
Type-Defect Priority-Medium