Terminal; Error: redefinition of typedef ‘cpu_type_t’

Questions about Wine on macOS.
Locked
scenej
Newbie
Newbie
Posts: 2
Joined: Mon Sep 17, 2012 11:23 pm

Terminal; Error: redefinition of typedef ‘cpu_type_t’

Post by scenej »

So I am new to this whole using terminal thing. I literally have zero knowledge on programming so I apologise in advance if anything I post sounds remedial.
Ok so Ive been trying compile wine-1.5.12 on OSX Mountain Lion. So ive used the macports package manager to install the wine dependencies (I think) then i downloaded and unpacked the wine-1.5.12 source code and applied a patch to it. That all went well and Im pretty sure its done correctly.
Now ive used the following commands:

export CFLAGS="-I/opt/local/include -I/opt/X11/include"
export LDFLAGS="-L/opt/local/lib -L/opt/X11/lib"
export PKG_CONFIG_PATH=/opt/lib/pkgconfig

Which again I think worked correctly (I was told to do this no idea on its full function) and ive tried to configure wine into a new directory on my desktop, i.e.

./configure --prefix=/Users/scene_jamie_son/Desktop/wineo

and that seems to go ok except with a few things not working such as:

configure: libsane 32-bit development files not found, scanners won't be supported.
configure: libv4l 32-bit development files not found.
configure: libgphoto2 32-bit development files not found, digital cameras won't be supported.
configure: liblcms 32-bit development files not found, Color Management won't be supported.
configure: OSS sound system found but too old (OSSv4 needed), OSS won't be supported.
configure: libcapi20 32-bit development files not found, ISDN won't be supported.
configure: libgsm 32-bit development files not found, gsm 06.10 codec won't be supported.
configure: libtiff 32-bit development files not found, TIFF won't be supported.

configure: WARNING: libjpeg 32-bit development files not found, JPEG won't be supported.

Again since im not that tech savay i have no idea if this is important but it says i can use the make command to compile wine but i get the following error message when i do:

gcc -m32 -c -I. -I. -I../../include -I../../include -D__WINESRC__ -D_NTSYSTEM_ -D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wstrict-prototypes -Wwrite-strings -fno-omit-frame-pointer -Wpointer-arith -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/bin/include -I/opt/X11/bin/include -o nt.o nt.c
In file included from ../../include/wine/server.h:28,
from ntdll_misc.h:30,
from nt.c:57:
../../include/wine/server_protocol.h:134: error: redefinition of typedef ‘cpu_type_t’
/opt/local/include/mach/machine.h:69: error: previous declaration of ‘cpu_type_t’ was here
make[1]: *** [nt.o] Error 1
make: *** [dlls/ntdll] Error 2

I have searched the net and found no help to my problem.
Id greatly appreciate it if someone can help me with this problem
Regards
Scenej
User avatar
olivierfrdierick
Level 5
Level 5
Posts: 258
Joined: Thu Sep 13, 2012 12:09 pm

Re: Terminal; Error: redefinition of typedef ‘cpu_type_t’

Post by olivierfrdierick »

Hi
(I was told to do this no idea on its full function)
You would have a better answer from the person who told you to do so.

Those export commands tells that the build command should look for files in some /opt/ directory.
I have zero knowledge on Macs or OSX but I think the exports commands are redundant.
Try without the exports.

The config warnings means that you lack some libraries.
This means that the relevant device/service/file format (scanners, digital cameras, Colour Management, JPEG...) won't be available to your windows applications.
Depending on which application you're going to run this might be critical or not.
You should search for those libraries in macports package manager and compile wine after installing them (if they exists, I have no idea).
ischou
Level 4
Level 4
Posts: 109
Joined: Sun Nov 28, 2010 7:22 pm

Re: Terminal; Error: redefinition of typedef ‘cpu_type_t’

Post by ischou »

/opt is where MacPorts installs software and /opt/X11 is where XQuartz is installed. The intent, I think, was that you use MacPorts to install those dependencies that you are missing, but the fact that you have MacPorts already installed (and hence are getting the error message regarding the offensive header machine.h, perhaps you can just install wine using MacPorts:

sudo port install wine-devel
egallager
Newbie
Newbie
Posts: 1
Joined: Mon Jul 07, 2014 8:31 pm

Re: Terminal; Error: redefinition of typedef ‘cpu_type_t’

Post by egallager »

Again since im not that tech savay i have no idea if this is important but it says i can use the make command to compile wine but i get the following error message when i do:

gcc -m32 -c -I. -I. -I../../include -I../../include -D__WINESRC__ -D_NTSYSTEM_ -D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wstrict-prototypes -Wwrite-strings -fno-omit-frame-pointer -Wpointer-arith -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/bin/include -I/opt/X11/bin/include -o nt.o nt.c
In file included from ../../include/wine/server.h:28,
from ntdll_misc.h:30,
from nt.c:57:
../../include/wine/server_protocol.h:134: error: redefinition of typedef ‘cpu_type_t’
/opt/local/include/mach/machine.h:69: error: previous declaration of ‘cpu_type_t’ was here
make[1]: *** [nt.o] Error 1
make: *** [dlls/ntdll] Error 2
/opt/local is the prefix for MacPorts, so that file was probably installed by a port from MacPorts. I don't actually currently have a "/opt/local/include/mach/machine.h" installed on my machine myself, but I'm pretty sure it used to be installed by the xnu-headers port. You can do `port installed xnu-headers` to see if you have that port installed, and if so, what version. For me, it shows this:

Code: Select all

$ port installed xnu-headers
The following ports are currently installed:
  xnu-headers @1504.15.3_1+universal (active)
Current versions of the port have moved that header to a different location, to avoid conflicts like this. It now installs mach/machine.h to the following locations instead:

Code: Select all

$ port contents xnu-headers | grep "mach/machine.h"
  /opt/local/Developer/SDKs/Darwin10.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/mach/machine.h
  /opt/local/Developer/SDKs/Darwin10.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/PrivateHeaders/mach/machine.h
  /opt/local/Developer/SDKs/Darwin10.sdk/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/mach/machine.h
  /opt/local/Developer/SDKs/Darwin10.sdk/usr/include/mach/machine.h
So if all you want to do is fix your issue, you should probably just upgrade your xnu-headers port to the current version (assuming that that was where the header was coming from). However, the whole reason I came across this thread was because I was Googling information about the `cpu_type_t` type, so if you feel like going more into depth about this type (like I do), read on.

So, first more about the xnu-headers port: OS X is built on top of the xnu microkernel, which is made up of multiple parts. The part we are dealing with here is the mach portion of xnu (located in the `osfmk` directory in the xnu sources), which was based on the mach microkernel from Carnegie Mellon. The reason the xnu-headers port exists is because the xnu sources contain a number of header files that do not get shipped to end-users, so to be able to use the kernel programming interfaces that these headers define, one has to either build xnu from source themselves, or, more simply, just install this port. The problem, though, is that the xnu-headers port installs more than just these uninstalled headers: it also installs headers that are part of xnu that normally get installed system-wide as well (it has no way of distinguishing between the two types of headers). The <mach/machine.h> header is one of this latter type of header that is also installed system-wide as well. My system <mach/machine.h> header defines `cpu_type_t` like this:

Code: Select all

typedef integer_t	 cpu_type_t;
The `integer_t` type is defined in <mach/vm_types.h>, and is just a simple wrapper around the simple `int` type that any beginning C programmer will be familiar with:

Code: Select all

typedef int integer_t;
Meanwhile, Wine's <wine/server_protocol.h> just skips this intermediary type and defines `cpu_type_t` straight to an int:

Code: Select all

typedef int cpu_type_t;
Browsing the various bits of darwin source scattered around my computer, it looks like some versions of cctools did this, too.

Actually that is about the extent of the source diving that I am feeling up to right now; I might come back to this post later and edit more in... but yeah, in the meantime, just upgrade your xnu-headers port if you have an old version of it installed.
Locked