Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make an Xcode project around the existing build system. #5276

Closed
wants to merge 5 commits into from

Conversation

ddustin
Copy link

@ddustin ddustin commented Nov 13, 2014

This allows many features of Xcode to be used while developing. I made it so I can work on the client in an environment I'm familiar with.

I'm not sure if you guys would be interested in this but I thought I'd offer it up in case.

@theuni
Copy link
Member

theuni commented Nov 13, 2014

Great work!

I've worked on other projects where separate buildsystems were maintained, and it proved to be tough to keep up with. The obvious drawback is that it requires that someone must constantly keep it in sync. Do you have anything in mind to handle that automatically?

There's also the issue of the msvc guys popping up with some "me too"s :)

@ddustin
Copy link
Author

ddustin commented Nov 13, 2014

Thanks =)

An Xcode plugin could "automagically" put things together based on some set of rules. Apple doesn't release the APIs so building plugins requires decompiling and guessing at them. I have experience doing it but it's slow work.

This is setup to use make for the actual building so it should keep working when / if the Xcode project falls out of date. If the project goes stale that worst that will happen is inability to autocomplete / jump to new files.

@ghost
Copy link

ghost commented Nov 13, 2014

theuni's comment regarding msvc seems quite timely, considering their new licensing model: "An unlimited number of users within an organization can use Visual Studio Community for the following scenarios: in a classroom learning environment, for academic research, or for contributing to open source projects."

@jonasschnelli
Copy link
Contributor

Awesome!
I did also some bitcoin changes in Xcode... but had a really rough setup (external build system!).

I freshly checktout your master but i cannot open the xcodeproject. It always crashes. I tested with Xcode 6.1 and 5.1.1.

Maybe the xcodeproject should not be in the root folder. Why not in the contrib folder?

crashlog:
/Applications/Xcode.app/Contents/MacOS/Xcode ~/Documents/bitcoin/bitcoinxcode/bitcoin.xcodeproj 2014-11-14 09:27:32.912 Xcode[46187:945229] DeveloperPortal: Using pre-existing current store at URL (file:///Users/jonasschnelli/Library/Developer/Xcode/DeveloperPortal%206.1.db). 2014-11-14 09:27:34.658 Xcode[46187:945226] [MT] DVTAssertions: ASSERTION FAILURE in /SourceCache/DVTFrameworks/DVTFrameworks-6539/DVTFoundation/FilePaths/DVTFilePath.m:802 Details: fsrep is relative ('src/qt/bitcoin-qt') parentPath must not be nil but it is. Object: <DVTFilePath> Method: +_filePathForParent:fileSystemRepresentation:length:allowCreation: Thread: <NSThread: 0x7fadb0c38850>{number = 1, name = main} Hints: None 2014-11-14 09:27:34.743 Xcode[46187:945226] [MT] DVTAssertions: Backtrace: 0 0x000000010706e9ca -[IDEAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] (in IDEKit) 1 0x0000000105e279ef _DVTAssertionHandler (in DVTFoundation) 2 0x0000000105e27cde _DVTAssertionFailureHandler (in DVTFoundation) 3 0x0000000105c658fb +[DVTFilePath _filePathForParent:fileSystemRepresentation:length:allowCreation:] (in DVTFoundation) 4 0x0000000105c6550d +[DVTFilePath _filePathForParent:pathString:] (in DVTFoundation) 5 0x0000000105c6527d +[DVTFilePath filePathForPathString:] (in DVTFoundation) 6 0x0000000106a2a3e2 -[IDEPathRunnable setFilePathFromUTF8String:fromXMLUnarchiver:] (in IDEFoundation) 7 0x0000000105dcbc21 _DVTSetUTF8StringRepValueWithMethod (in DVTFoundation) 8 0x0000000105ca3db2 -[DVTXMLUnarchiver decodeElementNodeWithXMLTextReader:owner:container:parsingState:success:error:] (in DVTFoundation) 9 0x0000000105ca328e -[DVTXMLUnarchiver decodeNodeWithXMLTextReader:owner:container:parsingState:error:] (in DVTFoundation) 10 0x0000000105ca4035 -[DVTXMLUnarchiver decodeElementNodeWithXMLTextReader:owner:container:parsingState:success:error:] (in DVTFoundation) 11 0x0000000105ca328e -[DVTXMLUnarchiver decodeNodeWithXMLTextReader:owner:container:parsingState:error:] (in DVTFoundation) 12 0x0000000105ca4035 -[DVTXMLUnarchiver decodeElementNodeWithXMLTextReader:owner:container:parsingState:success:error:] (in DVTFoundation) 13 0x0000000105ca328e -[DVTXMLUnarchiver decodeNodeWithXMLTextReader:owner:container:parsingState:error:] (in DVTFoundation) 14 0x0000000105ca2e2d -[DVTXMLUnarchiver _readAndReturnError:] (in DVTFoundation) 15 0x0000000106770040 +[IDEScheme schemeFromXMLData:withRunContextManager:customDataStoreContainer:customDataSpecifier:isShown:orderHint:error:] (in IDEFoundation) 16 0x000000010676f4ff -[IDERunContextManager _updateMap:contextForCustomDataStore:specifier:] (in IDEFoundation) 17 0x000000010676eae4 -[IDERunContextManager _customDataStoresDidUpdate] (in IDEFoundation) 18 0x0000000105ca5e26 -[NSObject(DVTPropertyLinking) dvt_addObserverWithName:toKeyPath:ofObject:block:] (in DVTFoundation) 19 0x000000010676e11e -[IDERunContextManager initWithWorkspace:] (in IDEFoundation) 20 0x000000010675972b -[IDEWorkspace _setupWorkspaceArenaIfNeeded] (in IDEFoundation) 21 0x0000000106871a79 __81-[IDEWorkspace _finishLoadingAsynchronously:shouldUpgradeFromSimpleFilesFocused:]_block_invoke (in IDEFoundation) 22 0x0000000106871d7a __81-[IDEWorkspace _finishLoadingAsynchronously:shouldUpgradeFromSimpleFilesFocused:]_block_invoke321 (in IDEFoundation) 23 0x00007fff8fe922e8 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ (in Foundation) 24 0x00007fff8fd7e905 -[NSBlockOperation main] (in Foundation) 25 0x00007fff8fd5d59c -[__NSOperationInternal _start:] (in Foundation) 26 0x00007fff8fd5d1a3 __NSOQSchedule_f (in Foundation) 27 0x00007fff94fbdc13 _dispatch_client_callout (in libdispatch.dylib) 28 0x00007fff94fc9cbf _dispatch_main_queue_callback_4CF (in libdispatch.dylib) 29 0x00007fff8f79ec59 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ (in CoreFoundation) 30 0x00007fff8f75b2ef __CFRunLoopRun (in CoreFoundation) 31 0x00007fff8f75a838 CFRunLoopRunSpecific (in CoreFoundation) 32 0x00007fff99f9743f RunCurrentEventLoopInMode (in HIToolbox) 33 0x00007fff99f971ba ReceiveNextEventCommon (in HIToolbox) 34 0x00007fff99f96ffb _BlockUntilNextEventMatchingListInModeWithFilter (in HIToolbox) 35 0x00007fff97e98821 _DPSNextEvent (in AppKit) 36 0x00007fff97e97fd0 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in AppKit) 37 0x000000010639382d -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in DVTKit) 38 0x00007fff97e8bf73 -[NSApplication run] (in AppKit) 39 0x00007fff97e77424 NSApplicationMain (in AppKit) 40 0x00007fff9b6b05c9 start (in libdyld.dylib) 41 0x0000000000000002 Abort trap: 6

@ddustin
Copy link
Author

ddustin commented Nov 14, 2014

I did a little trickery to make Xcode's run button work. The scheme lets
you set an executable to run which the UI makes you choose an absolute path
of what to run -- which works great if you're developing
/Applications/Safari or similar but doesn't let you choose a path relative
to the project directory.

I modified the scheme file directly to be a relative path which Xcode takes
wonderfully. Unfortunetely there is some kind of assert that Xcode fires
when it opens the project file for the first time that makes it crash.

So that means it will open it just fine with an absolute path -- not
helpful for a shared project! After it loads you can modify the file
directly to a relative path and it sucks it up no problem.

On Friday, November 14, 2014, Jonas Schnelli notifications@github.com
wrote:

Awesome!
I did also some bitcoin changes in Xcode... but had a really rough setup
(external build system!).

I freshly checktout your master but i cannot open the xcodeproject. It
always crashes. I tested with Xcode 6.1 and 5.1.1.

Maybe the xcodeproject should not be in the root folder. Why not in the
contrib folder?

crashlog:
/Applications/Xcode.app/Contents/MacOS/Xcode
~/Documents/bitcoin/bitcoinxcode/bitcoin.xcodeproj
2014-11-14 09:27:32.912 Xcode[46187:945229] DeveloperPortal: Using
pre-existing current store at URL
(file:///Users/jonasschnelli/Library/Developer/Xcode/DeveloperPortal%206.1.db).
2014-11-14 09:27:34.658 Xcode[46187:945226] [MT] DVTAssertions: ASSERTION
FAILURE in
/SourceCache/DVTFrameworks/DVTFrameworks-6539/DVTFoundation/FilePaths/DVTFilePath.m:802
Details: fsrep is relative ('src/qt/bitcoin-qt') parentPath must not be
nil but it is.
Object:
Method: +_filePathForParent:fileSystemRepresentation:length:allowCreation:
Thread: <NSThread: 0x7fadb0c38850>{number = 1, name = main}
Hints: None
2014-11-14 09:27:34.743 Xcode[46187:945226] [MT] DVTAssertions:
Backtrace:
0 0x000000010706e9ca -[IDEAssertionHandler
handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:](in IDEKit)
1 0x0000000105e279ef _DVTAssertionHandler (in DVTFoundation)
2 0x0000000105e27cde _DVTAssertionFailureHandler (in DVTFoundation)
3 0x0000000105c658fb +[DVTFilePath
_filePathForParent:fileSystemRepresentation:length:allowCreation:](in
DVTFoundation)
4 0x0000000105c6550d +[DVTFilePath _filePathForParent:pathString:](in
DVTFoundation)
5 0x0000000105c6527d +[DVTFilePath filePathForPathString:](in
DVTFoundation)
6 0x0000000106a2a3e2 -[IDEPathRunnable
setFilePathFromUTF8String:fromXMLUnarchiver:](in IDEFoundation)
7 0x0000000105dcbc21 _DVTSetUTF8StringRepValueWithMethod (in DVTFoundation)
8 0x0000000105ca3db2 -[DVTXMLUnarchiver
decodeElementNodeWithXMLTextReader:owner:container:parsingState:success:error:](in DVTFoundation)
9 0x0000000105ca328e -[DVTXMLUnarchiver
decodeNodeWithXMLTextReader:owner:container:parsingState:error:](in
DVTFoundation)
10 0x0000000105ca4035 -[DVTXMLUnarchiver
decodeElementNodeWithXMLTextReader:owner:container:parsingState:success:error:](in DVTFoundation)
11 0x0000000105ca328e -[DVTXMLUnarchiver
decodeNodeWithXMLTextReader:owner:container:parsingState:error:](in
DVTFoundation)
12 0x0000000105ca4035 -[DVTXMLUnarchiver
decodeElementNodeWithXMLTextReader:owner:container:parsingState:success:error:](in DVTFoundation)
13 0x0000000105ca328e -[DVTXMLUnarchiver
decodeNodeWithXMLTextReader:owner:container:parsingState:error:](in
DVTFoundation)
14 0x0000000105ca2e2d -[DVTXMLUnarchiver _readAndReturnError:](in
DVTFoundation)
15 0x0000000106770040 +[IDEScheme
schemeFromXMLData:withRunContextManager:customDataStoreContainer:customDataSpecifier:isShown:orderHint:error:](in IDEFoundation)
16 0x000000010676f4ff -[IDERunContextManager
_updateMap:contextForCustomDataStore:specifier:](in IDEFoundation)
17 0x000000010676eae4 -[IDERunContextManager _customDataStoresDidUpdate](in IDEFoundation)
18 0x0000000105ca5e26 -[NSObject(DVTPropertyLinking)
dvt_addObserverWithName:toKeyPath:ofObject:block:](in DVTFoundation)
19 0x000000010676e11e -[IDERunContextManager initWithWorkspace:](in
IDEFoundation)
20 0x000000010675972b -[IDEWorkspace _setupWorkspaceArenaIfNeeded](in
IDEFoundation)
21 0x0000000106871a79 __81-[IDEWorkspace
_finishLoadingAsynchronously:shouldUpgradeFromSimpleFilesFocused:]_block_invoke
(in IDEFoundation)
22 0x0000000106871d7a __81-[IDEWorkspace
_finishLoadingAsynchronously:shouldUpgradeFromSimpleFilesFocused:]_block_invoke321
(in IDEFoundation)
23 0x00007fff8fe922e8 NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK (in
Foundation)
24 0x00007fff8fd7e905 -[NSBlockOperation main](in Foundation)
25 0x00007fff8fd5d59c -[__NSOperationInternal _start:](in Foundation)
26 0x00007fff8fd5d1a3 NSOQSchedule_f (in Foundation)
27 0x00007fff94fbdc13 _dispatch_client_callout (in libdispatch.dylib)
28 0x00007fff94fc9cbf _dispatch_main_queue_callback_4CF (in
libdispatch.dylib)
29 0x00007fff8f79ec59 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE

(in CoreFoundation)
30 0x00007fff8f75b2ef __CFRunLoopRun (in CoreFoundation)
31 0x00007fff8f75a838 CFRunLoopRunSpecific (in CoreFoundation)
32 0x00007fff99f9743f RunCurrentEventLoopInMode (in HIToolbox)
33 0x00007fff99f971ba ReceiveNextEventCommon (in HIToolbox)
34 0x00007fff99f96ffb _BlockUntilNextEventMatchingListInModeWithFilter (in
HIToolbox)
35 0x00007fff97e98821 _DPSNextEvent (in AppKit)
36 0x00007fff97e97fd0 -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:](in AppKit)
37 0x000000010639382d -[DVTApplication
nextEventMatchingMask:untilDate:inMode:dequeue:](in DVTKit)
38 0x00007fff97e8bf73 -[NSApplication run](in AppKit)
39 0x00007fff97e77424 NSApplicationMain (in AppKit)
40 0x00007fff9b6b05c9 start (in libdyld.dylib)
41 0x0000000000000002
Abort trap: 6


Reply to this email directly or view it on GitHub
#5276 (comment).

@Diapolo
Copy link

Diapolo commented Nov 14, 2014

I'd love to see a guide to make Qt Creator work with what we use as build system ^^.

@jonasschnelli
Copy link
Contributor

Qt Creator works fine for me.
I imported the src/qt folder into a empty project, chose clang and some Qt paths and all done.
The only thing you need to do before that is ./configure

@Diapolo
Copy link

Diapolo commented Nov 14, 2014

@jonasschnelli Can you give me some detailed steps for this as I can't figure out how you did that.

@jonasschnelli
Copy link
Contributor

@Diapolo let me write a little manual.

@Diapolo
Copy link

Diapolo commented Nov 14, 2014

@jonasschnelli Great, thanks!

@laanwj
Copy link
Member

laanwj commented Nov 14, 2014

@ddustin We can only merge this if you promise to maintain it and keep it up to date. I'm not against having alternative build systems, but we don't have the capacity to take up maintenance of alternative systems, especially not OS-specific ones.

@jonasschnelli
Copy link
Contributor

@ddustin tried to open multiple times in multiple Xcode versions. Crashes everytime.

@jonasschnelli
Copy link
Contributor

@laanwj if it once works, i could also help keep it up to date. Promises are always hard to keep. If it gets un-updated once, drop it from the repo.

@theuni
Copy link
Member

theuni commented Nov 14, 2014

Agreed with @laanwj. I'd really prefer to not take this because of the potential burden it creates, but I accept that it may encourage a few people to get involved who otherwise wouldn't.

@ddustin I think it's going to come down to how useful it can be if it's added as a rough template, with the understanding that it's the builder's responsibility to re-scan/re-import/whatever. If that's the case, it may be worth having. However, if it's going to require pull-requests ~weekly or so to keep in sync, which can't be verified by the people merging them or CI, then I don't think that's really justifiable.

@ghost
Copy link

ghost commented Nov 14, 2014

@ddustin, is there an overwhelming advantage over a separate repo, à la https://github.com/ENikS/bitcoin-dev-msvc?

@jonasschnelli
Copy link
Contributor

@theuni: remember: a Xcode project only needs a update if a new file was added or deleted. That's absolutely madeble.

I see this files in the contribfolder.
If nobody keeps that up to date over let's say 6 month. Drop it.

@sipa
Copy link
Member

sipa commented Nov 15, 2014

Just speaking historically, we used to have 4 makefiles for different
systems, and keeping all 4 up to date when files were added or removed was
already annoying - to the point where the one file that was not regularly
tested (the visual c++ one) got hopelessly outdated and was eventually
removed. And we are currently adding/removing files much more frequently
than then.

I'm fine with other project files under contrib though, with less implied
guarantees about up to dateness.

@jonasschnelli
Copy link
Contributor

IMO theres not much to loose if we place it under the contrib sections.
Xcode brings a easy way to start developing around the bitcoin-core. For those who are not so into linux and valgrind, etc. it might help a lot.
Fluid code editing on mac (eclipse is a mess!), nice LLDB frontend, GUI like memory leak detection, static analyzer, time profiler, etc.
Proposal: after merging give the project-file a chance to survive for half a year. If it's outdated then, drop it (people will ACK the dropping then).

But the main problem is, that this pull requests xcode project won't work.

Once the basics are there, i can try to auto-configure this xcode project on a script basis. The project file is nothing more than a xml-, makefile-like thing.

@msgilligan
Copy link

I spent hours looking for official, semi-official (or anything definitive and current) build instructions or project file for Xcode -- and was very surprised that I came up empty handed. I"m really happy to see this PR.

I think there are a large number of Mac OS developers who would appreciate this being as accessible and current as possible. I guess putting it in contrib would be OK, as long as there is easy to find documentation about it.

@theuni
Copy link
Member

theuni commented Nov 17, 2014

@jonasschnelli files are added/removed all the time.
Are you saying that the files here don't actually produce a working build (I haven't tested) ? If so, that needs to be addressed before discussing anything else.

@jonasschnelli
Copy link
Contributor

@theuni: yes. Opening the Xcode project in Xcode 6.1 or Xcode 5.1.1 will make Xcode crash (see crashlog above).
Any further discussions should be held after this pull request is fixed and "runnable" on different OS X environments.

@ddustin: any progress?

@ddustin
Copy link
Author

ddustin commented Nov 18, 2014

@jonasschnelli This updated version will prevent the crash but the "run" button isn't working but building works great.

debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<PathRunnable
FilePath = "/Users/ddustin/Library/Developer/Xcode/DerivedData/bitcoin-hgcxjaiitthtfmbhlaaruaclhrgx/Build/Products/bitcoind">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: absolute user path

@ddustin
Copy link
Author

ddustin commented Nov 19, 2014

@jonasschnelli I removed those now

@laanwj
Copy link
Member

laanwj commented Nov 19, 2014

@ddustin, is there an overwhelming advantage over a separate repo, à la https://github.com/ENikS/bitcoin-dev-msvc?

I really like that idea. That way it's a separate project with separate maintainers, so changes don't even have to pass through here. We could still refer to it in documentation here.

@ddustin
Copy link
Author

ddustin commented Nov 20, 2014

Well whatever works. I built this for myself and I am happy to share it. I will maintain it for myself as long as it's useful for me, which will probably be for a while. If @jonasschnelli wants to keep it up to date too that's great.

It is worth noting this isn't actually a unique build system. It just uses Xcode to call 'make' and introduces the conveniences of the Xcode interface.

@ddustin
Copy link
Author

ddustin commented Nov 20, 2014

To demonstrate a few of the simpler features:

If you edit the scheme to point to src/qt/bitcion-qt you can easily set breakpoints visually, step through, and use Xcode's debugging interface. You can also CMD+click functions (like SetupEnvironment in this example) and see implementations for things. This speeds up development for me by an order of magnitude. Check it out in these screenshots.

1
2
3
4
5
6

@jonasschnelli
Copy link
Contributor

@ddustin i had a look at it. Good work.
IMO: on the other hand it's to specialized for taking this into the main-repo.
I think it is best if we keep this in another separate github repository.
Would that be okay for your?

@ddustin
Copy link
Author

ddustin commented Nov 23, 2014

@jonasschnelli Sure, I'll keep it at github.com/ddustin/bitcoin for now -- I'll give you write permissions to it. Should we change the name of the repo?

@laanwj
Copy link
Member

laanwj commented Nov 24, 2014

@ddustin Keeping it separate from the bitcoin core tree itself, like https://github.com/ENikS/bitcoin-dev-msvc (which seems to have bitcoin as a submodule), could save merging work.

@msgilligan
Copy link

Not only does keeping it a separate repo save you merging work, but it should allow people using your project to fork it and point it at whatever branch of bitcoin they want to work on.

@laanwj
Copy link
Member

laanwj commented Dec 15, 2014

We'd welcome a document (or part in an existing document) pointing out these alternative build systems and their maintainers.

@laanwj
Copy link
Member

laanwj commented Dec 16, 2014

Closing the pull as it is not the goal to merge this but to refer to it.

@laanwj laanwj closed this Dec 16, 2014
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants