Camen Design Forum

Just one of those frustrations, you know

append delete Kroc

So, there’s probably something wrong with me because I’m not enjoying this, yet something about it must appeal to some deep part of the brain because I’m still here, bashing my head against this wall.

I am of course trying to run an emulator. Actually, the emulator works just fine; it's my computer that’s not fast enough. This takes me right back to when I had a really crappy Acer laptop, 800 MHz Pentium III / Windows 98, and the only way I could play an N64 emulator was to kill every single process, including explorer. Then, _and only then_, would the emulator just manage to squeeze in 50 fps.

So, this emulator, I’m only getting 10-20 fps. The nuisance problem being that frameskip is broken on OSX and has been for two years, so I can’t get a cheap and easy optimisation that way :| After discovering the particular code revision that broke the problem, I looked at getting the Mac build for the previous one that worked—the official Mac downloads didn’t begin until the revision after the one I want (literally, that close) :| I would have to download and compile the code! >:[

Compiling code, and especially on a Mac is a real pain. It’s cryptic and fragile to the extreme. First of all CMake is not installed. I have to download and compile CMake just to be able to preconfigure the compiler configuration for the emulator (Yo dawg, I heard you like compilers, so I made you a compiler to compile your compiler). Then I run CMake and that fails because "cg" is missing. I can’t just `brew install cg` so it’s something more complicated.

Anyway, side-track time. I give up on compiling for a moment (oh, but I haven’t escaped yet) and do some research trying to locate a Mac download of this revision. I come across some information that there is a particular revision (earlier) that is much faster than any other. Someone has kindly compiled a Mac binary! Yay! The binary is hosted on MegaUpload. Was hosted. Feck. Some googling later, and there’s no mirror anywhere.

So, I checkout the source for that revision and go back to trying to compile. After a bit of googling, I’m able to narrow down "cg" as an nvidia library, something to do about vertex shaders. I download their installer package, run that and try to recompile.

"CgGL not found". Hmm. :|

Turns out that CgGL is to do with cg (though there's next to nothing on Google about CgGL), but cg is installed, what gives? Turns out it’s a path problem. The location on OSX is different than other nixes and CMake can’t find cgcl within cg. I poke through the CMake file but can’t find anything obvious. After poking through some files I find a CMake cache file that describes the configuration produced by CMake. In here is a line that says `CGGL:FILEPATH=notfound`. I modify that to point to the right location and run CMake again.

`wxwidgets not found`.

Okay, next hurdle. I try `brew install wxmac`. Compile fails. wxwidgets 2.8 is Carbon and can’t be compiled 64-bit, I need the pre-release version of wxwidgets to compile to cocoa. So I download wxwidgets and compile that.

But the CMake is still failing because it’s trying to locate SVN info in the folder, and they have since moved to git. I comment out the CMake lines related to SVN and CMake again.

`Cannot find source file: Src/io_osx.m`

I do a search and find that the file is named `io_osx.mm`, not `io_osx.m` and fix the CMake file again.

CMake completes! Huzzah! I have finally managed to configure the compiler. Now I have to actually compile! :|

`cc1: error: unrecognized command line option "-Wno-unused-result"`

That’s where I am right now. I’ll keep you posted on the joy as it unfolds!

Kroc added on

That was caused by a change in GCC since this old code was written. I found the relevant CMake line and removed the option.

Now it says `fatal error: 'AL/al.h' file not found`!

Kroc added on

Disabled the lines in CMake for OpenAL, I’ll be using CoreAudio anyway.

Unfortunately, now I may have hit my limit as there appears to be errors with the source code itself: `error: expected unqualified-id @class NSString, Protocol;` which I doubt I’m going to be able to rectify :(

Kroc added on

That error was apparently caused by mixing C++ and Objective-C. The file must be ".mm" instead of ".cpp" so I rename the relevant code file and update the CMake. I think I’m learning… something… but I’m not sure what.

Next problem: `use of undeclared identifier 'X11Utils'`

Kroc added on

That appears to have been a coding issue relating to a macro not including a header file, but the code trying to use it. Just removed the macro and forced the include since I do have X11.

Next problem: `'gtk/gtk.h' file not found`

Reply RSS

Replies

append delete #1. theraje

I think I’m learning… something… but I’m not sure what.

That the hardest part about coding isn't _writing_ code -- but getting code to compile and link properly!

append delete #2. Kroc

Need to download and compile GTK, obviously! GTK won’t install because of a permissions problem with my /usr/local. A little bit of Googling and I’ve discovered I need to `chown` a few things. Install GTK again…

(by this point I can only imagine I have downloaded several gigs of software and compiled umpteen system libraries I have never heard of before and may never use again)

Okay, so GTK installed, but the emulator won’t compile because of various gtk.h missing errors. Turns out it’s just a path issue, but GTK appears to be an absolute beast with all sorts of mad build systems and I can’t find a simple answer, so I have to search through the source code and insert the full file paths for the GTK files. Fun times!

append delete #3. theraje

Yeah, it's ridiculous. Such is the life of one who wishes to *use* open-source software (as opposed to just looking at poorly documented, obtuse, open-source code).

I've gotten to the point where if there is no binary version for the platform I'm using, I either find an alternative, or -- that failing -- I go back to the drawing board. I don't have enough months in the year to spend a lot of time fiddling with software written by someone who wants to write lines of code as opposed to a working software solution.

append delete #4. Kroc

Okay, so after *much* search and replacing, we have progressed to our next error: `duplicate case value '308'`. Looks like another coding error.

append delete #5. Kroc

That was because the command and the control keys appear to have the same constant in the code (but do different things). Have commented out one of them for now and will have to see what happens. I won’t be using the keyboard to play, so it shouldn’t be an issue.

Two errors that look a lot more complex, `elaborated type refers to a typedef` and `array index of '3' indexes past the end of an array (that contains 3 elements)`

There’s only so much code I can fix without any knowledge of C++ :P

append delete #6. Johann

Well, arrays in C have a fixed size, and accessing elements beyond that means reading/writing random bits in memory that belong to other variables or programs, so you're basically looking at a buffer overflow there :P But is that really an error, and not "merely" a warning? Maybe you can "solve" a bit of this by toning down the warning level ^^

No clue about the second one, maybe you could post the offending line of code? C++ kinda goes over my head, but hey, the more the merrier, what could go wrong haha.

append delete #7. theraje

Not sure what an "elaborated type" is... maybe some Mac/XCode-ese?

As for the "index array of 3", it's a simple array-index-out-of-bounds error. Given that I don't know the given function, nor its context, either add bounds checking to the code referencing the array; or, if it is a compile error (and not a run-time error), go to the erroneous line of code, note the name of the array, and find where it is declared. This will give you an idea of how many intended array indices there should be.

theraje added on

lol -- got ninja'd by Johann.

But yeah, what's your warning level set to? If you're writing it yourself, -Wall is a good flag to use... but other people's code, you may be better off ignoring some warnings if they won't cause havoc. (An array index out of bounds error at run-time is bad, although with virtualized program spaces, segfaults tend not to bring down the whole system anymore. Still not much fun, though.)

append delete #8. Kroc

Eh, don’t worry, giving up—I have been at this all day and it’s obvious I’m not going to get this running. It’s two year old code running in an environment very different from where it was written. Your help is appreciated.

I posted this just to show how ridiculous software is, even for technically skilled people like myself!

append delete #9. Impressed

THIS is what you've been doing all day??? It hurts my head just reading about it.

I think you must really love me. How do I know? Because, when I asked you, in the evening, what 'to compile software' means, you took that half a second in which you swiftly decided to be patient and to explain. After a whole day bashing your head against the wall, only a man deeply in love with me would decide against wringing my neck for asking that question. I love you, too.

append delete #10. theraje

I posted this just to show how ridiculous software is, even for technically skilled people like myself!

Agree completely! But hey, at least you and your wife compiled and are running without any segfaults. ;)

append delete #11. Kroc

I’d lose my header if it wasn’t compiled on!

append delete #12. oldtimes

This rant sounds about same when trying to compile some open source software to old Solaris boxes with very old library base (some OSS libraries are 10-15 year old versions in those hosts I try to use). Anyway, usually it goes something like this... you can't even start compiling because of missing / old library -> start compiling that missing library -> it requires some other library -> and that requires then something else... and again and again... after few hours everything is done and you are back to start. FINALLY when starting to compile that original OSS software if does not compile for some reason. It is not that well spent day. :)

Oh and there are plenty of ready compiled binaries, too bad those are almost always dynamically linked. :P

append delete #13. jamesmiller5

I'm surprised you don't run a full GNU Linux stack as your primary OS.

append delete #14. Kroc

If I ever go FOSS, it’s BSD or OpenStep for me!

append delete #15. Martijn

I totally feel where you are coming from with this. I’ve tried getting Mednafen to run on my MacBook without any luck for several days. It’s the Tried installing Fink and MacPorts, and failed miserably through both.

I find that developers of Open Source code talk about ‘just compiling’ a little too soon these days.

append delete #16. theraje

I find that developers of Open Source code talk about ‘just compiling’ a little too soon these days.

Yes. I've exhausted too much effort, all in the futility of "just compiling" FOSS. It's never been worth it -- not once -- to go beyond hitting the 'compile' button if that isn't enough to get things going. (The only exception is the standalone Lua compiler, but that worked probably the *second* time I tried to compile it.)

And then there are some of those guys who, when asked for help, will tell you "learn how to use a compiler." These types don't really care about users, it seems. Just the code. Which, really, is fine... though I don't see the point in making it open source, then.

append delete #17. jamesmiller5

I think a good support structure is the important piece of the puzzle that is often neglected.

Hope isn't a strategy, you can't design a system (FOSS or commercial) where everything "just works" because eventually something will break. It's important to have a strong community/philosophy that focuses on providing help when things go south.

The main reason I use ArchLinux instead of Ubuntu is because when something *does* break there is a pretty good chance of getting help strait from the wiki. The beginners guide gives explicit and exact instructions.

Reply

(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.

Your friendly neighbourhood moderators: Kroc, Impressed, theraje, Martijn