|
From: | Paul Schneider |
Subject: | Re: [Openexr-devel] Trouble compiling with EXR files (much longer now) |
Date: | Wed, 5 Nov 2003 14:40:55 -0800 |
I think that Brian and I have worked out his issues off-list. I'm hoping to get a sample Xcode project released Real Soon Now, so that others can avoid some of this pain...
- Paul On Wednesday, November 5, 2003, at 02:23 PM, Scott Frankel wrote:
I don't know what the troubles you're encountering are caused by. I too am relatively new to this. A few weeks ago, though, I built the OpenEXR API then a sample image processing "tool" (in ProjectBuilder parlance) on OSX.From that experience, I wrote up some notes which I'll copy below.Note that Paul immediately offered some additional suggestions, which also follow. Also note that I used ProjectBuilder v2.1 with gcc v3.1 on OSX v10.2.6.Good luck! Scott# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -From: Scott Frankel <address@hidden> Date: Sun Oct 19, 2003 8:30:37 PM US/Pacific To: address@hidden Subject: [Openexr-devel] notes: OpenEXR-1.0.6 + OSX + ProjectBuilder These notes were taken from my experiences with OpenEXR on MacOSX, using Apple's ProjectBuilder IDE. I'm sure there are more elegant solutions to the various issues addressed below. Nontheless, these steps yielded a successful build of the example program. Happy exring - Scott Versions MacOSX v10.2.6 OpenEXR 1.0.6 ProjectBuilder v2.1 GCC v3.1 Build & Install OpenEXR libraries and header files - as root: % ./configure --enable-osx-istream-hack --enable-shared=no % make % make install - API header hacks: disable win32 compatibility Comment-out the win32 compatibility term, "restrict," from ImathMatrix.h; i.e.: [near line 2356] #if defined (PLATFORM_WIN32) #define restrict #endif /* register const T * restrict ap = &a.x[0][0]; register const T * restrict bp = &b.x[0][0]; register T * restrict cp = &c.x[0][0]; */ register const T * ap = &a.x[0][0]; register const T * bp = &b.x[0][0]; register T * cp = &c.x[0][0]; register T a0, a1, a2, a3; - example program header hacks: explicit casts to float <no matching function for call to 'max(float, double)'> Explicitly cast 2nd arg to float in drawImage.cpp: [line 92] void sp (Array2D<Rgba> &px, int w, int h, float xc, float yc, float rc, float rd, float gn, float bl, float lm) { int x1 = int (max (floor (xc - rc), float (0.0) )); int x2 = int (min (ceil (xc + rc), float (w - 1.0) )); int y1 = int (max (floor (yc - rc), float (0.0) )); int y2 = int (min (ceil (yc + rc), float (h - 1.0) )); [and line 138] void zsp (Array2D<half> &gpx, Array2D<float> &zpx, int w, int h, float xc, float yc, float zc, float rc, float gn) { int x1 = int (max (floor (xc - rc), float (0.0) )); int x2 = int (min (ceil (xc + rc), float (w - 1.0) )); int y1 = int (max (floor (yc - rc), float (0.0) )); int y2 = int (min (ceil (yc + rc), float (h - 1.0) )); For ProjectBuilder - In a shell window, make a symbolic link to /usr/ in the project's working directory. The MacOSX file Open|Save browser can't findBSD-specific directories. The symlink lets you navigate to /usr/lib and /usr/local/OpenEXR from the cwd to import headers and lib files.% ln -s /usr/ yoozer- To prevent ImathMath.h float variable errors, this string must be added to the Target's GCC Compiler Settings tab's "Other C Compiler Flags"field. Note that the "-" is significant. -DPLATFORM_DARWIN_PPC - prevent undefined symbol errors, "_compress" & "_uncompress" Add /usr/lib/libz.dylib to the project's External Frameworks and Libraries group. - prevent undefined symbol errorsSet the link order of the library files so that libz is linked beforeliblex. _______________________________________________ Openexr-devel mailing list address@hidden http://mail.nongnu.org/mailman/listinfo/openexr-devel From: Paul Schneider <address@hidden> Date: Mon Oct 20, 2003 10:25:10 AM US/Pacific To: Scott Frankel <address@hidden> Cc: address@hiddenSubject: Re: [Openexr-devel] notes: OpenEXR-1.0.6 + OSX + ProjectBuilder- API header hacks: disable win32 compatibility Comment-out the win32 compatibility term, "restrict," from ImathMatrix.h; i.e.: [near line 2356]You could also do what the OS X Makefile does, and add -Drestrict= to your compiler settings. I don't actually know what the "restrict" keyword does, but I think it's not a Win32 thing, since it's also #ifdef'd out on that platform.- example program header hacks: explicit casts to float <no matching function for call to 'max(float, double)'> Explicitly cast 2nd arg to float in drawImage.cpp: [line 92]I don't think you need to do this if you have PLATFORM_DARWIN_PPC defined, since that will find the copies of floor in the Imath namespace that return doubles. You can verify this by building IlmImfExamples from the command line - no source modification necessary.For ProjectBuilder- In a shell window, make a symbolic link to /usr/ in the project'sworking directory. The MacOSX file Open|Save browser can't findBSD-specific directories. The symlink lets you navigate to /usr/lib and /usr/local/OpenEXR from the cwd to import headers and lib files.% ln -s /usr/ yoozerYou can get there in the Open/Save dialog if you type the path in the "location" field - i.e. type "/usr/lib" in the "Go To:" edit field. Note that this feature might not be there in future versions of the OS, though, but such a hypothetical OS will probably let you see invisible directories such as /usr in the file dialog.- To prevent ImathMath.h float variable errors, this string must be added to the Target's GCC Compiler Settings tab's "Other C Compiler Flags"field. Note that the "-" is significant. -DPLATFORM_DARWIN_PPCChange this to -DPLATFORM_DARWIN_PPC -Drestrict= as mentioned above, and a lot of problems go away. It's best to follow the Makefile's example in situations like this.Good work, Scott! Thanks for braving these uncharted waters. I'll try to improve the Xcode support for OpenEXR in the coming weeks.- Paul On Wednesday, November 5, 2003, at 12:00 PM, Paul Schneider wrote:Hey, Brian,I'm not sure what else to suggest. Could you post your code somewhere? From your error, it sounds like the compiler doesn't know what an ImageClass is, but you say the code compiles without including OpenEXR headers?I'm building an EXR app with Xcode right now, and the library does work in that environment, so I'm pretty sure the problem lies either with your code or your setup.- Paul On Wednesday, November 5, 2003, at 11:46 AM, Brian Clark wrote:Paul,Thanks for the suggestions. Unfortunately, I'm still getting 54 errors,which is what I was getting before. They seem to be the same. I included /usr/local/include/OpenEXR in the header search path, I included /usr/local/lib in the Library search paths, and I set Preprocessor macros to PLATFORM_DARWIN_PPC restrict=I also tried removing /usr/local/lib from the Preferences->source treesoption (which I had previously set in an effort to get it to work).I was looking through the archives, and there was a post about gettingthings to compile under ProjectBuilder and 10.2, but there was a postlater about how 10.3, gcc 3.3 solved all those problems, and I'm on 10.3,gcc3.3, so I haven't started messing with the source code of the libraries.I tried setting the fields and restarting Xcode... no change. Any othersuggestions? Thanks, bc On Wed, 5 Nov 2003, Paul Schneider wrote:The tricks for working with OpenEXR in Xcode are: 1) select your target in the browser and hit "Get Info" (cmd-I) 2) choose the "build" tab 3) add the location of the EXR headers to the "Header search paths"field. Unless you specified otherwise when you ran configure, this is"/usr/local/include/OpenEXR" without the quotes. 4) add "PLATFORM_DARWIN_PPC restrict=" without the quotes to the "Preprocessor macros" field.5) add the location of the EXR libraries to the "Library search paths" field. Unless you specified otherwise when you ran configure, this is"/usr/local/lib" without the quotes. The thing you're missing is probably the macros. In particular, ifPLATFORM_DARWIN_PPC isn't defined, the EXR headers will greatly confusethe compiler. Of course, the only way you'd know that is if you dug through eitherthe OpenEXR Makefiles or the archives of this mailing list, which isn'tvery user-friendly. I'm planning to put this arcane knowledge in aREADME for the next OpenEXR release, and I'm working on a sample Xcodeproject that folks will be able to use as a starting point. Good luck! Paul On Tuesday, November 4, 2003, at 10:44 PM, Brian Clark wrote:Hello.I am trying to get the OpenEXR format working with some existing code,but I get strange errors when I try to include the EXR headers.I took my old code, written on linux, and brought it over to the Mac (where I plan to do my programming from now on), compiled and ran itwithXcode, gcc 3.3. No problems. I wrote an alternate function to writeoutas EXR if that option was selected. Nothing fancy, just the basic RGBAimage file, code essentially lifted from the documentation/website.I included the OpenEXR lib files in my project by including the path/usr/local/lib in the Xcode Preferences->Source Trees. In the header file that includes the EXR writing function, I wrote #include <OpenEXR/half.h>. When I compile, I get a slew of errors (I believe most of them are causedbecause the compiler is confused by the first one--at least that's theway it's been in my very limited experience), the first of which is: field `img' has incomplete type The line in question refers to my declaration of the variable img, which is of type ImageClass, a class that I #include at the beginning of this .h file (Texture.h). In fact, here it is, in context: public: ImageClass img; int decalMode, imgType, edgeMode, format; double Sx,Sy,u,v,theta,scale,shiftX,shiftY; etc...There are no direct references to anything EXR in this Texture.h file,where the error occurs according to the compiler.The most direct reference is the declaration of my img variable, which is of class ImageClass, which is the class which uses EXR files and hasthe #include.I thought it might be a naming conflict with Half.h, so I changed imgtotexImg, with no change. ImageClass used to be Image, and changing itto ImageClass didn't resolve the conflict.I'm left thinking that either I don't have it set up right in Xcode,which is quite possible, because I've never used it before, or I'm not including the EXR files right, which is also quite possible, since I've never usedan exterior library set before that wasn't set up by a sysadmin. Do Ineed to #include something other than OpenEXR/half.h? I can't make sense out of the error message, either. Calling the class a"field" seems odd to me, and saying that it's incomplete I also findodd, since the class was working before--I only added a function and the #includes to it.One thing that's worth noting: I can comment out all references to EXRfiles, and it compiles fine. If I inlcude ONLY the #include <OpenEXR/half.h> line (and nothing that uses it), I get the errors. I'm leaning toward thinking that I am not including the right .h files. Or is it something more complicated? Anybody got any ideas? Thanks for your time! Brian PS. Here's an incomplete list of some errors that get spewed... Texture.h:37: error: field `img' has incomplete typeTexture.h:28: error: `const int half::EXR' is not a static member of`class half'Texture.h:27: error: `const int half::PPM' is not a static member of`class half' Light.h:20: confused by earlier errors, bailing out half.h:541: error: syntax error before `.' token half.h:540: error: `half half::h' is not a static member of `class half' half.h:533: error: syntax error before `<<=' token half.h:532: error: syntax error before `>>=' token half.h:519: error: syntax error before `<<=' token half.h:518: error: syntax error before `+=' token half.h:517: error: syntax error before `>>=' token half.h:508: error: invalid use of member `half::_h'half.h:508: error: `short unsigned int half::e' is not a static memberof `class half' half.h:507: error: invalid use of member `half::_h'half.h:507: error: `short unsigned int half::s' is not a static memberof `class half' half.h:493: error: syntax error before `const' half.h:493: macro "round" requires 2 arguments, but only 1 given half.h:143: error: field `round' has incomplete type [ ][ Brian Clark ][ ][ address@hidden ][ ] _______________________________________________ Openexr-devel mailing list address@hidden http://mail.nongnu.org/mailman/listinfo/openexr-devel[ ][ Brian Clark ][ ][ address@hidden ][ ]_______________________________________________ Openexr-devel mailing list address@hidden http://mail.nongnu.org/mailman/listinfo/openexr-devel
[Prev in Thread] | Current Thread | [Next in Thread] |