From nigel at maven-group.org Sun Apr 4 14:06:37 2010 From: nigel at maven-group.org (Nigel Graham) Date: Sun, 4 Apr 2010 20:06:37 +0200 Subject: [Rbrainz-users] Fwd: mb-discid issue with OS X In-Reply-To: References: Message-ID: <1A85555D-07FB-460F-972B-B654FE40A17C@maven-group.org> Hi Derek, I looked some more into the issue and I think I have an explanation. The problem seems to be that libdiscid isn't compiled as a universal binary and ruby expects it to be. You can verify that this is the problem by doing: file /usr/local/lib/libdiscid.dylib And the reported architecture should either be i386 or x86_64 So you need to either get libdiscid built as both i386 and x86_64 which you have to do by hand (or with some scripts that I can help you with) or you need to get ruby to compile the extension with only one architecture. If you only need the gem for local development and aren't gonna distribute binaries getting ruby to change how it compiles is far easier. Simply do the following command if you are on a 64 bit machine: sudo env ARCHFLAGS="-arch x86_64" gem install mb-discid -- --with-opt-dir=/usr/local Or change the x86_64 to i386 on a 32 bit machine. Kind regards Nigel On 01/04/2010, at 02.48, Derek Reeve wrote: > Hello, > I was the original person who asked the question; I didn't want to > spam the mailing list if I was doing something silly. Unfortunately, > after spending a few hours trying different things, I'm not having > much luck. > >> The short answer that worked on my Snow Leopard: sudo gem install mb-discid -- --with-opt-dir=/usr/local >> You could argue that there should be a dir_config('discid') line in extconf.rb but since mb-discid only requires one external lib the opt option works just as well. If the dir_config option is >> added the following will also work: sudo gem install mb-discid -- --with-discid-dir=/usr/local > > I tried the --with-opt-dir switch and I tried adding dir_config to > extconf.rb and installing the gem with --with-discid-dir, all with the > same results. > I apologize for my lack of knowledge, but is it possible OS X (I'm on > Snow Leopard too) can't find libdiscid, even though it's in > /usr/local/lib? > /usr/local/lib is definitely where the libraries are installed, but I > can't seem to get gem install to find libdiscid in this case. > > I also tried updating extconf.rb with find_library('disc_id', > 'discid_new', '/usr/local/lib') and ran extconf.rb. I got the same > error; I just thought I'd give it a shot. > > Thanks for your continued help, > Derek > _______________________________________________ > Rbrainz-users mailing list > Rbrainz-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rbrainz-users From dereknreeve at gmail.com Mon Apr 5 21:48:31 2010 From: dereknreeve at gmail.com (Derek Reeve) Date: Mon, 5 Apr 2010 20:48:31 -0500 Subject: [Rbrainz-users] Fwd: mb-discid issue with OS X In-Reply-To: <1A85555D-07FB-460F-972B-B654FE40A17C@maven-group.org> References: <1A85555D-07FB-460F-972B-B654FE40A17C@maven-group.org> Message-ID: Hi Nigel, Compiling libdiscid from source, then installing the gem for x86_64 worked! I'm able to get the ID of a CD. > sudo env ARCHFLAGS="-arch x86_64" gem install mb-discid -- --with-opt-dir=/usr/local worked for me on a 2008 MacBook Pro (Intel Core 2 Duo), in case it helps someone in the future. Thanks again for your help! Derek On Sun, Apr 4, 2010 at 1:06 PM, Nigel Graham wrote: > Hi Derek, > > I looked some more into the issue and I think I have an explanation. > The problem seems to be that libdiscid isn't compiled as a universal binary and ruby expects it to be. > You can verify that this is the problem by doing: > file /usr/local/lib/libdiscid.dylib > And the reported architecture should either be i386 or x86_64 > > So you need to either get libdiscid built as both i386 and x86_64 which you have to do by hand (or with some scripts that I can help you with) or you need to get ruby to compile the extension with only one architecture. If you only need the gem for local development and aren't gonna distribute binaries getting ruby to change how it compiles is far easier. > Simply do the following command if you are on a 64 bit machine: > sudo env ARCHFLAGS="-arch x86_64" gem install mb-discid -- --with-opt-dir=/usr/local > Or change the x86_64 to i386 on a 32 bit machine. > > Kind regards > Nigel > > On 01/04/2010, at 02.48, Derek Reeve wrote: > >> Hello, >> I was the original person who asked the question; I didn't want to >> spam the mailing list if I was doing something silly. Unfortunately, >> after spending a few hours trying different things, I'm not having >> much luck. >> >>> The short answer that worked on my Snow Leopard: sudo gem install mb-discid -- --with-opt-dir=/usr/local >>> You could argue that there should be a dir_config('discid') line in extconf.rb but since mb-discid only requires one external lib the opt option works just as well. If the dir_config option is >>> added the following will also work: sudo gem install mb-discid -- --with-discid-dir=/usr/local >> >> I tried the --with-opt-dir switch and I tried adding dir_config to >> extconf.rb and installing the gem with --with-discid-dir, all with the >> same results. >> I apologize for my lack of knowledge, but is it possible OS X (I'm on >> Snow Leopard too) can't find libdiscid, even though it's in >> /usr/local/lib? >> /usr/local/lib is definitely where the libraries are installed, but I >> can't seem to get gem install to find libdiscid in this case. >> >> I also tried updating extconf.rb with find_library('disc_id', >> 'discid_new', '/usr/local/lib') and ran extconf.rb. I got the same >> error; I just thought I'd give it a shot. >> >> Thanks for your continued help, >> Derek >> _______________________________________________ >> Rbrainz-users mailing list >> Rbrainz-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rbrainz-users > > _______________________________________________ > Rbrainz-users mailing list > Rbrainz-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rbrainz-users >