Skip to content

Instantly share code, notes, and snippets.

@ratijas
Created February 17, 2016 20:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ratijas/2d4224fcc3fe80a3b7e7 to your computer and use it in GitHub Desktop.
Save ratijas/2d4224fcc3fe80a3b7e7 to your computer and use it in GitHub Desktop.
decoding .ogg music files with XLD
#!/bin/sh
# copyright 2016 Ratijas & Mac-J studio
# WTF Public Licence
# sadly, XLD still does not support .ogg files decoding out of the box.
# there's instruction with outdated download link: https://hydrogenaud.io/index.php/topic,81239.0.html,
# so here we'll recreate all necessary steps needed to patch up your XLD installation.
# we will need git, svn and Xcode (with command line tools)
# REWRITE following line if your XLD.app is not at /Applications
XLD=/Applications/XLD.app
# exit on any error
set -e
# get a copy of project's fork with XLDVorbisDecoder
rm -rf xld >/dev/null 2>&1 || true
git clone https://github.com/zwaldowski/xld.git
cd xld
# at this point `cd XLDVorbisDecoder && xcodebuild` should fail with error:
# ld: warning: directory not found for option '-F~/xld/XLDVorbisDecoder/../xld_frameworks'
# ld: framework not found Ogg
#
# so, let's bring Ogg.framework, and Vorbis.framework as well.
# i managed to found them here: https://github.com/VDrift/vdrift-mac/tree/master/Frameworks
# but git does not support downloading only particular directory,
# that's why we will use svn instead.
mkdir xld_frameworks
cd xld_frameworks
svn checkout https://github.com/VDrift/vdrift-mac/trunk/Frameworks/Vorbis.framework
svn checkout https://github.com/VDrift/vdrift-mac/trunk/Frameworks/Ogg.framework
# note: if this is your first time using svn with Github, it may ask you to manually
# verify certificate fingerprint. last time checked, it was:
# a0:c4:a7:46:00:ed:a7:2d:c0:be:cb:9a:8c:b6:07:ca:58:ee:74:5e
# if matches, answer with 'p' and <enter>.
cd ..
cd XLDVorbisDecoder
xcodebuild
# this time you should see ** BUILD SUCCEEDED **
# install bundle
cp -r build/Release/XLDVorbisDecoder.bundle "$XLD"/Contents/PlugIns/
# now, you may try to run XLD, and if you're lucky, you'll see message like this in console:
# 18.02.16 3:52:12,170 XLD[38126]: Error loading $XLD/Contents/PlugIns/XLDVorbisDecoder.bundle/Contents/MacOS/XLDVorbisDecoder: dlopen($XLD/Contents/PlugIns/XLDVorbisDecoder.bundle/Contents/MacOS/XLDVorbisDecoder, 265): Library not loaded: @executable_path/../Frameworks/Vorbis.framework/Versions/1.3/Vorbis
# Referenced from: $XLD/Contents/PlugIns/XLDVorbisDecoder.bundle/Contents/MacOS/XLDVorbisDecoder
# Reason: image not found
#
# so, let's fix libraries versions
cd ..
cd xld_frameworks
cp -r Ogg.framework/Versions/1.3 "$XLD"/Contents/Frameworks/Ogg.framework/Versions/1.3
cp -r Vorbis.framework/Versions/1.3 "$XLD"/Contents/Frameworks/Vorbis.framework/Versions/1.3
killall XLD >/dev/null 2>&1 || true
open "$XLD"
echo "now your XLD should be familiar with decoding .ogg files!"
@melgu
Copy link

melgu commented Feb 27, 2018

Failed with the following:

=== BUILD TARGET XLDVorbisDecoder OF PROJECT XLDVorbisDecoder_export WITH THE DEFAULT CONFIGURATION (Release) ===

Check dependencies
No architectures to compile for (ARCHS=x86_64, VALID_ARCHS=i386 ppc).

** BUILD FAILED **


The following build commands failed:
	Check dependencies
(1 failure)

(macOS High Sierra)

@Sappharad
Copy link

@melgu The instructions are outdated and don't work with the latest version of XLD anyway.
I pulled the latest source code for the current version of XLD from sourceforge, the source actually still includes the Ogg decoder plug-in but the code for it hasn't been touched since the version this script pulls so that part doesn't matter. Here's a summary of what's wrong:

  1. XLD is a 32-bit app, and so is this plug-in. Xcode will default projects to 64-bit now and not try to build them in 32-bit. That's the cause of the error you pasted above. Opening the project in Xcode and just switching it to 32-bit will get you past this error.
  2. Even if you fix the error, it still won't build because it uses OpenSSL which is not part of recent macOS versions anymore. The use of OpenSSL may seem odd since that's an encryption library, but it's not actually using it for that. It's using it because OpenSSL has logic to decode files encoded in Base64. When Ogg files have Album art in their tags, the art is Base64 encoded and needs to be converted back to an image. Rather than installing OpenSSL using brew, it's fairly simple to rip it out and replace the Base64 decoding logic with Apple's Base64 decoder.
  3. Once those are fixed, you'll get a successful build, but the plug-in still won't work. The script here pulls the Vorbis and Ogg frameworks from the VDrift repository, but those are now newer than the version XLD is using. (XLD still supports PPC macs for some reason) So any version of XLD will puke and reject the plug-in because the framework is newer. The fix for this is to grab the version of the frameworks from inside the XLD app, but they don't have headers so the build will fail again. I fixed this on my copy by manually getting copies of the headers and adding them to Header Search paths in the Xcode project so it could find them.

That's what's needed right now to build a working copy of the Ogg Decoder plug-in. But I suspect that this will only work for another year or so.

The bigger problem now is that High Sierra 10.13.4 was released today and it officially started warning that support for 32-bit apps is going to go away soon. I'm guessing macOS 10.14 this Fall might make it optional like Rosetta was in 10.6, and they'll probably remove it completely in late 2019. XLD's developer will need to eventually remove PPC support and add 64-bit Intel instead for it to continue working.

For anyone who wants it, here's the copy I just built that works against the current version of XLD as of this post along with the changes I made:
https://github.com/Sappharad/xld/releases/tag/20170729
I have no idea if it will actually work for anyone else, but I used it successfully. You don't need the source code, GitHub just packs that up automatically when you create a release.

@realdannys
Copy link

Hey @Sappharad - your build here works perfectly in XLD 32bit, there is a 64bit beta now - I tried to build it again with 64bit support but I ran into lots of build errors and I had no idea how to swap out openSSL for Apple's Base64 decoder - would you be able to attempt to do a build with 64bit support?

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