Camoto compilation errors

Discuss game modding
User avatar
yellowantphil
4-bit nibble
Posts: 24
Joined: October 10th, 2011, 12:00 am
Location: Oklahoma
Contact:

Camoto compilation errors

Post by yellowantphil »

Now that this is the designated place to discuss Camoto, I guess I’ll post an error I got trying to compile libgamegraphics in the latest git version of Camoto:

Code: Select all

g++ -DHAVE_CONFIG_H -I. -I..   -I ../include -I/home/phil/camoto/install/include/camoto-1.0     -g -O2 -MT gamegfx.o -MD -MP -MF .deps/gamegfx.Tpo -c -o gamegfx.o gamegfx.cpp
In file included from png++/png.hpp:55,
                 from common.hpp:22,
                 from gamegfx.cpp:29:
png++/consumer.hpp: In member function ‘void png::consumer<pixel, pixcon, info_holder, interlacing_supported>::read(istream&, const transformation&) [with istream = std::basic_ifstream<char, std::char_traits<char> >, transformation = png::convert_color_space<png::index_pixel>, pixel = png::index_pixel, pixcon = png::image<png::index_pixel>::pixel_consumer, info_holder = png::image_info_ref_holder, bool interlacing_supported = true]’:
png++/image.hpp:240:   instantiated from ‘void png::image<pixel>::read_stream(istream&, const transformation&) [with istream = std::ifstream, transformation = png::convert_color_space<png::index_pixel>, pixel = png::index_pixel]’
png++/image.hpp:200:   instantiated from ‘void png::image<pixel>::read(const char*, const transformation&) [with transformation = png::convert_color_space<png::index_pixel>, pixel = png::index_pixel]’
png++/image.hpp:175:   instantiated from ‘void png::image<pixel>::read(const std::string&, const transformation&) [with transformation = png::convert_color_space<png::index_pixel>, pixel = png::index_pixel]’
png++/image.hpp:107:   instantiated from ‘png::image<pixel>::image(const std::string&) [with pixel = png::index_pixel]’
common.hpp:123:   instantiated from here
png++/consumer.hpp:162: error: no match for call to ‘(const png::convert_color_space<png::index_pixel>) (png::reader<std::basic_ifstream<char, std::char_traits<char> > >&)’
I didn’t try to figure out what was wrong, other than it having to do with line 123 in common.hpp, or maybe my version of png++, which is 0.2.5.
Malvineous
8-bit mega nerd
Posts: 292
Joined: March 17th, 2007, 6:40 pm
Location: Brisbane, Australia
Contact:

Re: Camoto compilation errors

Post by Malvineous »

Ah yes, this was a limitation in png++ which the author kindly corrected however the fix is in png++ SVN only. If you check out the SVN repo into libgamegraphics/examples/png++/ then it will compile fine. You will also want to duplicate the folder into camoto-studio/src/png++/ as the Studio now also requires the same SVN fix to import and export images correctly.
User avatar
yellowantphil
4-bit nibble
Posts: 24
Joined: October 10th, 2011, 12:00 am
Location: Oklahoma
Contact:

Re: Camoto compilation errors

Post by yellowantphil »

Cool, downloading the svn version of png++ fixed that error.

There was a minor problem compiling editor-map-canvas.cpp in camoto-studio:

Code: Select all

editor-map-canvas.cpp:1153: error: ‘maxInstances’ was not declared in this scope
editor-map-canvas.cpp:1179: error: ‘maxInstances’ was not declared in this scope
I added a couple local declarations of maxInstances to fix this.

Do you a way to make git overwrite my changes to a file and redownload it? Somehow my version of editor-map-document.cpp got screwed up and git checkout refused to overwrite the file. I haven’t figured out how to make git do what I want yet... I ended up deleting the camoto-studio directory and downloading it all again.
Malvineous
8-bit mega nerd
Posts: 292
Joined: March 17th, 2007, 6:40 pm
Location: Brisbane, Australia
Contact:

Re: Camoto compilation errors

Post by Malvineous »

Glad to hear it. Just FYI I'm currently rewriting the I/O part of the library (it got too messy trying to work around the limitations of C++ iostreams) so there are some big code changes coming - I'm going to try to publish them all at once across all libraries to avoid breaking things, but you'll need to update and recompile everything when this happens (remembering to do libgamecommon first, and libgamegraphics before libgamemaps.)

As for git, you can use 'git checkout' to discard your changes and revert a file back to the latest in the repository. Running 'git status' will tell you which, if any, files have been changed and helpfully list the commands to run to undo those changes.

As for maxInstances that's an oversight, I think I committed a bit of in-progress work too early. It's for limiting the number of objects in the map editor, so you can only have one start location in a map, for example. I'll commit the rest of the code when it's working, but in the meantime your fix will work, although you might want to set it to zero ("unlimited") to avoid placing any artificial limits on any tiles you might be trying to place in a map!
User avatar
yellowantphil
4-bit nibble
Posts: 24
Joined: October 10th, 2011, 12:00 am
Location: Oklahoma
Contact:

Re: Camoto compilation errors

Post by yellowantphil »

Here are the errors I got trying to compile the latest version:

In libgamecommon/src/lzw.cpp, I needed to #include <iostream> to fix these errors:

Code: Select all

lzw.cpp:87: error: ‘cerr’ is not a member of ‘std’
lzw.cpp:88: error: ‘hex’ is not a member of ‘std’
lzw.cpp:90: error: ‘endl’ is not a member of ‘std’
On line 75 of libgamearchive/src/util.cpp, I needed to change “i->string()” to “i->c_str()”. I’ve had to do this sort of thing before, and as I recall, you said it probably had to do with us using different versions of Boost. It seems like there should be some way to write the code so that it works for both versions, but I don’t know how. I tried reading the Boost documentation on their website once and was not impressed at first glance... If you switch to Qt I’d be more willing to help. :ugeek: :roll:

In libgamearchive/examples/hello.cpp: added #include <iostream>. Also did this in libgamemusic/src/mus-generic-opl.cpp and camoto-studio/src/MusicWriter_OPLSynth.cpp. I’m starting to wonder why your compiler doesn’t complain about this and mine does...

Also, git checkout seems to be working just fine for me now... I don’t know what the trouble was last time.
Malvineous
8-bit mega nerd
Posts: 292
Joined: March 17th, 2007, 6:40 pm
Location: Brisbane, Australia
Contact:

Re: Camoto compilation errors

Post by Malvineous »

Hmm interesting, I've no idea why my compiler doesn't complain. "gcc -v" says version 4.6.1 (20110819 prerelease), which compiler are you using?

I'm very reluctant to add conditional compilation for the Boost libraries (to deal with the version issues), given that it would effectively be adding in obsolete code - is something preventing you from using the latest version of Boost? Most systems allow multiple versions of Boost to be installed simultaneously for precisely this reason, so that would definitely be the preferred solution. (Of course once you make these changes git should leave them in place with future updates, as the code that is affected by this isn't changed very often.)

And yes the Boost documentation is pretty obtuse in places. Part of the reason for this latest change was the poor documentation for boost::iostreams, so that part at least has gone away. Other parts of Boost have been incorporated into the latest version of C++ so just wait until I start using C++11 code if you want to see some compile errors ;-) But at least now I can write out PCX images properly, which was the final straw that prompted the rewrite.

Thanks for posting the locations of the other errors, I'll make sure I fix them. You might get some conflicts when you do a "git pull" since you've already got these changes in your local copy, so in that case you might have to checkout the affected files and re-run git pull.

BTW you can also run "git diff" if you just want to copy and paste everything you've changed in one go, I'm happy to read diffs.
User avatar
yellowantphil
4-bit nibble
Posts: 24
Joined: October 10th, 2011, 12:00 am
Location: Oklahoma
Contact:

Re: Camoto compilation errors

Post by yellowantphil »

I have gcc 4.4.4. I’ve never had any trouble with GCC 4.4, and I would expect GCC 4.6 to work fine too... I’m not familiar enough with C++ to say for sure whether it should be necessary to include <iostream> in those files.

I certainly wouldn’t recommend adding conditional compilation to accommodate more than one version of Boost. I think I’ve been reading my Boost version as 1.4.2 when it’s actually 1.42, and yours as 1.4.6... and if the versions had been numbered that way, anything that would compile with version 1.4.2 should also compile with 1.4.6. But I guess they don’t have to guarantee compatibility between versions 1.42 and 1.46.

As for why I don’t install a newer version of Boost, it’s because it’s easier to just change a couple function calls here and there than install Boost.

I just noticed today that Boost doesn’t do what I thought it did, so I guess my comparing it to Qt doesn’t make much sense. But I don’t know wxWidgets either...

As for C++11, I will gladly download the latest version of GCC once you start using that. I get tired of seeing programs written in ancient language standards that have long since been replaced. And then MS Visual C++ can’t even handle C99. I really shouldn’t have to change the file extension of a C99 program to .cpp just to make it compile...
Malvineous
8-bit mega nerd
Posts: 292
Joined: March 17th, 2007, 6:40 pm
Location: Brisbane, Australia
Contact:

Re: Camoto compilation errors

Post by Malvineous »

Well after some experimentation it turns out Boost's function.hpp includes <iostream> so that's why it compiles for me - I guess your Boost version doesn't include iostream in that file. I will add it to lzw.cpp though, because I think it is better style to #include what you use rather than rely on some other library that may or may not include it in the future! So thanks for letting me know about that.

I'm also curious - which Linux distribution are you running? Most of them should have some way of automatically installing a more recent version of Boost relatively painlessly.
User avatar
yellowantphil
4-bit nibble
Posts: 24
Joined: October 10th, 2011, 12:00 am
Location: Oklahoma
Contact:

Re: Camoto compilation errors

Post by yellowantphil »

Hmm yes, I don’t see <iostream> in /usr/include/boost/function.hpp.

I’m using Slackware 13.1, which is about a year and a half old by now. As for relatively painless installation of a new version of Boost, it depends on your threshold of pain. :shock:

Slackware’s package management system is roughly on the technological level of stone knives and bearskins. The “correct” way to get a newer version of Boost would probably be to compile it from source and build and install a package from that. That process could be anywhere from relatively simple to mildly tortuous... More likely, I’ll just wait until Slackware 14.0 comes out and install that, which ought to be sometime next spring. Or if I get tired of waiting, I could compile it from the source and just install it without making a Slackware package out of it.

Still, I like every aspect of Slackware other than its package management. And Slackware’s package management is still better than using RPMs. I probably wouldn’t mind using Debian but I’ve never installed it.
Malvineous
8-bit mega nerd
Posts: 292
Joined: March 17th, 2007, 6:40 pm
Location: Brisbane, Australia
Contact:

Re: Camoto compilation errors

Post by Malvineous »

Interesting. I ran Slackware for many years (it was my first Linux distro, but I switched away from it around version 10 after growing tired of having to manually compile and install all the dependencies whenever I wanted to try something new) so I completely understand where you're coming from. And why there is no package :-) Boost is actually relatively easy to compile though (did it many times under Slackware), despite the initial process being a bit bizarre. I assume you're using Slackware for the educational aspect (being the best way to learn Linux), so what better way to learn than to compile Boost yourself :-)
User avatar
yellowantphil
4-bit nibble
Posts: 24
Joined: October 10th, 2011, 12:00 am
Location: Oklahoma
Contact:

Re: Camoto compilation errors

Post by yellowantphil »

Compiling the latest version... Only one error this time.

I needed to add #include <iostream> in camoto-studio/src/audio.cpp. I just noticed that I did this a couple months ago. I guess the latest git checkout removed <iostream> again.

Probably the educational aspect of Slackware had something to do with why I started using it. Although at this point, I suppose I mainly like Slackware’s simplicity. Also, it’s already installed on my computers, and I’m not too inclined to download a new distribution and learn how to use it. So at this point, perhaps I’m using Slackware because I don’t want to learn any more than I already know. :D

Which distribution do you use? I used Mandrake once upon a time, but never had much luck with it. At this point I can’t imagine willingly using anything based on Red Hat (except at work, where it seems that I’ll be using RHEL for the rest of my days). I might try Debian someday, although I don’t know how much they patch their software. Red Hat can’t resist plastering patches all over everything, but everything in Slackware (the kernel, GCC, ...) is very lightly patched, or completely vanilla.
Malvineous
8-bit mega nerd
Posts: 292
Joined: March 17th, 2007, 6:40 pm
Location: Brisbane, Australia
Contact:

Re: Camoto compilation errors

Post by Malvineous »

Oh so close. Just added it to audio.cpp, thanks.

I was running Slackware everywhere like you for a number of years (still runs on an old server at work) but I switched to Gentoo for a few years as I liked the idea of all programs being compiled from source, optimised for your CPU. Gentoo has a "rolling release" so there are no reinstalls, just continuous incremental upgrades. Unfortunately it became apparent with Gentoo that compiling every program on your system is incredibly slow - a big upgrade might have to run overnight, and this is on a quad-core machine! So upgrading was not something you wanted to do very often - but unless you upgraded at least once a month you could easily reach a point where your system was so out of date it was not possible to upgrade it at all, and you were very quickly forced to learn a lot more about Gentoo's internals that you ever wanted to know. Even worse you often got half way through an upgrade when it broke, and it left the system in an almost unusable state - never again!

Earlier in the year I bought an SSD to replace my hard drive so I took the opportunity to switch to Arch, which is a bit like Gentoo (rolling release, very fast to upgrade to the latest releases) but everything is precompiled. It's amazing how fast it is when I'm so used to Gentoo. The package manager is called pacman, so installing Boost is as easy as 'sudo pacman -S boost'. Upgrading everything on your system is done with 'pacman -Syu' and I've yet to encounter a problem with it, so I'm really liking Arch. It's also pretty spartan like Slackware, apart from using pacman to add and remove programs I don't think I've had to do anything differently to Slackware. Oh, and if you have enough memory that you can turn off swap, an SSD makes no difference at all to the speed of Linux :-)

I did switch to Debian on my servers though, because I wanted something that was very well tested and stable, rather than the latest release. They're very quick with security updates but they do have a bit of custom stuff, mostly to make it easier for the package manager to add and remove configuration scripts from other programs. I probably wouldn't run Debian on my desktop PC as it's too slow to update, but it's great for servers, I've just about finished migrating all mine over to it now.

But if you like Slackware's philosophy, I can highly recommend Arch.
User avatar
yellowantphil
4-bit nibble
Posts: 24
Joined: October 10th, 2011, 12:00 am
Location: Oklahoma
Contact:

Re: Camoto compilation errors

Post by yellowantphil »

Latest compilation error: Missing editor-tileset-canvas.hpp in camoto-studio
Malvineous
8-bit mega nerd
Posts: 292
Joined: March 17th, 2007, 6:40 pm
Location: Brisbane, Australia
Contact:

Re: Camoto compilation errors

Post by Malvineous »

Gah, why do I always forget to add new files to the repo? Hopefully the latest push will fix that, thanks for letting me know!
User avatar
yellowantphil
4-bit nibble
Posts: 24
Joined: October 10th, 2011, 12:00 am
Location: Oklahoma
Contact:

Re: Camoto compilation errors

Post by yellowantphil »

No compilation problems with the latest version, except I’m still getting a lot of errors that look like this in the final make install for camoto-studio:

Code: Select all

/usr/bin/ginstall: will not overwrite just-created `/home/phil/camoto/install/share/camoto-studio/captain-comic.png' with `data/games/icons/captain-comic.png'
ginstall tries to put all of the files in camoto-studio/data in the same directory, instead of preserving the games and icons subdirectories.
Post Reply