[MacRuby-devel] Request for feedback on new tutorial

Nick Ludlam nick at recoil.org
Tue Aug 24 14:17:27 PDT 2010


Brilliant, thanks Laurent. There's loads of topics that writing my own app has thrown up, so hopefully I can make time to write a few more, and build it into a series.

On 24 Aug 2010, at 21:42, Laurent Sansonetti wrote:

> Thanks for the modifications, Matt merged them and I just re-deployed the website. Your article is now live :)
> 
> http://www.macruby.org/documentation/reading-an-mp3-with-macruby.html
> 
> Laurent
> 
> On Aug 23, 2010, at 2:22 PM, Nick Ludlam wrote:
> 
>> Hi Thibault, it's actually me who wrote the tutorial, and Emil who gave me really solid feedback on some required steps I managed to miss out first time round.
>> 
>> I've done what you've recommended and changed the example irb session to use simple-prompt mode.  It's now pushed to http://github.com/nickludlam/macruby_website/tree/bundle-tutorial and awaiting a merge from Matt.
>> 
>> Nick
>> 
>> On 23 Aug 2010, at 18:58, Thibault Martin-Lagardette wrote:
>> 
>>> Hi Emil!
>>> 
>>> That's very awesome work, thanks for the dedication of making a tutorial!
>>> 
>>> I would simply want to add, maybe you should launch macirb with --simple-prompt, it makes the output a little nicer and clearer I think (at least for that kind of examples where line numbers are not really needed).
>>> 
>>> Thank you again!
>>> -- 
>>> Thibault Martin-Lagardette
>>> 
>>> 
>>> 
>>> On Aug 22, 2010, at 12:46, Nick Ludlam wrote:
>>> 
>>>> 
>>>> Fantastic feedback, thanks again. I've included comments inline below, and I've updated the preview at http://recoil.org/~nick/macruby/documentation/realworld-dynamic-bundles.h
>>>> 
>>>> On 20 Aug 2010, at 14:51, Emil Tin wrote:
>>>> 
>>>>> progress!
>>>>> I downloaded your project, and it builds without problems. Comparing them I found out that:
>>>>> 
>>>>> 1. my project was missing the 'Copy Headers' build phase.
>>>> 
>>>> You're right, I've added this into the text.
>>>> 
>>>> 
>>>>> 2. after adding a 'copy headers' phase, and using the get info.. then checkbox method to add headers files from the taglib target to the taglibbundle target, it still couldn't build because my project had list.tcc and tmap.tcc in the 'compile sources' build phase. for some reason, it seems that when i use 'get info' method, files with the .tcc extension are added to the 'compile source' phase isntead of the 'copy headers' phase.
>>>> 
>>>> Yeah it seems XCode gets confused with that suffix. I've simplified the method of cloning the header and source settings by getting the reader to drag and drop the files from the existing folders directly into the new.
>>>> 
>>>> 
>>>>> after moving the two .tcc files to the 'copy headers phase', my project builds. moving on i found.
>>>>> 
>>>>> 
>>>>> 3.  TagLib.h needs #import <Cocoa/Cocoa.h>
>>>> 
>>>> Linking to <Foundation/Foundation.h> should be all thats needed, but the template uses Cocoa, so I'll add a step to edit this from Cocoa to Foundation.
>>>> 
>>>> 
>>>>> 4. TagLib.m needs #import "tag_c.h"
>>>> 
>>>> Correct, and fixed!
>>>> 
>>>> 
>>>>> 5. the copy script at the end failed. the reason was i copied it from the webpage, which had a line break. you might add a "\" to the code at the webapge:
>>>>> 
>>>>> cp -v "${TARGET_BUILD_DIR}/${EXECUTABLE_PATH}" \
>>>>> "${SOURCE_ROOT}/${FULL_PRODUCT_NAME}"
>>>> 
>>>> I've now added the backslash to help with the line wrapping.
>>>> 
>>>> 
>>>>> 6. i need to require the full path to the bundle (or modify load paths). simply using require 'TagLibBundle' fails even if i'm inside the folder the bundle is?
>>>> 
>>>> I think this is because I missed a step where you give the project the '.bundle' suffix, so you end up with a 'TagLibBundle.bundle' filename. I've added it to the tutorial text. 
>>>> 
>>>> 
>>>>> 7. it works! i can use test.tags[:title] and get the title af an mp3.
>>>>> 
>>>>> 8. if i call test.tags i get a segmentation fault:
>>>>> 
>>>>> ~/Desktop/MacRuby/TagLib.framework$ macirb
>>>>> Couldn't load Wirble: no such file to load -- wirble
>>>>> irb(main):001:0> require '/Users/emiltin/Desktop/MacRuby/TagLib.framework/TagLibBundle.bundle'
>>>>> => true
>>>>> irb(main):002:0> test = TagLib.alloc.initWithFileAtPath("/Users/emiltin/Music/Elysium\ etc/Celestial_Sounds_and_Tribal_Beats_mp3/05.Wisdom.mp3")
>>>>> => #<TagLib:0x200031f40>
>>>>> irb(main):003:0> test.tags[:title]=> "Wisdom"
>>>>> irb(main):004:0> test.tagsSegmentation fault
>>>> 
>>>> Ok this is a weird one, and I think related to reference counting and release pools. I've now altered the way the wrapper works, and it now uses discreet ivars and getters instead of a dictionary, which is a little more verbose, but nicer from the Ruby side of things.
>>>> 
>>>> 
>>>>> 
>>>>> On 20/08/2010, at 14.42, Nick Ludlam wrote:
>>>>> 
>>>>>> Thanks very much Emil. I'll go through the points:
>>>>>> 
>>>>>> 1. Good catch. I'll replace this with 'curl' since it's part of the base system. 
>>>>>> 
>>>>>> 2. I'll describe this step in a little more detail, perhaps with a screenshot. There is a reasonable familiarity with XCode that's assumed, though.
>>>>>> 
>>>>>> 3. I suspect this is related to build setting change that I may have missed out. If you have time, could you grab the project from http://github.com/nickludlam/TagLib.framework and try compiling ?
>>>>>> 
>>>>>> 
>>>>>> Nick
>>>>>> 
>>>>>> 
>>>>>> On 20 Aug 2010, at 12:42, Emil Tin wrote:
>>>>>> 
>>>>>>> 
>>>>>>> nice tutorials!
>>>>>>> 
>>>>>>> i tried following the tutorial but ran into a few problems:
>>>>>>> 
>>>>>>> 1.
>>>>>>> wget command was not found. wget is not installed by default in os x, it seems.
>>>>>>> 
>>>>>>> 2.
>>>>>>> linking agains foundation and libz: as an xcode beginner, i had to guess a bit to figure out how to do this. i suppose you mean adding items in the 'linked libraries' area of the taglibbundle target info pane. maybe describe in a sentence the simple steps involved.
>>>>>>> 
>>>>>>> 3.
>>>>>>> can't compile. when i try to build the project, i get a lot of errors. here's the first:
>>>>>>> 
>>>>>>> 
>>>>>>> CompileC /Users/emiltin/Desktop/builds/TagLib.build/Debug/TagLibBundle.build/Objects-normal/x86_64/tlist.o taglib-src/taglib/toolkit/tlist.tcc normal x86_64 c++ com.apple.compilers.gcc.4_2
>>>>>>> cd /Users/emiltin/Desktop/MacRuby/TagLib.framework
>>>>>>> setenv LANG en_US.US-ASCII
>>>>>>> /Developer/usr/bin/gcc-4.2 -x c++ -arch x86_64 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -DHAVE_CONFIG_H -isysroot /Developer/SDKs/MacOSX10.6.sdk -mfix-and-continue -fvisibility-inlines-hidden -mmacosx-version-min=10.6 -gdwarf-2 -iquote /Users/emiltin/Desktop/builds/TagLib.build/Debug/TagLibBundle.build/TagLibBundle-generated-files.hmap -I/Users/emiltin/Desktop/builds/TagLib.build/Debug/TagLibBundle.build/TagLibBundle-own-target-headers.hmap -I/Users/emiltin/Desktop/builds/TagLib.build/Debug/TagLibBundle.build/TagLibBundle-all-target-headers.hmap -iquote /Users/emiltin/Desktop/builds/TagLib.build/Debug/TagLibBundle.build/TagLibBundle-project-headers.hmap -F/Users/emiltin/Desktop/builds/Debug -I/Users/emiltin/Desktop/builds/Debug/include -I/Users/emiltin/Desktop/builds/TagLib.build/Debug/TagLibBundle.build/DerivedSources/x86_64 -I/Users/emiltin/Desktop/builds/TagLib.build/Debug/TagLibBundle.build/DerivedSou
> r
>> c
>>> e
>>>> s 
>>>>>> -c /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc -o /Users/emiltin/Desktop/builds/TagLib.build/Debug/TagLibBundle.build/Objects-normal/x86_64/tlist.o
>>>>>>> 
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:42: error: expected class-name before '{' token
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:51: error: 'List' is not a template
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:51: error: 'List' has not been declared
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:51: error: expected unqualified-id before ':' token
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:66: error: 'List' is not a template
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:66: error: 'List' has not been declared
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:66: error: expected unqualified-id before '<' token
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:90: error: expected constructor, destructor, or type conversion before '<' token
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:96: error: expected constructor, destructor, or type conversion before '<' token
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:102: error: expected constructor, destructor, or type conversion before '<' token
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:109: error: expected nested-name-specifier before 'List'
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:109: error: expected initializer before '<' token
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:116: error: expected nested-name-specifier before 'List'
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:116: error: expected initializer before '<' token
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:122: error: expected nested-name-specifier before 'List'
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:122: error: expected initializer before '<' token
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:129: error: expected nested-name-specifier before 'List'
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:129: error: expected initializer before '<' token
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:135: error: expected nested-name-specifier before 'List'
>>>>>>> /Users/emiltin/Desktop/MacRuby/TagLib.framework/taglib-src/taglib/toolkit/tlist.tcc:135: error: expected initializer before '<' token
>>>>>>> .....
>>>>>>> 
>>>>>>> 
>>>>>>> i'm using taglib 1.6.3, os x 10.6.4 and xcode 3.2.3
>>>>>>> 
>>>>>>> I'm not very experienced with xcode, and not sure what to do next. i followed the steps you described wtih setting up xcode build settings, etc. it seems the header files is somehow not included correctly?
>>>>>>> 
>>>>>>> thanks,
>>>>>>> emil
>>>>>>> 
>>>>>>> 
>>>>>>> On 19/08/2010, at 19.12, Nick Ludlam wrote:
>>>>>>> 
>>>>>>>> I've written up a first draft of a tutorial on taking C/C++, wrapping the code in a simple Obj-C class, then exporting this as a bundle which can be loaded by MacRuby. In this case, it's about wrapping the open-source TagLib library in order to extract ID3 tags from mp3 files.
>>>>>>>> 
>>>>>>>> If people have the time, I'd really appreciate any feedback on things like length, clarity, and accuracy of describing steps in XCode etc etc. 
>>>>>>>> 
>>>>>>>> http://recoil.org/~nick/macruby/documentation/realworld-dynamic-bundles.html
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Thanks,
>>>>>>>> Nick
>>>>>>>> 
>>>>>>>> _______________________________________________
>>>>>>>> MacRuby-devel mailing list
>>>>>>>> MacRuby-devel at lists.macosforge.org
>>>>>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>>>>> 
>>>>>>> _______________________________________________
>>>>>>> MacRuby-devel mailing list
>>>>>>> MacRuby-devel at lists.macosforge.org
>>>>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>>>> 
>>>>>> _______________________________________________
>>>>>> MacRuby-devel mailing list
>>>>>> MacRuby-devel at lists.macosforge.org
>>>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>>> 
>>>>> _______________________________________________
>>>>> MacRuby-devel mailing list
>>>>> MacRuby-devel at lists.macosforge.org
>>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>> 
>>>> _______________________________________________
>>>> MacRuby-devel mailing list
>>>> MacRuby-devel at lists.macosforge.org
>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>> 
>>> _______________________________________________
>>> MacRuby-devel mailing list
>>> MacRuby-devel at lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> 
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel



More information about the MacRuby-devel mailing list