Sign in to follow this  
Funkymunky

How to best use the linker

Recommended Posts

Funkymunky    1413
I have a very large project, hundreds of files, with many of them individually being very large files. When I try to link it with a command line linker (metrowerks) I get a generic "Internal Linker Error" message. I've tried contacting the company, but they haven't been much help yet. I'm thinking that maybe if I either break up some of the larger files into many smaller pieces it might link properly? Or if I instead reduce the number of files by making fewer but larger files. Which would be the better bet for the linking process?

Share this post


Link to post
Share on other sites
chessnut    100
Best bet would be to start small and get a few of the core fews linked and just build on after that until you run into the problem source. But before that I would make sure it's not just some problem specific to metrowerks.

Share this post


Link to post
Share on other sites
Funkymunky    1413
I can selectively get successful links, yes, so I know all the files in the project are linkable. And I'm afraid its definitely a metrowerks thing, since its an undiagnosed, unidentified error. Still, if I were going to try and ease things up on the linker, which method would probably be better? Many small files or a few large ones?

Share this post


Link to post
Share on other sites
technobot2    122
I'm not sure, but my guess is that your object files should be compatible with a different linker (unless I'm grossly misunderstanding what and how linkers do). You can try e.g. the one that comes with gcc for mingw - it's free. Or, if they're not compatible you could just use a different compiler to begin with (along with the linker that comes with it) - unless you're using some non-standard language. Note though that for example gcc is more strict than some other compilers when it comes to various coding standards..

And in any case, if the files can all be linked in some small groups, it still doesn't mean they don't create some conflict or other when one tries to link all of them. So you should try to gradually add files towards the goal of linking all of them, until you get a maximum set of linked files. Then in the remaining ones, try commenting out parts of the file and gradually adding back to find which piece of code may be causing the problem.

But this is all very tedious - I suggest you try a different linker first. At the very least it may give you a more useful error message..

Share this post


Link to post
Share on other sites
Evil Steve    2017
What platform? If it's PC, is there any reason you can't use Visual Studio?

We're stuck using CodeWarrior at work for DS development, and I can homnestly say that it's the worst IDE / compiler / linker that I have ever seen or used. It's buggy, bloated, slow, and even generates broken code in some cases (Which I found out after a day debugging). And we also got a linker error (The linker actually crashed with the "Send error report" dialog...) which we fixed by changing the order files were linked in. It really doesn't fill me with confidence at all...

Share this post


Link to post
Share on other sites
Funkymunky    1413
yeah, I'm afraid I'm stuck using the CodeWarrior linker. I guess I'll try both approaches, first smaller files and then fewer larger ones. Checking the link order might be a worthwhile investigation as well. Thanks

Share this post


Link to post
Share on other sites
Funkymunky    1413
any additional thoughts on this? I'm in the process of breaking down the project from ~ 200 files to ~ 1600. I seriously doubt its going to improve the situation. any other options?

Share this post


Link to post
Share on other sites
the_edd    2109
I have no experience with code warrior, but if you haven't done so already, you might try ordering the libraries on the linker command line in different orders i.e. most dependencies -> least dependencies or the other way around.

I suggest this because one of these orderings will probably require the optimal situation for the linker in terms of the amount of work it has to do.

Of course, if metroworks is anything like gcc, it will require you to order the objects starting with the most dependencies!

Hey, I tried :)

Edd

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this