How to Build Wine 5.0.x on Debian 12 bookworm

Questions about Wine on Linux
Locked
traderx
Newbie
Newbie
Posts: 1
Joined: Sun Jan 21, 2024 11:50 pm

How to Build Wine 5.0.x on Debian 12 bookworm

Post by traderx »

I had a hard time building Wine 5.0.x from sources on Debian 12. As I had several applications that work beautifully in Wine 5.0.x (stable), I went through the challenge of figuring out the various build issues.

Most of the errors are due to (1) a missing sincosf function that needs to be provided, and (2) a conflict of the name of ldap_connect.

I didn't know how to make automated changes to the source, but I found some resources online and then used the patch files to manually make my edits. After making the edits, the instructions on Building Wine https://wiki.winehq.org/Building_Wine worked well for me.

The edits that are needed to get the source to compile are shown below.

---- **** ROUGH PATCH FILE EQUIVALENT **** ----

diff --git a/dlls/msvcr100/Makefile.in b/dlls/msvcr100/Makefile.in
index c5a7710ea41..edf4b4d4407 100644
--- a/dlls/msvcr100/Makefile.in
+++ b/dlls/msvcr100/Makefile.in
@@ -34,6 +34,7 @@ C_SRCS = \
process.c \
scanf.c \
scheduler.c \
+ sincos.c \
string.c \
thread.c \
time.c \
diff --git a/dlls/msvcr110/Makefile.in b/dlls/msvcr110/Makefile.in
index d2ba0ac29e3..c3ee2ca7e8e 100644
--- a/dlls/msvcr110/Makefile.in
+++ b/dlls/msvcr110/Makefile.in
@@ -34,6 +34,7 @@ C_SRCS = \
process.c \
scanf.c \
scheduler.c \
+ sincos.c \
string.c \
thread.c \
time.c \
diff --git a/dlls/msvcr120/Makefile.in b/dlls/msvcr120/Makefile.in
index 68a85c581d1..953e9760ca0 100644
--- a/dlls/msvcr120/Makefile.in
+++ b/dlls/msvcr120/Makefile.in
@@ -34,6 +34,7 @@ C_SRCS = \
process.c \
scanf.c \
scheduler.c \
+ sincos.c \
string.c \
thread.c \
time.c \
diff --git a/dlls/msvcr70/Makefile.in b/dlls/msvcr70/Makefile.in
index e6dd41b32a5..4c443ecd7f6 100644
--- a/dlls/msvcr70/Makefile.in
+++ b/dlls/msvcr70/Makefile.in
@@ -33,6 +33,7 @@ C_SRCS = \
onexit.c \
process.c \
scanf.c \
+ sincos.c \
string.c \
thread.c \
time.c \
diff --git a/dlls/msvcr71/Makefile.in b/dlls/msvcr71/Makefile.in
index 7795ce1ae24..6f51a326c6b 100644
--- a/dlls/msvcr71/Makefile.in
+++ b/dlls/msvcr71/Makefile.in
@@ -33,6 +33,7 @@ C_SRCS = \
onexit.c \
process.c \
scanf.c \
+ sincos.c \
string.c \
thread.c \
time.c \
diff --git a/dlls/msvcr80/Makefile.in b/dlls/msvcr80/Makefile.in
index 7d11f65b3a3..3e2da553562 100644
--- a/dlls/msvcr80/Makefile.in
+++ b/dlls/msvcr80/Makefile.in
@@ -33,6 +33,7 @@ C_SRCS = \
onexit.c \
process.c \
scanf.c \
+ sincos.c \
string.c \
thread.c \
time.c \
diff --git a/dlls/msvcr90/Makefile.in b/dlls/msvcr90/Makefile.in
index 9cb511bbe06..4a49fcfd254 100644
--- a/dlls/msvcr90/Makefile.in
+++ b/dlls/msvcr90/Makefile.in
@@ -33,6 +33,7 @@ C_SRCS = \
onexit.c \
process.c \
scanf.c \
+ sincos.c \
string.c \
thread.c \
time.c \
diff --git a/dlls/msvcrt/Makefile.in b/dlls/msvcrt/Makefile.in
index 486e6f5491b..16405262fca 100644
--- a/dlls/msvcrt/Makefile.in
+++ b/dlls/msvcrt/Makefile.in
@@ -38,6 +38,7 @@ C_SRCS = \
process.c \
scanf.c \
scheduler.c \
+ sincos.c \
string.c \
thread.c \
time.c \
diff --git a/dlls/msvcrt/sincos.c b/dlls/msvcrt/sincos.c
new file mode 100644
index 00000000000..1a34c50f034
--- /dev/null
+++ b/dlls/msvcrt/sincos.c
@@ -0,0 +1,40 @@
+/*
+ * sincos implementation
+ *
+ * Copyright 2021 Jacek Caban for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#if 0
+#pragma makedep implib
+#endif
+
+#include <math.h>
+
+/* GCC may optimize a pair of sin(), cos() calls to a single sincos() call,
+ * which is not exported by any msvcrt version. */
+
+void sincos(double x, double *s, double *c)
+{
+ *s = sin(x);
+ *c = cos(x);
+}
+
+void sincosf(float x, float *s, float *c)
+{
+ *s = sinf(x);
+ *c = cosf(x);
+}
diff --git a/dlls/ucrtbase/Makefile.in b/dlls/ucrtbase/Makefile.in
index a576cf0250b..2910016f29f 100644
--- a/dlls/ucrtbase/Makefile.in
+++ b/dlls/ucrtbase/Makefile.in
@@ -37,6 +37,7 @@ C_SRCS = \
printf.c \
process.c \
scanf.c \
+ sincos.c \
string.c \
thread.c \
time.c \

diff --git a/dlls/wldap32/init.c b/dlls/wldap32/init.c
index afaef3b52f2..d3409d1465b 100644
--- a/dlls/wldap32/init.c
+++ b/dlls/wldap32/init.c
@@ -322,7 +322,7 @@ exit:
* The timeout parameter may be NULL in which case a default timeout
* value will be used.
*/
-ULONG CDECL ldap_connect( WLDAP32_LDAP *ld, struct l_timeval *timeout )
+ULONG CDECL WLDAP32_ldap_connect( WLDAP32_LDAP *ld, struct l_timeval *timeout )
{
TRACE( "(%p, %p)\n", ld, timeout );

diff --git a/dlls/wldap32/winldap_private.h b/dlls/wldap32/winldap_private.h
index 69035050961..a6cddabf559 100644
--- a/dlls/wldap32/winldap_private.h
+++ b/dlls/wldap32/winldap_private.h
@@ -320,7 +320,7 @@ ULONG CDECL ldap_compare_ext_sA(WLDAP32_LDAP*,PCHAR,PCHAR,PCHAR,struct WLDAP32_b
ULONG CDECL ldap_compare_ext_sW(WLDAP32_LDAP*,PWCHAR,PWCHAR,PWCHAR,struct WLDAP32_berval*,PLDAPControlW*,PLDAPControlW*);
ULONG CDECL ldap_compare_sA(WLDAP32_LDAP*,PCHAR,PCHAR,PCHAR);
ULONG CDECL ldap_compare_sW(WLDAP32_LDAP*,PWCHAR,PWCHAR,PWCHAR);
-ULONG CDECL ldap_connect(WLDAP32_LDAP*,LDAP_TIMEVAL*);
+ULONG CDECL WLDAP32_ldap_connect(WLDAP32_LDAP*,LDAP_TIMEVAL*);
WLDAP32_LDAP * CDECL ldap_conn_from_msg(WLDAP32_LDAP*,WLDAP32_LDAPMessage*);
ULONG CDECL ldap_control_freeA(LDAPControlA*);
ULONG CDECL ldap_control_freeW(LDAPControlW*);
diff --git a/dlls/wldap32/wldap32.spec b/dlls/wldap32/wldap32.spec
index 8a8e29fc198..33e630dea87 100644
--- a/dlls/wldap32/wldap32.spec
+++ b/dlls/wldap32/wldap32.spec
@@ -75,7 +75,7 @@
85 cdecl ldap_compare_ext_sW(ptr wstr wstr wstr ptr ptr ptr)
86 cdecl ldap_compare_sA(ptr str str str)
87 cdecl ldap_compare_sW(ptr wstr wstr wstr)
- 88 cdecl ldap_connect(ptr ptr)
+ 88 cdecl ldap_connect(ptr ptr) WLDAP32_ldap_connect
89 cdecl ldap_control_free(ptr) ldap_control_freeA
90 cdecl ldap_control_freeA(ptr)
91 cdecl ldap_control_freeW(ptr)
Locked