Skip to content

v8.15.3 Build failure with msvc #4088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
star-hengxing opened this issue Aug 17, 2024 · 1 comment · Fixed by #4153
Closed

v8.15.3 Build failure with msvc #4088

star-hengxing opened this issue Aug 17, 2024 · 1 comment · Fixed by #4153
Labels

Comments

@star-hengxing
Copy link

ci: xmake-io/xmake-repo#4927
Caused by #3935

"cl" "-Ilibvips\iofuncs\libiofuncs.a.p" "-Ilibvips\iofuncs" "-I..\libvips\iofuncs" "-I." "-I.." "-Ilibvips\include" "-I..\libvips\include" "-Ilibvips\include\vips" "-IC:/Users/star/AppData/Local/.xmake/packages/g/glib/2.78.1/46074858a18a4c65af5d5456d987b3c5/include/glib-2.0" "-IC:/Users/star/AppData/Local/.xmake/packages/g/glib/2.78.1/46074858a18a4c65af5d5456d987b3c5/lib/glib-2.0/include" "-IC:/Users/star/AppData/Local/.xmake/packages/p/pcre2/10.43/7105e9759c7e4bd3b28474ea907f2e1e/include" "-IC:/Users/star/AppData/Local/.xmake/packages/g/glib/2.78.1/46074858a18a4c65af5d5456d987b3c5/include" "-IC:/Users/star/AppData/Local/.xmake/packages/l/libffi/3.4.6/c29475504f8442b9be8f9ba0332d5d5f/include" "-IC:/Users/star/AppData/Local/.xmake/packages/e/expat/2.6.2/09b66d0aa6a949a3be60e26e28921679/include" "-DNDEBUG" "/MT" "/nologo" "/showIncludes" "/utf-8" "/W2" "/O2" "/Gw" "-DG_DISABLE_CAST_CHECKS" "-DG_DISABLE_CHECKS" "-DG_DISABLE_ASSERT" "-external:W0" "-external:IC:\Users\star\AppData\Local\.xmake\packages\l\libintl\0.22.3\7f4fb3cf1ea5440489383050e3dfece5\include" "-DHAVE_CONFIG_H=1" "-DXML_STATIC" "/Fdlibvips\iofuncs\libiofuncs.a.p\generate.c.pdb" /Folibvips/iofuncs/libiofuncs.a.p/generate.c.obj "/c" ../libvips/iofuncs/generate.c
../libvips/iofuncs/generate.c(641): error C2065: 'ssize_t': undeclared identifier
../libvips/iofuncs/generate.c(641): error C2146: syntax error: missing ';' before identifier 'nwritten'
../libvips/iofuncs/generate.c(641): error C2065: 'nwritten': undeclared identifier
../libvips/iofuncs/generate.c(646): error C2065: 'nwritten': undeclared identifier
../libvips/iofuncs/generate.c(649): error C2065: 'nwritten': undeclared identifier
../libvips/iofuncs/generate.c(650): error C2065: 'nwritten': undeclared identifier

"cl" "-Ilibvips\iofuncs\libiofuncs.a.p" "-Ilibvips\iofuncs" "-I..\libvips\iofuncs" "-I." "-I.." "-Ilibvips\include" "-I..\libvips\include" "-Ilibvips\include\vips" "-IC:/Users/star/AppData/Local/.xmake/packages/g/glib/2.78.1/46074858a18a4c65af5d5456d987b3c5/include/glib-2.0" "-IC:/Users/star/AppData/Local/.xmake/packages/g/glib/2.78.1/46074858a18a4c65af5d5456d987b3c5/lib/glib-2.0/include" "-IC:/Users/star/AppData/Local/.xmake/packages/p/pcre2/10.43/7105e9759c7e4bd3b28474ea907f2e1e/include" "-IC:/Users/star/AppData/Local/.xmake/packages/g/glib/2.78.1/46074858a18a4c65af5d5456d987b3c5/include" "-IC:/Users/star/AppData/Local/.xmake/packages/l/libffi/3.4.6/c29475504f8442b9be8f9ba0332d5d5f/include" "-IC:/Users/star/AppData/Local/.xmake/packages/e/expat/2.6.2/09b66d0aa6a949a3be60e26e28921679/include" "-DNDEBUG" "/MT" "/nologo" "/showIncludes" "/utf-8" "/W2" "/O2" "/Gw" "-DG_DISABLE_CAST_CHECKS" "-DG_DISABLE_CHECKS" "-DG_DISABLE_ASSERT" "-external:W0" "-external:IC:\Users\star\AppData\Local\.xmake\packages\l\libintl\0.22.3\7f4fb3cf1ea5440489383050e3dfece5\include" "-DHAVE_CONFIG_H=1" "-DXML_STATIC" "/Fdlibvips\iofuncs\libiofuncs.a.p\util.c.pdb" /Folibvips/iofuncs/libiofuncs.a.p/util.c.obj "/c" ../libvips/iofuncs/util.c
../libvips/iofuncs/util.c(544): error C2065: 'ssize_t': undeclared identifier
../libvips/iofuncs/util.c(544): error C2146: syntax error: missing ';' before identifier 'nwritten'
../libvips/iofuncs/util.c(544): error C2065: 'nwritten': undeclared identifier
../libvips/iofuncs/util.c(549): error C2065: 'nwritten': undeclared identifier
../libvips/iofuncs/util.c(554): error C2065: 'nwritten': undeclared identifier
../libvips/iofuncs/util.c(555): error C2065: 'nwritten': undeclared identifier

Wrokaround

diff --git a/libvips/iofuncs/generate.c b/libvips/iofuncs/generate.c
index bb3d1b2d7..8be7ad675 100644
--- a/libvips/iofuncs/generate.c
+++ b/libvips/iofuncs/generate.c
@@ -92,6 +92,11 @@
 #endif /*HAVE_CONFIG_H*/
 #include <glib/gi18n-lib.h>
 
+#if defined(_MSC_VER)
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
diff --git a/libvips/iofuncs/util.c b/libvips/iofuncs/util.c
index 047516084..c2049c107 100644
--- a/libvips/iofuncs/util.c
+++ b/libvips/iofuncs/util.c
@@ -37,6 +37,11 @@
 #endif /*HAVE_CONFIG_H*/
 #include <glib/gi18n-lib.h>
 
+#if defined(_MSC_VER)
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@kleisauke
Copy link
Member

Thanks for reporting this. Swapping ssize_t with gint64 might be a more reliable solution since some versions of Windows headers define ssize_t as unsigned(!). This change would align with the approach we took in commit 0429a00.

Note to self: The usage of ssize_t in archive.c does not need to be updated, as that's handled in libarchive's header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants