Compiling for OS X megathread

Hello,

I’ve been learning how to compile Peercoin/Peerunity for Mac OS X and I have bumped into few walls and I will need some help.
So far I have learned that you need 1) Working Mac OS X install, 2) Xcode (compiler and OS X SDK).
As I do not use Apple computer I can not run OS X as native but have to virtualize it. I have found a somewhat working Mac OS X Yosemite image for KVM/Virtualbox on torrents, but Xcode demanded latest “El Capitan” to install and this image did not let me update.
What I am looking for now is that someone (a Mac user obviously) provides me with “El Capitan” image so I can get back on this.

Here is what seems sane tutorial on how to create OS X image: http://www.jesseweb.com/tech/creating-an-os-x-el-capitan-vm-in-virtualbox/
One more but seems more complex: http://anadoxin.org/blog/creating-a-bootable-el-capitan-iso-image.html

If someone can do it and compress the image so it is easier to share I would be able to continue with this.
Thanks.

Let me know when you have an image. So that I can do the same for my http://finfoil.io/ project.

Found something else after some more searching: http://www.macincloud.com/

It is a Mac OS X for hire VM in cloud, pays per hour. However you dont get root access unless you pay extra, without root it is quite cheap (1$ per hour).
I would leave this as aux solution, as the first one is better for long term.

Upon studying https://github.com/Peerunity/Peerunity/blob/master/doc/build-osx-brew.txt
I thought i’ll give it a try on my airbook

Turns out, hours and hours later further in the instructions that Qt 4.8.x versions are incompatible with the latest El Capitan. The only compatible ones are in the range Qt5.x

the silver lining is that i finally got to upgrade my os but the bad news is I cant compile qt.

[quote=“thehuntergames, post:4, topic:3826”]Upon studying https://github.com/Peerunity/Peerunity/blob/master/doc/build-osx-brew.txt
I thought i’ll give it a try on my airbook

Turns out, hours and hours later further in the instructions that Qt 4.8.x versions are incompatible with the latest El Capitan. The only compatible ones are in the range Qt5.x

the silver lining is that i finally got to upgrade my os but the bad news is I cant compile qt.[/quote]

Than a port to QT5 is needed. Not a bad thing, we finally get to live in 2016 :smiley:

Can you do what I have requested? Provide an image for future use?

believe it or not, I dont have /Applications/Install El Capitan.app nor is this installer app to be found in the app store.

I am not a expert when it comes to osx; I am a windows convert, drew the line when X came out, no regrets.

Then I am even less the expert on this.

Is this not the app mentioned in the tutorial: https://itunes.apple.com/us/app/os-x-el-capitan/id1018109117?mt=12

this is the OS, not the install app. But may be they are the same…
But let me download it again (6.2Gb!) and see how far I can get

if i were to get that far, do you have a ftp server i can upload the image to? dont want to torrent it

I will think of a decent way for you to upload the image.

have you tried https://mega.co.nz/ ?
they offer 50 GB free

I ve got an iso of about 7.7gb

PM me for a file transfer. I prefer not to put it somewhere publicly as
Apple License agreement permits me to run 2 virtualboxes only

Hey [member=30983]peerchemist[/member]

Last year I started working a toolchain to cross-compile to OSX from linux. I managed to get the daemon ported over, and only just started on getting Qt to play right with the toolchain.

The project got scrapped sometime last year during frist semesters classes when I couldn’t get a test machine to make sure the binaries were working right. I think I have the files backed up a flash drive around here somewhere.

Anyone, I based a lot of my work from this project: https://github.com/tpoechtrager/osxcross. The majority of the changes I made were to properly sign the binary with my Apple Developer cert, and to add proper dmg support so the entire building process happened in one go. I did have issues with getting the process to work well with gitian.

Good luck. Message me if you have any specific questions or problems. I have a few exams comming up this week, but if you need any help, I can see about making a write-up for you this weekend.

Cheers,
Sigmund

[quote=“peerchemist, post:5, topic:3826”][quote=“thehuntergames, post:4, topic:3826”]Upon studying https://github.com/Peerunity/Peerunity/blob/master/doc/build-osx-brew.txt
I thought i’ll give it a try on my airbook

Turns out, hours and hours later further in the instructions that Qt 4.8.x versions are incompatible with the latest El Capitan. The only compatible ones are in the range Qt5.x

the silver lining is that i finally got to upgrade my os but the bad news is I cant compile qt.[/quote]

Than a port to QT5 is needed. Not a bad thing, we finally get to live in 2016 :smiley:

Can you do what I have requested? Provide an image for future use?[/quote]

I can port the client to Qt5, it’s quite simple. I can create a ppcoin-qt5 branch once I get home from business trip if that helps.

@hrobeers

Sure, I am looking forward to see that port.

@Sigmund Alpha

I’ve seen osxcross project, but it felt way simpler to simply install Mac OS X and start from there. What were your modifications exactly? Do you have a git repo?

[hr]

Status report:

So, I have successfully installed OS X, Xcode, macports and all dependencies that are required for Peercoin clients (both QT and daemon). I must notice that makefile for os x looks hackish and recommends ancient defaults.
However I have bumped into same errors with compiling it over and over again, and now I think that it is about boost - it is compiled with non compatible libraries.
Now I will try to use boost from homebrew project.
Keep you posted.

is this still going?

I ported the codebase to Qt5 already as discussed here: https://www.peercointalk.org/index.php?topic=4475.0

I’ve been using the Qt5 client for a few days now, seems to work fine.

You might try to compile it yourself.
After installing the missing dependencies (compiler, Qt5, miniupnpc, boost) run the following commands in the source folder to compile:

qmake
make

However I never used OSX, so it might be a bit more involved. The internet might help you out if you search for “compiling Qt5 app on OSX”.

Yes, I have made some moves today. This is my first serious encounter with OS X, so it is going slowly. Working is VirtualBox does not help either.

I have to say that I am hitting the wall here, I doubt I will be able to do it before protocol switches to 0.5. It is taking too much of my time, and while hacking on this I am not productive on other stuff.
Maybe someone will get lucky with different OS X version, I have tried with “El Capitan”.

So far I have completed following:

[ul][li]Install and prepare build environment[/li]
[li]Installed dependencies (Brew worked better than macports)[/li]
[li]Edited makefile.osx to comply with dependency paths that brew installs to[/li]
[li]Used miniupnpc 1.9 patch to enable compiling against recent library versions[/li]
[li]Tried compiling with clang, which failed almost imidiatlely[/li]
[li]Tried compiling with GCC (Installed from Brew), which failed as dependencies are compiled with clang and different C library[/li]
[li]Compiled boost library with GCC to try to fix the above but it has failed again[/li]
[li]Ran out of the ideas[/li][/ul]

It is best for community to put up a bounty and get this solved while there is still time.
The bounty should also request for fixing this problem permanently with some sort of build system that would produce valid OS X package (.dmg).

What we are doing so far for OS X is a hack, statically compiling binaries and compressing them into packages without any guarantee of quality and security. This cant be a standard way to provide OS X packages - we are doing something wrong.

This should really be done properly, with package signing and all, like I did with Linux packages recently so we present this community to newcomers as a group of people who know what they are doing and doing it professionally.

Is there a chance to get Peercoin/Peerunity to official Mac OS X store?

I never compiled anything on OSX, but some guy packaged an OSX build of http://finfoil.io for me and left some build & package scripts in my git repo.
The project uses CMake instead of qmake or autotools.

I believe these are package scripts: https://github.com/hrobeers/finFoil/tree/master/scripts
And if you search for APPLE in this script you can find some apple specific build stuff: https://github.com/hrobeers/finFoil/blob/master/src/app/CMakeLists.txt

The compiler used was Clang as the Qt binaries are built for Clang and the libs were dynamically linked but included in the package, for easy installation.

Unfortunately this guy has no time to make a new build anymore (some changes need to be done to the script to include some extra libs, …). But I will probably see him again in a month or two, so he might give some pointers.

Is there someone we can pay from another community to do this for us? It’s coming down to the wire now.