Skip to content

Fixes to compile on Mac#11

Open
CaptEmulation wants to merge 2 commits intobottlecaps-foundation:masterfrom
CaptEmulation:master
Open

Fixes to compile on Mac#11
CaptEmulation wants to merge 2 commits intobottlecaps-foundation:masterfrom
CaptEmulation:master

Conversation

@CaptEmulation
Copy link

These are the fixes I had to make to compile on Mac OS X 10.9 (Mavericks) + Qt 5.3. Introduces native notifications for Mac which do not depend on Growl being installed. Also fixes alignment for clang++ compiler. Not including my .pro file as it is, unfortunately, heavily modified and very specific to my system. Client currently syncing with network. Changes should have no effect on windows/unix builds. These changes are from upstream litecoin.

@iamunick
Copy link
Contributor

iamunick commented Jul 7, 2014

@CaptEmulation, You say this works on Mavericks?

I don't see the specific changes you made to make it compile on Mavericks, could you please share more?

Mind you, I haven't tried it yet or carefully looked at the code, I'll check more carefully later. At first glance, I seem to have already made those changes to make it compile, but on Mountain Lion, never worked on Mavericks

@iamunick
Copy link
Contributor

iamunick commented Jul 7, 2014

Ok, looks like using Qt 5.3 might be the trick... but I get a bunch of compile errors with that version. would you mind sharing your .pro file (on pastebin) so I can look for the changes I might be missing?

Thanks

@CaptEmulation
Copy link
Author

I have not personally seen a problem compiling the AppleScript based GROWL notification code in wallets until I upgraded to Mavericks and Qt 5.3. However, since I did both I don't know which one specifically is causing the problem.

Here is the PRO file: http://pastebin.com/UjHMKrQR

Notable changes (from memory):

  • Added macnotificationhandler.mm
  • Updates to point to homebrew built dependencies

@iamunick
Copy link
Contributor

iamunick commented Jul 7, 2014

I'm scratching my head over this for a few months now.

I never got to successfully compiling on Mavericks for any combination of toolchain Qt version I tried.

The best case scenario it's failing near the end when it's trying to link boost components (I get the error "Undefined symbols for architecture x86_64")

I compiled every dependencies from source using hombrew, I believe this is what you used, correct?

So if you could share the steps you took and version of dependecies/toolchain to make it work on Mavericks, (building dependencies and stuff) it would be awesome

thanks

@Tranz5
Copy link
Contributor

Tranz5 commented Jul 7, 2014

From this end, it looks good, but I don't think changing scrypt-x86_64.S to align 16 is the correct move. I believe there are are better compatibility fixes for this out there.

@CaptEmulation
Copy link
Author

From this end, it looks good, but I don't think changing scrypt-x86_64.S to align 16 is the correct move. I believe there are are better compatibility fixes for this out there.

I would really love to see an alternative as well. That being said, I have used that change on multiple Mac builds/ports of wallets I've performed over the past 6 months and have never had any problem with it in terms of sending/receiving/mining/etc on the compiled wallet.

@CaptEmulation
Copy link
Author

So if you could share the steps you took and version of dependecies/toolchain to make it work on Mavericks, (building dependencies and stuff) it would be awesome

bitcoin/bitcoin#3228 helped me

@CaptEmulation
Copy link
Author

Here's a release build from this PR: https://s3.amazonaws.com/captemulation/dmg/BottleCaps-Qt.dmg

64 bit Mavericks Qt 5.3.0

@CaptEmulation CaptEmulation changed the title Fixes to compile on Mac OS X 10.9 + Qt 5.3 Fixes to compile on Mac Jul 8, 2014
@iamunick
Copy link
Contributor

iamunick commented Jul 8, 2014

Ok, this was another arm wrestle but I finally got it working.

though, I had to modify 2 files (didn't you have to modify them too???)

in net.cpp (line 60), I needed to change

array<int, THREAD_MAX> vnThreadsRunning; to boost::array<int, THREAD_MAX> vnThreadsRunning;

and in serialize.h Qt complained about a redifinition of void insert(...)
so I changed (~line 814)

void insert(iterator it, const_iterator first, const_iterator last)
    {
        assert(last - first >= 0);
        if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
        {
            // special case for inserting at the front when there's room
            nReadPos -= (last - first);
            memcpy(&vch[nReadPos], &first[0], last - first);
        }
        else
            vch.insert(it, first, last);

to

#ifndef MAC_OSX
    void insert(iterator it, const_iterator first, const_iterator last)
    {
        assert(last - first >= 0);
        if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
        {
            // special case for inserting at the front when there's room
            nReadPos -= (last - first);
            memcpy(&vch[nReadPos], &first[0], last - first);
        }
        else
            vch.insert(it, first, last);
    }
#endif

I am not making a pull request as I want to do a few builds to make sure I haven't missed anything and that it works flawlessly.

I also use the .align 16 fix instead of .align 32. Like Tranz said, there must be a better way to fix this compatibility wise. So for now, this change will remain local.

Gavin mentioned about dropping support for MacPorts, I think it's a good idea to drop it altogether too for bottlecaps. So the changes you made concerning dependencies location should be made permanent but for the homebrew location. I wouldn't link to the cellar folder as you did, but to the /usr/local/lib and /usr/local/include instead. The brew link command will take care of symlinking to those directories and its a more update resistant way to approach this.

All dependencies I used were installed with homebrew. Even Qt 5.3 (even though I tried with 5.3.1 downloaded from the official website, and it also worked)

I had to edit the QMAKE_MACOSX_DEPLOYMENT_TARGET in macx-clang/qmake.conf file from 10.6 to 10.9. I don't think this is good setting for public releases compatibility wise, but it does work locally for now. I'll have to test out how this is going to play out with earlier version.

And you do need the macnotificationhandler script to make this build on Mavericks, or else it will fail with Growl only. I think previous version of OS X used to simply ignore it.

I might have changed a few more parameters, but this is all I remember for now. I'll edit this if I remember anything else.

@CaptEmulation
Copy link
Author

though, I had to modify 2 files (didn't you have to modify them too???)

No I did not. Maybe a new boost change? I will check within the next day or two.

I also use the .align 16 fix instead of .align 32. Like Tranz said, there must be a better way to fix this compatibility wise. So for now, this change will remain local.

This is fine. Will remove until better solution found

So the changes you made concerning dependencies location should be made permanent but for the homebrew location.

Been poking around and it appears Dogecoin/Litecoin have a pretty elegant solution to automatically determine MacPorts/Homebrew dependencies. Allow me to try it out.

I wouldn't link to the cellar folder as you did, but to the /usr/local/lib and /usr/local/include instead. The brew link command will take care of symlinking to those directories and its a more update resistant way to approach this.

Agreed-- should be done at a minimum. I was withholding PRO file due to shame ;-)

@iamunick
Copy link
Contributor

iamunick commented Jul 8, 2014

Been poking around and it appears Dogecoin/Litecoin have a pretty elegant solution to automatically determine MacPorts/Homebrew dependencies. Allow me to try it out.

That's fine, I would love to see that too. I was just pointing out the fact that MacPorts seems to break more often than Homebrew. But I'm all in for freedom of choice :)

Agreed-- should be done at a minimum. I was withholding PRO file due to shame ;-)

Understood, I was just making sure that it was properly done in the "final" commit ;)

@iamunick
Copy link
Contributor

iamunick commented Jul 8, 2014

@CaptEmulation, Just to let you know that I look forward to you testing the latest boost (1.55.0_2) and Qt5 from Homebrew (updated).

If the changes that I had to make were only needed on my system, It won't be a good idea to commit them.

Also, I use Qt Creator 3.1.2 to build, are you using that too?

Thanks again

@CaptEmulation
Copy link
Author

Using Qt Creator 3.1.1.

Been completely slammed at work. Will probably need to wait until weekend at earliest to finish up.

@CaptEmulation
Copy link
Author

Some updates to PRO file. I created tried to create a new build system on a fresh vmware mac image, but after compiling boost ended up still with those stdc conflicts. Brough the script back to my first machine and was able to build there after:

brew unlink qt4
brew link berkeley-db4 --force

So probably still needs more attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants