how to compile fox-toolkit with glx.h in mac osx - macos

I am trying to build Fox-toolkit with opengl support in Mac OSX mountain lion (10.8). I have modified the configure file from
GL/gl.h
GL/glu.h
To
OpenGL/gl.h
OpenGL/glu.h
and it can find those two files during the configure. However it cannot find glx.h with none of GL/glx.h, OpenGL/glx.h and GLUT/glx.h
I have XQuartz installed with proper linking. I can see glx.h at /opt/X11/include/GL/glx.h, but the fox-toolkit ./configure cannot find it. How to solve this problem?

GLX is the OpenGL extension protocol extension for X11. While MacOS X has a X11 server, it's OpenGL support it not so good. You certainly want to use MacOS X native OpenGL framework. Which means: No GLX!
I don't know Fox toolkit very well, but it might be (somebody shed some light on this please), that it doesn't contain support for OpenGL widgets on MacOS X yet.

After long search and try, finally I have found the solution to this problem at sourceforge
According to Anders F Björklund (many thanks to him) in the post above-
For 10.7 Lion and beyond, the commands are-
CXXCPP="g++ -E" CXX="g++ -arch i386 -arch x86_64"
CPPFLAGS="-I/usr/X11/include -I/usr/X11/include/freetype2" LDFLAGS="-L/usr/X11/lib" ./configure --with-x --with-xft --with-opengl --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib
make
make install

Related

Using GCC in -m32 mode on mac OS

I need to use gcc in -m32 mode on my macOS Mojave. I know it was deprecated some time ago. What should I do to make it possible?
You would need to download an older version of Xcode (eg. 9.x), and pre 10.14 SDK's (eg. 10.13), then try from there. Apple dropped Xcode capability/support for i386 in 10.14. In other words, Mojave can run existing 32-bit applications but can't build 32-bit applications anymore.
↳ MacPorts Discussion : User information about macOS Mojave
Works for me by installing:
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
as commented here: Can't compile C program on a Mac after upgrade to Mojave

Cross-compiling libjpeg framework for MacOS 10.5 on macOS 10.12

I've tweaked a script for building libjpeg framework here. The key configuration is as follows,
../configure --target i386-apple-darwin9.0 --build i386-apple-darwin9.0 --prefix=$OSXPREFIXDIR/osx-build --disable-dependency-tracking --enable-static=yes --enable-shared=no CFLAGS="-isysroot $XCODE_ROOT/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.5.sdk"
I've been able to create the framework, However it is still built for macOS 10.12 when I use otool -l to check libjpeg object file. Could anyone share a thought?
I have no solution for your compilation problem but if you just want a working libjpeg binary for OS X 10.5+ then you can download it from libjpeg-turbo (either as a static library or as a dynamic one, and both libjpeg and libturbojpeg).
Check: https://libjpeg-turbo.org/Documentation/OfficialBinaries
You'll find a .dmg file on their SourceForge.
Try adding -mmacosx-version-min=10.5 to the CFLAGS. You may not need the target/build parameters, and it may be possible to compile against the latest SDK rather than needing the 10.5 SDK.

How can I get boost to compile for an earlier deployment target on OSX?

this question has been asked before, but none of the answers seem to be currently working.. whether that's because they are incomplete, or things have changed, I don't know.
I build my code for a deployment target of 10.7 (my clients use their machines for music production, so they often prefer to stick with what they know works rather than updated with every new OS release).
I'm using boost.
So when I buid I get a bunch of warnings
ld: warning: object file (/usr/local/lib/libboost_filesystem.a(path.o)) was built for newer OSX version (10.10) than being linked (10.7)
ld: warning: object file (/usr/local/lib/libboost_system.a(error_code.o)) was built for newer OSX version (10.10) than being linked (10.7)
and so on.
So, I want to build boost (version 1.58 currently, unfortunately cmake is usually a couple of versions behind in what it can find) for a deployment target of 10.7
It seems the magic instruction is
macosx-version-min=10.7
except I can't make it work.
./bootstrap.sh
sudo ./b2 -a macosx-version-min=10.7 install
Just doesn't do it, nor do any of the other things I've tried (I'm not familar with how b2 works, so I'm grasping in the dark).
I expect I'm missing something simple, but some help would be much appreciated
regards
Jon
I ran into the same issue and could only fix it by building boost with the 10.7 library. I've used XCode 8.2.1. Here is what I did:
Modifying "Darwin.Jam". Look for this line: feature macosx-version-min : : propagated optional ;
and add this line below feature.extend macosx-version-min : 10.7 ;
Modify "Info.plist" in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform and set <key>MinimumSDKVersion</key>
<string>10.11</string>
Make sure your XCode.app has the 10.7 SDK installed. This is the right location: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs You can extract or copy it from an earlier version of XCode.
Now build boost with these options: cxxflags="-stdlib=libc++ -std=c++11 -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"
E.g. ./b2 -a cxxflags="-stdlib=libc++ -std=c++11 -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"
The solution above will build Boost with the 10.7 SDK instead just setting the Target SDK to 10.7

How can I update clang to 3.3 on Mac OS X 10.6

I'm running Mac OS X 10.6 and want to install TextMate 2, which is for Mac OS X 10.7+.
But all what it needs is a newer version of clang (LLVM), which is included in Lion and Mountain Lion. I read before here I can do that with MacPorts. So I used port install clang and MacPorts updated to clang-2.9, then clang-3.2 and finally clang-3.3. I thought, its updated now and I checked the version: clang --version. And it's not updated:
Apple clang version 2.0 (tags/Apple/clang-139) (based on LLVM 2.9svn)
Target: x86_64-apple-darwin10
Thread model: posix
So I copied the new clang file in this path (/opt/local/libexec/llvm-3.3/bin) to/usr/bin`. But now there's a fail :( :
dyld: Library not loaded: #executable_path/../lib/libLLVM-3.3svn.dylib
Referenced from: /usr/bin/clang
Reason: image not found Trace/BPT trap
The libLLVM-3.3svn.dylib is at /opt/local/libexec/llvm-3.3/lib. What can I do now, that
it runs clang-3.3? Sorry for my not perfect english ;) Thank you!
If you run clang from /usr/bin, it will be looking for the LLVM library in /usr/bin/../lib/libLLVM-3.3svn.dylib, i.e., /usr/lib/libLLVM-3.3svn.dylib (at least that's what the dynamic loader is telling you). You could try to copy the lib file into /usr/lib.
Alternatively, you can just download a more recent official build of Clang here:
http://llvm.org/releases/download.html
As far as I know, these builds are self-contained and do not need any dynamic libraries. However, it could be necessary to copy Apple's ARC libraries into a certain directory. If you run into trouble, please ask again.
Another approach is to build Clang and LLVM from source. You can find the repository URLs and instructions here:
http://clang.llvm.org/get_started.html
This should also build Clang with the LLVM libraries statically linked.
3.3, by the way, has not been officially released, so I would recommend using 3.2 unless you need any specific new features.

How to compile for Mac OS X 10.5

I'd like to compile my application for version 10.5 and forward. Ever since I upgraded to Snow Leopard and installed the latest XCode, gcc defaults to 10.6. I've tried -isysroot /Developer/SDKs/MacOSX10.5.sdk but that doesn't seem to work. Is there a GCC flag that allows me to set the SDK?
(Incidentally, I changed the gcc symbolic link to point to gcc-4.0 instead of gcc-4.2 and it worked but I thought I could tell the latest GCC to compile for an older SDK).
Thanks,
Rui
In XCode you only need to set the deployment target to OSX 10.5.
For gcc you need to set -mmacosx-version-min=10.5.

Resources