Modding, Mission Design, and Coding > FS2 Open Tools

Possible to compile on Linux?

(1/5) > >>

Talon 1024:
Is it possible to compile PCS2 on Linux? I'm running Ubuntu 9.10, and I think I have all of the required libraries for PCS2 installed.  Whenever I try to compile PCS2 using SConstruct, it gives me this error message:

--- Code: ---redacted@redacted-desktop:~/Downloads/PCS2$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o BSPDataStructs.o -c -g -Wno-deprecated -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ BSPDataStructs.cpp
BSPDataStructs.cpp: In member function 'vector3d BSP_FlatPoly::MyCenter(std::vector<vector3d, std::allocator<vector3d> >)':
BSPDataStructs.cpp:273: error: invalid initialization of non-const reference of type 'vector3d&' from a temporary of type 'vector3d'
vector3d.h:153: error: in passing argument 1 of 'vector3d CrossProduct(vector3d&, vector3d&)'
BSPDataStructs.cpp: In member function 'vector3d BSP_TmapPoly::MyCenter(std::vector<vector3d, std::allocator<vector3d> >)':
BSPDataStructs.cpp:442: error: invalid initialization of non-const reference of type 'vector3d&' from a temporary of type 'vector3d'
vector3d.h:153: error: in passing argument 1 of 'vector3d CrossProduct(vector3d&, vector3d&)'
scons: *** [BSPDataStructs.o] Error 1
scons: building terminated because of errors.
--- End code ---

Iss Mneur:
Supposedly. Unfortunately, it doesn't look like anyone has actually done it in quite a while at least with GCC 4.4.

Anyway, this is as far as I got tonight, I will take a another stab at it tomorrow after I figure out what exactly dae.h is for and where to find it. I will poke The_E and see if he has any insight (as he has apparently got it to build on windows at least).

The following patch fixes your two errors, plus another two that are about a different function committing the same badness.

--- Code: ---diff --git a/model_editor_ctrl.h b/model_editor_ctrl.h
--- a/model_editor_ctrl.h
+++ b/model_editor_ctrl.h
@@ -1,6 +1,6 @@

 #pragma once
-#include <wx\wx.h>
+#include <wx/wx.h>
 #include "pcs_file.h"
 #include "primitive_ctrl.h"
 #include "omnipoints.h"
diff --git a/vector3d.cpp b/vector3d.cpp
--- a/vector3d.cpp
+++ b/vector3d.cpp
@@ -102,14 +102,14 @@ vector3d average_vectors_if_less_than_angle(int numvectors, float angle, vector3

-float Magnitude(vector3d &vec)
+float Magnitude(vector3d const &vec)
        return (float)sqrt(vec.x*vec.x + vec.y*vec.y + vec.z*vec.z);


-vector3d CrossProduct(vector3d &one, vector3d &two)
+vector3d CrossProduct(vector3d const &one, vector3d const &two)
   return MakeVector(float(double(one.y)*double(two.z)-double(two.y)*double(one.z)),
@@ -151,7 +151,7 @@ vector3d FigureNormal(vector3d &one, vector3d &two, vector3d &three)

-float VectorMagnitude(vector3d &v)
+float VectorMagnitude(vector3d const &v)
        return Magnitude(v);
diff --git a/vector3d.h b/vector3d.h
--- a/vector3d.h
+++ b/vector3d.h
@@ -118,7 +118,7 @@ inline bool no_nan(vector3d&vec){
        return no_nan(vec.x) && no_nan(vec.y) && no_nan(vec.z);

-float VectorMagnitude(vector3d &v);
+float VectorMagnitude(vector3d const &v);

 std::ostream & operator << ( std::ostream & os, vector3d &vec);
 std::istream & operator >> ( std::istream & in, vector3d &vec);
@@ -150,9 +150,9 @@ float Abs(float n);
 vector3d AverageVectors(int numvectors, vector3d *vects);
 float Angle(vector3d &v1, vector3d &v2);

-vector3d CrossProduct(vector3d &one, vector3d &two);
+vector3d CrossProduct(vector3d const &one, vector3d const &two);
 float dot(vector3d&A, vector3d&B);
-float Magnitude(vector3d &vec);
+float Magnitude(vector3d const &vec);
 inline bool null_vec(vector3d &a){return a.x == 0.0f && a.y == 0.0f && a.z == 0.0f;}

 vector3d average_vectors_if_less_than_angle(int numvectors, float angle, vector3d src, vector3d *vects);

--- End code ---

The E:
Okay, PCS2's dependencies on Windows are as follows:
1. wxwidgets
2. The colladadom package found here. I am not sure if that is part of any distro's package manager.
3. The devIL library
4. SDL
5. The "boost" collection (although I am almost certain that the things we're using from boost can be found in the colladaDOM pack above).

Those are the easy fixes. The fun part is templated inheritance and the things gcc expects that VS doesn't. And of course the lovely

--- Code: ---error: overloaded function with no contextual type information

--- End code ---

Edit: I've pushed my changes so feel free to try it out for some more exciting errors.

yeah linux compatibility hasn't been worked on in a while, and i'm still being slow getting geared up for full development again because i'm helping my wife get to level 80 in WoW on our new server.


[0] Message Index

[#] Next page

Go to full version