Well, the problem is that options that you put into build method are inserted to the link command line BEFORE the list of files, which makes causes the issue.
To do it correctly, you should put this as package feature (that will make it independt from build method too).