Mac OS X From Source

Questions about Wine on macOS.
Locked
CDeLorme
Newbie
Newbie
Posts: 2
Joined: Fri Apr 23, 2010 6:06 pm

Mac OS X From Source

Post by CDeLorme »

Hello,

I really would have prefered a contribution as my first post instead of a question, but having spent the better part of the last three days scouring the web, forums, and websites I am left with this as my final option.

I cannot get the latest Wine to compile on my Mac OS X 10.6.3 Snow Leopard with the dependancies I want to have installed. My system is a MacBook Pro /w 4GB RAM 667 Mhz, and a 2.2 Ghz Intel Core 2 Duo Processor, I do other development on my system so I had already installed XCode.


I have set the following flags per the instructions pages (I have read every page, many times as well for help):

export CFLAGS="-arch i386 -m32"
export CXXFLAGS="$CFLAGS"
export CPPFLAGS="-I/usr/X11/include"
export LDFLAGS="-L/usr/X11/lib"


I intend to test many different applications with Wine, it is an awesome (potential) solution to having a VM eat resources and fail to deliver. Before you ask, I have already attempted the macports install, it installed but with similar dependancy issues. After that I also tried WineBottler, but debugging anything in that is like pulling teeth without anesthetics.

It's more beneficial to me to learn through mistakes and end up with a better understanding and being able to debug problems as they come up, than to use a pre-built or scripted solution. That said I downloaded the lated git of Wine, and ran the configure the first time, I looked up the dependancies and downloaded the ones I wanted (in particular libpng, libjpeg, and libgnutls).

I installed all three, libpng worked on the first go and seems to be just fine. However the configure still can't find libtiff, libjpeg, and libgnutls.


This is what I get at the end of my verbose configure, and without the "WARNING" it also lists libtiff and libgnutls (among a few others I am not concerned with).

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

At the top of the config I have these, and if x86_64 indicates 64 bit compile then apparently I am not setting something right because I am pretty sure 64 bit Wine won't work with most of the applications I want to run unless I misunderstood the 64 bit page.

checking build system type... x86_64-apple-darwin10.3.0
checking host system type... x86_64-apple-darwin10.3.0


I also opened the config.log file and located these two lines, which lead me to believe it found the libraries but can't use em because they are the wrong architexture (Probably 64 bit as I am on Snow Leopard):

ld: warning: in /usr/local/lib/libjpeg.dylib, file was built for unsupported file format which is not the architecture being linked (i386)

ld: warning: in /usr/local/lib/libtiff.dylib, file was built for unsupported file format which is not the architecture being linked (i386)


After that I googled for several hours to try and find out to force compile into 32 bit more, and found minor scraps of information similar to the flags (environment variables) for the wine install. I tried several configurations of those flags, and finally I managed to change the configure log for libjpeg from x86_64-apple-darwin10.3.0 to i386-apple-darwin10.3.0, and compiled/installed successfully, I think!

The problem is I have no idea how to check the version/architexture of a lib file, and yeah google wasn't very helpful there either. So I ran the wine configure again, and to my dismay still throwing up its hands at a missing supported libjpeg architexture.


I have tried searching the forums for similar issues to my own, but I haven't found anything directly related. If anyone could lend me some support it would be greatly appreciated.


Also here is a complete list of the files not found:

configure: libhal/libdbus 32-bit development files not found, no dynamic device support.
configure: libgnutls 32-bit development files not found, no schannel support.
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: 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.
James McKenzie

Mac OS X From Source

Post by James McKenzie »

CDeLorme wrote:
Hello,

I really would have prefered a contribution as my first post instead of a question, but having spent the better part of the last three days scouring the web, forums, and websites I am left with this as my final option.

I cannot get the latest Wine to compile on my Mac OS X 10.6.3 Snow Leopard with the dependancies I want to have installed. My system is a MacBook Pro /w 4GB RAM 667 Mhz, and a 2.2 Ghz Intel Core 2 Duo Processor, I do other development on my system so I had already installed XCode.


I have set the following flags per the instructions pages (I have read every page, many times as well for help):

export CFLAGS="-arch i386 -m32"
export CXXFLAGS="$CFLAGS"
export CPPFLAGS="-I/usr/X11/include"
export LDFLAGS="-L/usr/X11/lib"


I intend to test many different applications with Wine, it is an awesome (potential) solution to having a VM eat resources and fail to deliver. Before you ask, I have already attempted the macports install, it installed but with similar dependancy issues. After that I also tried WineBottler, but debugging anything in that is like pulling teeth without anesthetics.

It's more beneficial to me to learn through mistakes and end up with a better understanding and being able to debug problems as they come up, than to use a pre-built or scripted solution. That said I downloaded the lated git of Wine, and ran the configure the first time, I looked up the dependancies and downloaded the ones I wanted (in particular libpng, libjpeg, and libgnutls).

I installed all three, libpng worked on the first go and seems to be just fine. However the configure still can't find libtiff, libjpeg, and libgnutls.


This is what I get at the end of my verbose configure, and without the "WARNING" it also lists libtiff and libgnutls (among a few others I am not concerned with).

configure:16243: WARNING: libjpeg 32-bit development files not found, JPEG won't be supported.
That's because you built the 64 bit versions (Snow Leopard is a 64 bit
OS, and the stock configure will detect this and build away...)
At the top of the config I have these, and if x86_64 indicates 64 bit compile then apparently I am not setting something right because I am pretty sure 64 bit Wine won't work with most of the applications I want to run unless I misunderstood the 64 bit page.
64 bit Wine is brokenness but it is getting some help and 64/32 bit has
to work before Wine 1.2 is released.
checking build system type... x86_64-apple-darwin10.3.0
checking host system type... x86_64-apple-darwin10.3.0
There is your clue.
I also opened the config.log file and located these two lines, which lead me to believe it found the libraries but can't use em because they are the wrong architexture (Probably 64 bit as I am on Snow Leopard):

ld: warning: in /usr/local/lib/libjpeg.dylib, file was built for unsupported file format which is not the architecture being linked (i386)

ld: warning: in /usr/local/lib/libtiff.dylib, file was built for unsupported file format which is not the architecture being linked (i386)


After that I googled for several hours to try and find out to force compile into 32 bit more, and found minor scraps of information similar to the flags (environment variables) for the wine install. I tried several configurations of those flags, and finally I managed to change the configure log for libjpeg from x86_64-apple-darwin10.3.0 to i386-apple-darwin10.3.0, and compiled/installed successfully, I think!

The problem is I have no idea how to check the version/architexture of a lib file, and yeah google wasn't very helpful there either. So I ran the wine configure again, and to my dismay still throwing up its hands at a missing supported libjpeg architexture.


I have tried searching the forums for similar issues to my own, but I haven't found anything directly related. If anyone could lend me some support it would be greatly appreciated.


Also here is a complete list of the files not found:

configure: libhal/libdbus 32-bit development files not found, no dynamic device support.
HAL should not build on MacOSX as the 'hooks' for it are not present.
DBUS has issues, you will have to look around for the fixes, but it does
build on Macs.
configure: libgnutls 32-bit development files not found, no schannel support.
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: 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.

You will need to run configure --help for each of these to find out how
to build 32 bit libraries.

The interesting thing is that I was building Darwine using Mike's build
system. I have a patch that needs to be tested and updated and then it
is off to bigger/better things (I do want to have a life, everyone.)

James McKenzie
Ryan Woodsmall

Mac OS X From Source

Post by Ryan Woodsmall »

It's more beneficial to me to learn through mistakes and end up with a better understanding and being able to debug problems as they come up, than to use a pre-built or scripted solution. That said I downloaded the lated git of Wine, and ran the configure the first time, I looked up the dependancies and downloaded the ones I wanted (in particular libpng, libjpeg, and libgnutls).
Excellent - it is beneficial to know the build process (and that of dependencies).
After that I googled for several hours to try and find out to force compile into 32 bit more, and found minor scraps of information similar to the flags (environment variables) for the wine install. I tried several configurations of those flags, and finally I managed to change the configure log for libjpeg from x86_64-apple-darwin10.3.0 to i386-apple-darwin10.3.0, and compiled/installed successfully, I think!

The problem is I have no idea how to check the version/architexture of a lib file, and yeah google wasn't very helpful there either. So I ran the wine configure again, and to my dismay still throwing up its hands at a missing supported libjpeg architexture.
You can check what architectures a library supports using the "file" command from a terminal. For example, the libxml2 library supports 32-bit Intel and PowerPC and 64-bit Intel platforms:

**
rbwmbp:~ ryan.woodsmall$ file /usr/lib/libxml2.dylib
/usr/lib/libxml2.dylib: Mach-O universal binary with 3 architectures
/usr/lib/libxml2.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
/usr/lib/libxml2.dylib (for architecture i386): Mach-O dynamically linked shared library i386
/usr/lib/libxml2.dylib (for architecture ppc7400): Mach-O dynamically linked shared library ppc
**

How comfortable are you in a terminal? With a compiler, linker and environment variables? Have you looked over and fully comprehended the OS X build page?

http://wiki.winehq.org/MacOSX/Building

You need to compile *all* required libraries with, at a minimum, the CFLAGS setting to build as 32-bit code. You'll need to make sure that Wine can find the headers and libraries by modifying/appending to your include paths (adding CPPFLAGS -I/path/to/incdir for each directory) and your library path (set using LDFLAGS -L/path/to/libdir additions). You'll need to set DYLD_FALLBACK_LIBRARY_PATH for running Wine after you've built it; this should reflect your LDFLAGS setting so libraries can be found at runtime.

http://wiki.winehq.org/MacOSX/Building# ... 8fd8e53004

I cooked up a script to compile Wine from source, including all possible (I think, anyway) dependencies relevant on OS X:

http://code.google.com/p/osxwinebuilder/

You don't have to use this, of course, but the source is there and open (LGPL'ed) if you're so inclined to look under the covers of how you can force packages to build as 32-bit from source:

http://code.google.com/p/osxwinebuilder ... nebuild.sh

If you're building dependent packages by hand, from source, you'll need to make sure CFLAGS, CPPFLAGS, LDFLAGS, etc., all remain set for *each* package. Again, Wine's configure program will need to know how to find the headers and libraries you generated by running "./configure && make && make install" - if you've specified an install path with configure's "--prefix=/path/to/wherever" option, you'll need to make sure Wine's looking in the proper location in your filesystem.

Using MacPorts, you can force 32-bit compiler output by setting a couple of config file options:

- In /opt/local/etc/macports/macports.conf
Uncomment and set "build_arch i386"
Remove 64-bit code building from the universal_archs directive by changing the line to "universal_archs i386"
- And/or in /opt/local/etc/macports/variants.conf or ~/.macports/macports.conf
Set "+universal"

There are a lot of gotchas to building from source on any platforms, but OS X is different enough that it's a bit painful to explain top to bottom in an easy manner. Good luck, and let us know how you progress.
CDeLorme
Newbie
Newbie
Posts: 2
Joined: Fri Apr 23, 2010 6:06 pm

Post by CDeLorme »

First, I want to thank you both for your very informative replies. I do have a half-decent understanding of programming, primarily web development. I've worked with loads of languages, but never a compiler, so I have virtually no experience using compilers, related environmental variables, and linkers (What are linkers exactly?). This is not to say I don't comprehend how they work, just that I don't know what options there are and what values are acceptable.


@James

Yeah, Snow Leopard compiles to 64 by default, but I managed to start reinstalling most with 32 bit or universal, in particular however I can't get it to recognize libjpeg at all.

Thank you for confirming that my Wine source was still trying to compile as 64 bit. However, I thought that was the point of setting the CFLAGS and CXXFLAGS to "-arch i386 -m32"? Any chance I am missing something? Would it trying to compile as 64 bit interfere with the detection of libraries, such as the 32 bit libjpeg, or should it have no bearing on that?

Yeah, I found out hal wouldn't work real quick when I attempted a configure and it was looking for pci.ids in a non existant location. I just looked through my libdbus install, it installed fine but it was x86_64, so it is 64 bit.

I have been running the --help for them, but all they give me is the environment variables like CC, CFLAGS, LDFLAGS, etc. Having no experience with these and being unable to find any decent documentation all I've been able to do is randomly try stuff like "-arch i386", which isn't working. The help files don't give me what values go there, only what variables effect the compiler.


@Ryan

I am comfortable with the command prompt, I don't mind making mistakes, or fixing them.

I knew about the file command, but I didn't know it worked on all files, that is wonderfully helpful. In fact, I justed used it to check my jpeg lib, and as I feared it is still compiling into 64 bit, even though the configure log specifically showed i386.


For the Wine compilation I've been using all of the WineHQ Wiki resources extensively, that's why I set those environmental variables, I also knew about the DYLD_FALLBACK_LIBRARY_PATH, so that isn't a problem. The building on Mac OS X Page is one of many pages open in a tab in my browser when I was trying to get this working.

Initially I ran a ./configure --verbose without setting those variables, and recieved missing header errors, but those are fixed when I set the environmental variables.

When I initially installed wine with macports I used the following guide, it worked with no errors, but again wasn't as helpful in understanding what everything does (It is also a version behind):

http://davidbaumgold.com/tutorials/wine-mac/

I had no idea google created anything for this, that's certainly fantastic and I have no troubles looking through all of the details there, that's probably more helpful than the hundreds of pages I've read so far that haven't worked.

------


Alright, well at least I know what's wrong, but do either of you know any useful websites that show acceptable values for the CFLAGS, and similar environmental variables? I've tried searchin GCC Environmental Variables, GCC Compiler Options, GCC Compiler Flags, etc. The only useful pages I find have random examples, most of them are dated so they generally don't work for me.

I appreciate all your help so far and will proceed to tear apart the google code for answers. If you have any helpful resources for the compiler flags that would be fantastic. I will continue to post my progress.

~Casey
Locked