Skip to content

Commit

Permalink
Enable building with GCC 14 (#15)
Browse files Browse the repository at this point in the history
When I tried to build the package with GCC 14, I got the following
error:

    src/ThirdParty/Minizip/minizip/miniunz.c:141:11: error:
    implicit declaration of function ‘mkdir’; did you mean ‘mymkdir’?
    [-Wimplicit-function-declaration]

It turns out that GCC now conforms more strictly to the C standard, and
some issues that were previously only warned about are now treated as
errors.  `implicit-function-declaration` is one of these.  For more
info, see:
https://gcc.gnu.org/gcc-14/porting_to.html#implicit-function-declaration

The solution is to patch the Minizip code so that the appropriate header
for `mkdir()`, which is `<sys/stat.h>`, gets included.
  • Loading branch information
kyllingstad authored Jun 11, 2024
1 parent 10ef51e commit 5aa200a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
12 changes: 12 additions & 0 deletions add-missing-minizip-include.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/ThirdParty/Minizip/minizip/miniunz.c b/ThirdParty/Minizip/minizip/miniunz.c
index 2264705..9d2130c 100644
--- a/ThirdParty/Minizip/minizip/miniunz.c
+++ b/ThirdParty/Minizip/minizip/miniunz.c
@@ -51,6 +51,7 @@
# include <direct.h>
# include <io.h>
#else
+# include <sys/stat.h>
# include <unistd.h>
# include <utime.h>
#endif
6 changes: 5 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ class FMILibraryConan(ConanFile):
tool_requires = "cmake/[>=3.15]"
generators = "CMakeDeps"

exports_sources = "build-static-c99snprintf.patch"
exports_sources = [
"add-missing-minizip-include.patch",
"build-static-c99snprintf.patch",
]

def source(self):
git = Git(self)
git.clone(url="https://github.com/modelon-community/fmi-library.git", target="src", args=["--branch=2.3"])
patch(self, base_path="src", patch_file="add-missing-minizip-include.patch")
patch(self, base_path="src", patch_file="build-static-c99snprintf.patch")

def layout(self):
Expand Down

0 comments on commit 5aa200a

Please sign in to comment.