yangqiaosheng / libcitygml

Automatically exported from code.google.com/p/libcitygml
GNU Lesser General Public License v2.1
0 stars 0 forks source link

Make errors on OSX due to tesselator.h #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. download the svn snapshot
2. do: cmake CMakeLists.txt
3. do make

What is the expected output? What do you see instead?
The expected output would be that of a successfull make. I got the following:
macbook-pro-de-florent-buisson-3:libcitygml Flo$ sudo make
[ 14%] Building CXX object src/CMakeFiles/citygml.dir/citymodel.o
In file included from /Users/Flo/Dev/libcitygml/src/citymodel.cpp:20:
/Users/Flo/Dev/libcitygml/src/tesselator.h:25:34: error: 
/usr/X11/include/glu.h: No such file or directory
In file included from /Users/Flo/Dev/libcitygml/src/citymodel.cpp:20:
/Users/Flo/Dev/libcitygml/src/tesselator.h:37: error: ‘GLenum’ has not been 
declared
/Users/Flo/Dev/libcitygml/src/tesselator.h:53: error: expected `)' before 
‘*’ token
/Users/Flo/Dev/libcitygml/src/tesselator.h:54: error: ‘GLenum’ has not been 
declared
/Users/Flo/Dev/libcitygml/src/tesselator.h:55: error: ‘GLvoid’ has not been 
declared
/Users/Flo/Dev/libcitygml/src/tesselator.h:56: error: ‘GLdouble’ has not 
been declared
/Users/Flo/Dev/libcitygml/src/tesselator.h:56: error: ‘GLfloat’ has not 
been declared
/Users/Flo/Dev/libcitygml/src/tesselator.h:58: error: ‘GLenum’ has not been 
declared
/Users/Flo/Dev/libcitygml/src/tesselator.h:62: error: ISO C++ forbids 
declaration of ‘GLUtesselator’ with no type
/Users/Flo/Dev/libcitygml/src/tesselator.h:62: error: expected ‘;’ before 
‘*’ token
/Users/Flo/Dev/libcitygml/src/tesselator.h:63: error: ‘GLenum’ does not 
name a type
/Users/Flo/Dev/libcitygml/src/tesselator.h:37: error: 
‘GLU_TESS_WINDING_ODD’ was not declared in this scope
make[2]: *** [src/CMakeFiles/citygml.dir/citymodel.o] Error 1
make[1]: *** [src/CMakeFiles/citygml.dir/all] Error 2
make: *** [all] Error 2

What version of the product are you using? On what operating system?
The OS is: 
Snow Leopard  10.6.4

Please provide any additional information below.
The include errors disappear when I change #include "GL/glu.h" to #include 
"OpenGL/glu.h", I suggest adding something like:
#ifdef APPLE
   #include <OpenGL/glu.h>
#else
   #include <GL/glu.h>
#endif

I am still stuck with this error, not knowing what to change:
/Users/Flo/Dev/libcitygml/src/tesselator.h:53: error: expected `)' before 
‘*’ token
on this line:
typedef void (APIENTRY *GLU_TESS_CALLBACK)();

Original issue reported on code.google.com by Florent....@gmail.com on 21 Oct 2010 at 4:47

GoogleCodeExporter commented 9 years ago
I should have tested it before, but the correction should be:
#ifdef __APPLE__
   #include <OpenGL/glu.h>
#else
   #include <GL/glu.h>
#endif

Original comment by Florent....@gmail.com on 21 Oct 2010 at 4:55

GoogleCodeExporter commented 9 years ago
Thanks a lot for your report Florent.
Glad we have an apple tester here :)

I will commit your changes tomorrow and fix the GLU_TESS_CALLBACK. Stay tuned!

Cheers,
Joachim

Original comment by jpouder...@gmail.com on 21 Oct 2010 at 8:24

GoogleCodeExporter commented 9 years ago
Hello again!
Well I've been working on this compilation this morning, and succeeded by doing 
the following:
#ifdef __APPLE__
   #include <OpenGL/glu.h>
   #define APIENTRY // Whithout this string declaration APIENTRY is unknown on OSX
#else
   #include <GL/glu.h>
#endif

Then I get another error due to gcc 4.2.1 :

macbook-pro-de-florent-buisson-3:libcitygml Flo$ sudo make
[ 14%] Building CXX object src/CMakeFiles/citygml.dir/citymodel.o
[ 28%] Building CXX object src/CMakeFiles/citygml.dir/tesselator.o
/Users/Flo/Dev/libcitygml/src/tesselator.cpp: In static member function 
‘static void Tesselator::vertexCallback(GLvoid*, void*)’:
/Users/Flo/Dev/libcitygml/src/tesselator.cpp:86: error: cast from ‘GLvoid*’ 
to ‘int’ loses precision
make[2]: *** [src/CMakeFiles/citygml.dir/tesselator.o] Error 1
make[1]: *** [src/CMakeFiles/citygml.dir/all] Error 2
make: *** [all] Error 2

I solved this by changing the (int) cast to an (intptr_t) castand thus include :
#include <stdint.h>
to do so. I got this solution from link below:
http://stackoverflow.com/questions/1640423/error-cast-from-void-to-int-loses-pre
cision

I am now going to check if everything works well.

Do you think any of this could be harmful?
Thanks for your quick support!

Original comment by Florent....@gmail.com on 22 Oct 2010 at 8:51

GoogleCodeExporter commented 9 years ago
Thanks a lot, I have commited your changes on the SVN tree. Please check it's 
all ok and report so I can close the issue report.

Joachim

Original comment by jpouder...@gmail.com on 22 Oct 2010 at 9:11

GoogleCodeExporter commented 9 years ago
I have just checked your changes and they seem OK to me.
( Is stdint.h inclusion really needed? I didn't test without on OSX but your 
version seem to pretend the inclusion is not needed on WIN32)
My version of citygmltest works fine but for now I don't get how to use the osg 
plugin and if it has been installed. I will tell you when it works.

Original comment by Florent....@gmail.com on 22 Oct 2010 at 9:41

GoogleCodeExporter commented 9 years ago
Hello again, I'm now back from holidays...

I wondered whether the ReaderWriterCitygml is supposed to be installed with the 
rest of the library: i didn't found any proof of its installation as an OSG 
plugin.

If it is indeed supposed to be installed, where can I find it? Is there still a 
problem with ModuleInstall.cmake where an OSX error is referenced?
If it is not, how can I install it? 

By the way I looked for the implementation of the citygml:load() function 
without success. Do you have some implementation example of it? 

Is there any documentation I didn't found? For a novice like me discovering the 
project it would be helpful!

Thanks!

Original comment by Florent....@gmail.com on 3 Nov 2010 at 3:07

GoogleCodeExporter commented 9 years ago
Hello Florent,

You can find an example of libcitygml in the repository: there is a 'test' 
folder
(see http://code.google.com/p/libcitygml/source/browse/#svn/trunk/test )
So you can see how use the library.

As for the OpenSceneGraph plugin, there is a problem with the CMakeList.txt
We will fix this soon.

Regards,
Manuel

Original comment by garnier....@gmail.com on 8 Nov 2010 at 7:59

GoogleCodeExporter commented 9 years ago
Hello,
I have the same point as Florent but I am now facing the following issue: 
SETUP_PLUGIN is not defined for my version cmake (also working on OS X). This 
directive is however used in osgPlugins dirs. Does that mean that the elements 
in the test folder should be compiled in the OSG plugin directory?
do you have a working makefile (for linux for instance) available ?

best regards,

Guillaume

Original comment by moreau...@gmail.com on 10 Nov 2010 at 4:31

GoogleCodeExporter commented 9 years ago
Hi all!

You can checkout trunk. I've added a README in libcitygml/test/osgplugin, which 
explains how install the ReaderWriterCityGML in OpenSceneGraph.

I've made a few corrections in CMakeLists.txt, FindCityGML.cmake and 
FindXerces.cmake
You should now be able to use libcitygml inside Open Scene Graph.

Have fun :)

Regards,
Manuel

Original comment by garnier....@gmail.com on 16 Nov 2010 at 3:03

GoogleCodeExporter commented 9 years ago
Hi!

We arrived to similar conclusions but it is indeed a lot easier now!

Thus to manage good compilation we had to remove i386 from OSG's CMakeLists.txt 
in order not to have a compatibility issue when installing libcitygml.

Thanks!

Original comment by Florent....@gmail.com on 19 Nov 2010 at 9:08