Jump to content

Building latest revision is currently broken for Linux


Riesi
 Share

Recommended Posts

Hello!

I am regularly playing 0ad with a friend. We decided to always play the latest Windows autobuild. This means I have to compile that revision for Linux.
And lately a few build issues due to missing includes or --pendantic not being happy happened.
Attached is a patch to fix the current build issues. Hopefully someone can apply this fix upstream.

I tried to figure out how to contribute, but Phabricator doesn't send me the verification email for my account. Hopefully I can make an account when the transition away from SVN and Phabricator is complete.
I was reading in the git transition thread that Gitea and CI is coming together, so a commit breaking Linux compilation should be less likely after that.

Kind regards,
Riesi

linux_build_fixes.patch

Edited by Riesi
  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Riesi said:

Ok it was not -pendantic but just the compiler telling me that its related to -permissive.

Could you share your OS and compiler version?

On 24/11/2023 at 6:00 PM, Riesi said:

I was reading in the git transition thread that Gitea and CI is coming together, so a commit breaking Linux compilation should be less likely after that.

That shouldn't affect the compilation process, since it depends on a platform not CI infrastructure itself.

Link to comment
Share on other sites

Thank you for making the upstream patch!
I am fine with "Riesi" as the credit.

Could the "invalid conversion" errors be from a newer GCC version (13.2.1)?
As for "#include <libxml/parser.h>" I am not sure why I get the error about missing declarations and you seemingly don't.

It would be great if all errors would be fixed upstream, but I am ok carrying fixes locally for a while too. Until a better solution is found.

Thanks again!

Link to comment
Share on other sites

7 minutes ago, Riesi said:

Could the "invalid conversion" errors be from a newer GCC version (13.2.1)?

No, I also use GCC 13.2.1 from the arch repo ;)

I'll reinstall the complete git repo this weekend to see if that yields more errors. (Probably ./clean-workspace.sh didn't clean everything)

  • Like 1
Link to comment
Share on other sites

I presume this is the same issue I've been having? I could compile well on Linux for a long time, but suddenly the process no longer works! I thought it's an update in 0 A.D. Git, it may as well be something that changed in my Linux distro (I use Manjaro KDE). For me the error is:

make: *** [Makefile:271: output/debug/FCollada/FUtils/FUXmlDocument.o] Error 1
make: *** Waiting for unfinished jobs....
./build.sh: line 28: die: command not found
ERROR: FCollada build failed

 

Link to comment
Share on other sites

58 minutes ago, MirceaKitsune said:

I presume this is the same issue I've been having? I could compile well on Linux for a long time, but suddenly the process no longer works! I thought it's an update in 0 A.D. Git, it may as well be something that changed in my Linux distro (I use Manjaro KDE). For me the error is:

make: *** [Makefile:271: output/debug/FCollada/FUtils/FUXmlDocument.o] Error 1
make: *** Waiting for unfinished jobs....
./build.sh: line 28: die: command not found
ERROR: FCollada build failed

It seems different from the original post. Could you share a full log (with the Collada compilation error)?

Link to comment
Share on other sites

I also encounter new errors now:
 

../../../source/collada/XMLFix.cpp: In function ‘void FixBrokenXML(const char*, const char**, size_t*)’:
../../../source/collada/XMLFix.cpp:169:25: error: ‘xmlParseMemory’ was not declared in this scope
  169 |         xmlDocPtr doc = xmlParseMemory(text, (int)textSize);
      |                         ^~~~~~~~~~~~~~
make[1]: *** [Collada.make:162: obj/Collada_Release/XMLFix.o] Error 1
make[1]: *** Waiting for unfinished jobs....
../../../source/collada/CommonConvert.cpp: In constructor ‘FColladaErrorHandler::FColladaErrorHandler(std::string&)’:
../../../source/collada/CommonConvert.cpp:59:9: error: ‘xmlSetGenericErrorFunc’ was not declared in this scope
   59 |         xmlSetGenericErrorFunc(&xmlErrors, &errorHandler);
      |         ^~~~~~~~~~~~~~~~~~~~~~
../../../source/collada/CommonConvert.cpp: In destructor ‘FColladaErrorHandler::~FColladaErrorHandler()’:
../../../source/collada/CommonConvert.cpp:68:9: error: ‘xmlSetGenericErrorFunc’ was not declared in this scope
   68 |         xmlSetGenericErrorFunc(NULL, NULL);
      |         ^~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [Collada.make:138: obj/Collada_Release/CommonConvert.o] Error 1


Which can be fixed by:
 

diff --git a/source/collada/XMLFix.cpp b/source/collada/XMLFix.cpp
index 2f1d67770e..39b8b08855 100644
--- a/source/collada/XMLFix.cpp
+++ b/source/collada/XMLFix.cpp
@@ -23,6 +23,8 @@
 
 #include "FUtils/FUXmlParser.h"
 
+#include <libxml/parser.h>
+
 /*
 
 Things that are fixed here:
diff --git a/source/collada/CommonConvert.cpp b/source/collada/CommonConvert.cpp
index 391fcf47f6..2a57cea395 100644
--- a/source/collada/CommonConvert.cpp
+++ b/source/collada/CommonConvert.cpp
@@ -30,6 +30,7 @@
 
 #include <cassert>
 #include <algorithm>
+#include <libxml/xmlerror.h>
 
 void require_(int line, bool value, const char* type, const char* message)
 {

 

Link to comment
Share on other sites

On 03/12/2023 at 4:51 AM, vladislavbelov said:

It seems different from the original post. Could you share a full log (with the Collada compilation error)?

I think I reproduced their errors:

First error:
FCollada/FUtils/FUXmlDocument.cpp: In constructor ‘FUXmlDocument::FUXmlDocument(FUFileManager*, const fchar*, bool)’:
FCollada/FUtils/FUXmlDocument.cpp:39:39: error: ‘xmlParseMemory’ was not declared in this scope
   39 |                         xmlDocument = xmlParseMemory((const char*) fileData, (int)fileLength);
      |                                       ^~~~~~~~~~~~~~
FCollada/FUtils/FUXmlDocument.cpp: In constructor ‘FUXmlDocument::FUXmlDocument(const char*, size_t)’:
FCollada/FUtils/FUXmlDocument.cpp:67:23: error: ‘xmlParseMemory’ was not declared in this scope
   67 |         xmlDocument = xmlParseMemory(data, (int)length);
      |                       ^~~~~~~~~~~~~~
In file included from FCollada/FMath/FMath.h:44,
                 from FCollada/FUtils/FUtils.h:81:

                 
Second error:               
FColladaPlugins/FArchiveXML/FArchiveXML.cpp: In member function ‘virtual bool FArchiveXML::EndExport(fm::vector<unsigned char>&)’:
FColladaPlugins/FArchiveXML/FArchiveXML.cpp:515:34: error: ‘xmlAllocOutputBuffer’ was not declared in this scope; did you mean ‘xmlOutputBuffer’?
  515 |         xmlOutputBufferPtr buf = xmlAllocOutputBuffer(NULL);
      |                                  ^~~~~~~~~~~~~~~~~~~~
      |                                  xmlOutputBuffer
FColladaPlugins/FArchiveXML/FArchiveXML.cpp:519:24: error: ‘xmlOutputBufferGetSize’ was not declared in this scope; did you mean ‘xmlOutputBufferPtr’?
  519 |         outData.resize(xmlOutputBufferGetSize(buf) * sizeof(xmlChar));
      |                        ^~~~~~~~~~~~~~~~~~~~~~
      |                        xmlOutputBufferPtr
FColladaPlugins/FArchiveXML/FArchiveXML.cpp:520:33: error: ‘xmlOutputBufferGetContent’ was not declared in this scope; did you mean ‘xmlOutputBufferPtr’?
  520 |         memcpy(outData.begin(), xmlOutputBufferGetContent(buf), outData.size());
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                 xmlOutputBufferPtr
FColladaPlugins/FArchiveXML/FArchiveXML.cpp:526:9: error: ‘xmlOutputBufferClose’ was not declared in this scope; did you mean ‘xmlOutputBufferPtr’?
  526 |         xmlOutputBufferClose(buf);
      |         ^~~~~~~~~~~~~~~~~~~~
      |         xmlOutputBufferPtr
In file included from FCollada/FCDocument/FCDocument.h:27,
                 from FColladaPlugins/FArchiveXML/FArchiveXML.h:21:

Fixing the first error is simple:
 

diff --git a/libraries/source/fcollada/src/FCollada/FUtils/FUXmlDocument.cpp b/libraries/source/fcollada/src/FCollada/FUtils/FUXmlDocument.cpp
index 5349249a87..2acf93006e 100644
--- a/libraries/source/fcollada/src/FCollada/FUtils/FUXmlDocument.cpp
+++ b/libraries/source/fcollada/src/FCollada/FUtils/FUXmlDocument.cpp
@@ -13,6 +13,8 @@
 #include "FUFile.h"
 #include "FCDocument/FCDocument.h"
 
+#include <libxml/parser.h>
+
 #define MAX_FILE_SIZE 10240000
 //
 // FUXmlDocument

The second is hard because the file has mixed line endings with a few lines not being CRLF but instead LF and `patch` not being happy when applying.
Imho the file should be fixed to either pure CRLF or LF.
Following patch needs to be applied in binary mode to not break on a "different line endings" error:

diff --git a/libraries/source/fcollada/src/FColladaPlugins/FArchiveXML/FArchiveXML.cpp b/libraries/source/fcollada/src/FColladaPlugins/FArchiveXML/FArchiveXML.cpp
index af67478960..99b64b9925 100644
--- a/libraries/source/fcollada/src/FColladaPlugins/FArchiveXML/FArchiveXML.cpp
+++ b/libraries/source/fcollada/src/FColladaPlugins/FArchiveXML/FArchiveXML.cpp
@@ -77,7 +77,7 @@
 #include "FCDocument/FCDVersion.h"
 #include "FUtils/FUXmlDocument.h"
 
-
+#include <libxml/xmlIO.h>
 //
 // Constants
 //

 

Link to comment
Share on other sites

2 minutes ago, hyperion said:

What version of libxml2 are you using and is it an install from your package manager and with no local build in path?

I am using the one from my distro's (Arch) package manager, yes.

libxml2 2.12.1-1
Looking at the PKGBUILD file they base it on this commit:
git+https://gitlab.gnome.org/GNOME/libxml2.git#commit=f4ac9926a463ecb628f73049e4fd7ecced8fb7cf

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...