GTK+ macport on os x - macos

I currently installed gtk2 through macport on os x 10.6 but when i tried to use library like
#include <gtk/gtk.h>
it still doesn't recognize it and give me compile errors.
does anyone know how to install gtk2?

If you have pkg-config on your system, try:
pkg-config --cflags gtk+-2.0

MacPorts installs its header files and libraries in /opt/local/include and /opt/local/lib, respectively. Did you add -I/opt/local/include and -L/opt/local/lib to your compiler flags?

Related

Mac OSX is using gcc 6.2.0 but g++ 4.9.2

I may not understand this completely, but I thought gcc and g++ were basically the same compiler. I used homebrew to install and link gcc 6.2.0 (see Mac OS X: Installed and linked gcc 6.2 with Homebrew, but gcc --version still says 4.9.2 ).
When I say which gcc I get /usr/local/Cellar/gcc/6.2.0/bin/gcc
When I say which g++ I get /usr/local/bin/g++
Did I miss a step or is my understanding way off?
I had to do this:
cd /usr/local/Cellar/gcc/6.2.0/bin/gcc
ln -s g++-6 g++
which I guess I had previously done for gcc.

Getting started with OpenCV on Macbook

I installed openCV on snow leopard with homebrew. Any opencv program I try to run cannot find the required header files.
I understand that the paths of the header files has to be defined. I need help with how I do that?
Use pkg-config to make your job easier:
g++ test.cpp -o test `pkg-config --cflags --libs opencv`

Static cross-compilation of GTK applications on Fedora for Windows?

I'm trying to build gtk3 applications for windows and since Fedora delivers mingw and precompiled libraries for gtk3 for mingw, I used it.
I got the normal compilation working via
i686-mingw32-gcc test.c `pkg-config --cflags --libs gtk+-win32-3.0`
Now I would like to link it statically (Fedora delivers precompiled libraries for that too) but i cannot get it to work. It tryed
i686-mingw32-gcc test.c -static `pkg-config --cflags --libs --static gtk+-win32-3.0`
but it results in
/usr/lib/gcc/i686-pc-mingw32/4.6.1/../../../../i686-pc-mingw32/bin/ld: cannot find -lgtk-3
/usr/lib/gcc/i686-pc-mingw32/4.6.1/../../../../i686-pc-mingw32/bin/ld: cannot find -lgdk-3
/usr/lib/gcc/i686-pc-mingw32/4.6.1/../../../../i686-pc-mingw32/bin/ld: cannot find -lgdk_pixbuf-2.0
/usr/lib/gcc/i686-pc-mingw32/4.6.1/../../../../i686-pc-mingw32/bin/ld: cannot find -lpng14
/usr/lib/gcc/i686-pc-mingw32/4.6.1/../../../../i686-pc-mingw32/bin/ld: cannot find -lffi
AFAIK, static compilation is not supported for GTK+. Anyway, gcc arguments order is important for building with mingw.

How do I link against the GNU readline library rather than libedit in macosx?

Attempting to build Term-Readline-Gnu on macosx, fails complaining about libedit and recommending to use gnu readline. How do I do that?
This is one of the attempts I have tried:
First I built GNU libreadline v6.2 statically but did not install it - to
make sure I did not screw up the system version with the same name:
./configure --prefix=/Users/Fred/Downloads/tmp1
make
make install-static
Then tried to build Term_Readline-Gnu-1.20
cmc:Term-ReadLine-Gnu-1.20 cmc$ perl Makefile.PL
--includedir=/Users/cmc/Downloads/tmp1/include --libdir=/Users/Fred/Downloads/tmp1/lib
Found `/usr/lib/libtermcap.dylib'.
gcc-4.2 -I/Users/Fred/Downloads/tmp1/include -arch x86_64 -arch i386
-arch ppc -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include -DHAVE_STRING_H rlver.c -o rlver -L/Users/Fred/Downloads/tmp1/lib -arch x86_64 -arch i386 -arch ppc -L/usr/local/lib -lreadline -ltermcap
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
The libreadline you are using is the libedit library. Use the GNU
Readline Library.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Chris
Here is an awesome post explaining how to fix OP's issue in few simple steps:
brew install readline
brew link --force readline
cpanm Term::ReadLine::Gnu
brew unlink readline
Check
brew info readline | head -1
It would appear that the GNU readline library is not in /Users/Fred/Downloads/tmp1/lib.
First make sure the library is installed. If you have Mac Ports:
sudo port install readline
On my machine port installs things to /opt, so I ran:
perl Makefile.PL --includedir=/opt/local/include --libddir=/opt/local/lib
So, to drudge up an old question, I just had/solved this problem.
As MisterEd says, you need the GNU readline library. However when you are making Term::Readline::Gnu, you also need to make sure that the GNU readline library architecture is compatible with your perl architecture, because perl compiles it's modules using the compiler switches that it was compiled with.
In OS X, if you install an alternate perl using port or fink, you will get a perl binary compiled just for your architecture (i386 OR x86_64). In that case, MisterEd's answer is A-OK.
However, as you can see from the output above, the questioner is using a Perl that was compiled as a universal binary (-arch i386 -arch x86_64) - probably the system default Perl. In my case, I was using perlbrew to build a newer version of perl, but I needed it to be universal so I could ship things to other OS X machines, so I had gone through some work to make a universal build.
In these cases, you need to compile the Gnu Readline library by hand with some extra switches. I did this:
GNU readline:
./configure CFLAGS="-arch i386 -arch x86_64 -mmacosx-version-min=10.5" \
LDFLAGS="-arch i386 -arch x86_64 -mmacosx-version-min=10.5" ./configure \
--prefix=/usr/local; make
Now for some reason, make failed on one of the final steps creating the .dylib shared library, but at that point it had already built libreadline.a, which I copied into /usr/local/lib.
Term::Readline::Gnu:
Then I downloaded the .tar.gz for Term::Readline::Gnu and did:
perl Makefile.PL --libdir='/usr/local/lib'; make; make install

Problems installing Haskell library regex-pcre on Mac OS X

I'm trying to install the Haskell regex-pcre library using:
cabal install --extra-include-dirs=/usr/local/include \
--extra-include-dirs=/usr/include regex-pcre
However I get this weird error:
Resolving dependencies...
Configuring regex-pcre-0.94.2...
Preprocessing library regex-pcre-0.94.2...
In file included from /Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/include/HsFFI.h:68,
from /Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/template-hsc.h:4,
from dist/build/Text/Regex/PCRE/Wrap_hsc_make.c:1:
/usr/include/float.h:8:24: error: float.h: No such file or directory
In file included from /Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/template-hsc.h:9,
from dist/build/Text/Regex/PCRE/Wrap_hsc_make.c:1:
/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
compiling dist/build/Text/Regex/PCRE/Wrap_hsc_make.c failed (exit code 1)
command was: /usr/bin/gcc -c dist/build/Text/Regex/PCRE/Wrap_hsc_make.c -o dist/build/Text/Regex/PCRE/Wrap_hsc_make.o -march=i686 -m32 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -fno-stack-protector -march=i686 -m32 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -fno-stack-protector -march=i686 -m32 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -D__GLASGOW_HASKELL__=700 -Ddarwin_BUILD_OS -Ddarwin_HOST_OS -Di386_BUILD_ARCH -Di386_HOST_ARCH -I/usr/include -I/usr/local/include -DHAVE_PCRE_H -DSPLIT_BASE=1 -I/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/bytestring-0.9.1.10/include -I/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/base-4.3.1.0/include -I/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/include -I/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/include -I/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/include/
cabal: Error: some packages failed to install:
regex-pcre-0.94.2 failed during the building phase. The exception was:
ExitFailure 1
The gist of it, seems to be that it can't find a second float.h file:
/usr/include/float.h:8:24: error: float.h: No such file or directory
I've opened /usr/include/float.h and line 8 reads:
#include_next <float.h>
I've done my searching on Google, and although I don't know that much C I think I understand what that line is supposed to say, but... I don't know how to really solve this problem. I don't know where else I have a float.h file on my system.
The GHC and GCC versions I'm using. GCC comes from XCode 4. GHC is 32bit, but I've tried the 64bit version too, with the same results.
$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.0.2
OS X version is 10.6.7.
Any help greatly appreciated.
Looks to me like ticket #5011 - XCode 4 on Mac + GHC 7.0.2 fails to link.
This is fixed in GHC 7.0.3 which will be part of the mid-April release of the Haskell Platform.
And alternative fix is to downgrade to the 2010.2 Haskell Platform.
See this question yesterday: Can't install OpenGLRaw-1.1.0.1 on OS X

Resources