sixones / vitality

Macintosh Eve online skill planner
GNU General Public License v3.0
70 stars 12 forks source link

Error compiling on El Capitan #52

Closed mire3212 closed 8 years ago

mire3212 commented 8 years ago

When attempting to compile from source in Xcode, the following error is produced:

vitality-master/src/Core/DBManager.m:31:9: 'openssl/sha.h' file not found

It's been widely stated across the internet that Apple removed OpenSSL headers from the system, but even after using home-brew to install openssl and link the files, it fails to compile.

Bleyddyn commented 8 years ago

I haven't upgraded to El Capitan, yet. (Bad me, I know).

Is the Base SDK set to 10.9 in build settings? Click on Vitality in the Project navigator, then Vitality under Targets, then Build Settings near the top. Base SDK should be in the first section, under Architectures.

If you don't have the 10.9 SDK (Apple insists on deleting all old SDKs when you update Xcode, so you need to manually save them and restore them after an update), you can try adding the openssl header directory to the Header Search Paths entry in the Search Paths section of Build Settings.

If neither of those work, maybe we'll need to find another solution. Possibly switching to using the CommonCrypto framework, which I hadn't heard of until just now.

Maybe this weekend I can finally upgrade to 10.11 and find out what else breaks in the build.

mire3212 commented 8 years ago

Good call. I was able to add the OpenSSL search path I have from Brew into the build-settings and was able to compile past the OpenSSL errors. Now it's just other stuff that's breaking that I think are changes that were made with Objective-C in the newer releases.

EDIT: After modifying the search path and remove a few __weak references no longer supported in El Cap, I was able to successfully build and run the app.

fivesixzero commented 8 years ago

I was able to compile on El Capitan by making the following edits:

  1. Changed build target from 10.9 10.6 to 10.11
  2. Add explicit paths to homebrew's OpenSSL headers to point to any required openssl headers under /usr/local/include/openssl/.
    • /src/Core/DBManager.m is the only one I recall off the top of my head.
    • Note: Before doing this I ran brew install openssl, brew unlink openssl, brew link openssl --force to assure that the headers were present and properly linked.
  3. Removed "__weak" text from a few files.
    • /src/Preferences/GeneralPrefViewController.h
    • /src/Private/StatusItemView.h b/src/Private/StatusItemView.h
    • /src/Private/StatusItemViewController.h b/src/Private/StatusItemViewController.h
    • /src/Private/StatusItemWindow.h b/src/Private/StatusItemWindow.h
    • I'm not really sure what the significance of this is, something with garbage collection? But its not available in El Capitan and will actually trigger a blocking error.

After that I was able to compile on El Cap and a the app seemed to work alright, despite ~19 warnings that popped up during build. I'm still new to Xcode and Obj C in general so I'm ill-equipped to handle these just yet, so here's the list of warnings:

Vitality Group

Attribute Unavailable Group

file:///Users/userdir/Source/vitality/src/EveNotifications/English.lproj/MTNotificationsWindow.xib: warning: Attribute Unavailable: Identifier before OS X 10.7

/Users/userdir/Source/vitality/src/EveNotifications/English.lproj/MTNotificationsWindow.xib: Use Current Width For Max Layout Width before OS X 10.8
/Users/userdir/Source/vitality/src/EveNotifications/English.lproj/MTNotificationsWindow.xib: Row Size Style other than custom before OS X 10.7
/Users/userdir/Source/vitality/src/EveNotifications/English.lproj/MTNotificationsWindow.xib: View Based content mode before OS X 10.7

Unsupported Configuration Group

/Users/userdir/Source/vitality/src/Windows/English.lproj/SkillDetails.xib: This file is set to build for a version older than the deployment target. Functionality may be limited.
/Users/userdir/Source/vitality/src/Views/Character Sheet/English.lproj/CharacterSheet.xib: This file is set to build for a version older than the deployment target. Functionality may be limited.
/Users/userdir/Source/vitality/src/Views/Skill Planner/English.lproj/SkillPlan.xib: This file is set to build for a version older than the deployment target. Functionality may be limited.
/Users/userdir/Source/vitality/src/Contracts/English.lproj/ContractDetails.xib:1: Minimum size {492, 540} is larger than content size {492, 536}

Attribute Unavailable Group

/Users/userdir/Source/vitality/src/EveNotifications/English.lproj/MTNotificationsWindow.xib:9: Identifier before OS X 10.7

Semantic Issue Group

/Users/userdir/Source/vitality/src/Core/Controls/MTEveSkillCell.m:731:1: Conflicting return type in implementation of 'hitTestForEvent:inRect:ofView:': 'NSCellHitResult' (aka 'enum NSCellHitResult') vs 'NSUInteger' (aka 'unsigned long')
/Users/userdir/Source/vitality/src/Core/Controls/MTImageView.h:16:48: 'atomic' attribute on property 'menu' does not match the property inherited from 'NSResponder'
/Users/userdir/Source/vitality/src/Core/Controls/MTSkillButtonCell.m:220:1: Conflicting return type in implementation of 'hitTestForEvent:inRect:ofView:': 'NSCellHitResult' (aka 'enum NSCellHitResult') vs 'NSUInteger' (aka 'unsigned long')

Format String Issue Group

/Users/userdir/Source/vitality/src/Views/Skill Planner/PlanView2.m:468:16: Null passed to a callee that requires a non-null argument
/Users/userdir/Source/vitality/src/Views/Skill Planner/PlanView2.m:476:16: Null passed to a callee that requires a non-null argument
/Users/userdir/Source/vitality/src/Views/Skill Planner/SkillPlanController.m:212:19: Null passed to a callee that requires a non-null argument
/Users/userdir/Source/vitality/src/Windows/ShipDetailsWindowController.m:128:66: Null passed to a callee that requires a non-null argument
/Users/userdir/Source/vitality/src/Windows/ShipDetailsWindowController.m:144:72: Null passed to a callee that requires a non-null argument
/Users/userdir/Source/vitality/src/Windows/SkillDetailsWindowController.m:141:64: Null passed to a callee that requires a non-null argument
/Users/userdir/Source/vitality/src/VitalityMail/METMessageViewController.m:68:66: Null passed to a callee that requires a non-null argument
Bleyddyn commented 8 years ago

Changed build target from 10.9 to 10.11

If you mean the Base SDK, that should be fine as long as the Deployment Target under General is still set to 10.6. Yes, Vitality still supports back that far, although I do think it's time to change that to 10.9.

fivesixzero commented 8 years ago

Ahh, yes, it was 10.6 to 10.11. I don't have the 10.9 SDK installed (couldn't figure that out quickly) so I just used 10.11.

I'm still new to github, but here's a PR covering the changes I made to get it to compile.

https://github.com/sixones/vitality/pull/53

I guess for wide release targeting 10.9 for build makes a lot more sense though. :)

mire3212 commented 8 years ago

I'm going to go ahead and close this issue since we know how to make it work and there's are pull requests to fix it.

Thanks all!

Bleyddyn commented 8 years ago

I merged in the second pull request and it still builds and runs on my 10.10 machine.

fivesixzero commented 8 years ago

Since I had a hard time getting the 10.9 SDK downloaded (noob problem, I know), here's a quick process for other people working on El Capitan who want to target 10.9 with builds.

  1. Get old SDKs downloaded to a single directory.
    • git clone git@github.com:phracker/MacOSX-SDKs.git
  2. Move or symlink these SDKs to the following directory:
    • /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
    • sudo ln -s ./MacOSX-SDKs/MacOSX10.6.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
    • Repeat for other SDKs between 10.6 and 10.9 as necessary.
    • Make sure Xcode is closed.
    • Edit /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist and change the MinimumSDKVersion value from 10.11 to 10.6.
    • Open Xcode.
    • In the properties for Vitality.xcodeproj change the build target to Mac OS X 10.6 or OS X 10.9

Whew. If there's an easier way to do this, that'd be awesome.

With this changed the app builds fine. I'm going to update the pull request to keep the build target at 10.6 since its probably a few years premature to target 10.11. Looks like PR is taken care of, awesome. 😄

fivesixzero commented 8 years ago

Just ran a build after pulling the latest version and everything worked great. Thanks guys. 😀