Difference between revisions of "CompilingMacOsX"

From Inkscape Wiki
Jump to navigation Jump to search
(update of the compilation how to and clear separation between howto and compilation history)
 
(216 intermediate revisions by 33 users not shown)
Line 1: Line 1:
= Compiling and Packaging Inkscape under Mac OS X =
= Using MacPorts =


== Before you start ==
<ol>
If you want an Official Release of inkscape, note that from version 0.42 of Inkscape, a Mac OS X package (in .dmg form) will be available. In addition, regular Development Versions will be build. Both can be downloaded from inkscape's downloads page:
<li>Download and install [http://www.macports.org/ MacPorts]
<li>Edit the MacPorts variants config (optional).
<br>Add this line to <code>/opt/local/etc/macports/variants.conf</code>
<pre>-x11 +quartz</pre>
<li>In Terminal (Applications>Utilities>Terminal) type
<syntaxhighlight lang="bash">sudo port install \
    adwaita-icon-theme \
    boehmgc \
    boost \
    cairo \
    ccache \
    cmake \
    double-conversion \
    gdl3 \
    gettext \
    gsl \
    gtkmm3 \
    gtk-osx-application-gtk3 \
    lcms2 \
    libsoup \
    libxslt \
    ninja \
    poppler \
    potrace \
    py-lxml \
    py-numpy \
    -x11 +quartz
</syntaxhighlight>
<li>In Terminal, get Inkscape
<syntaxhighlight lang="bash">git clone --recurse-submodules https://gitlab.com/inkscape/inkscape.git</syntaxhighlight>
<li>And build inkscape
<syntaxhighlight lang="bash">
# use a clean MacPorts environment (optional)
LIBPREFIX="/opt/local"
export PATH="$LIBPREFIX/bin:/usr/bin:/bin:/usr/sbin:/sbin"


:http://www.inkscape.org/download.php
# where to install
PREFIX="$PWD/install-prefix"


Inkscape for Mac OS X is an X client: it runs under the [http://en.wikipedia.org/wiki/X_Window_System X Windows System]. You will need an X Windows Server installed for it to work. You can get the Apple X Server (requires Mac OS X 10.3 or above) here:
# where to build
mkdir build
cd build


:http://www.apple.com/downloads/macosx/apple/x11formacosx.html
cmake \
    -G Ninja \
    -DCMAKE_PREFIX_PATH="$LIBPREFIX" \
    -DCMAKE_INSTALL_PREFIX="$PREFIX" \
    -DCMAKE_C_COMPILER_LAUNCHER=ccache \
    -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
    -DWITH_OPENMP=OFF \
    ..


----
ninja
----
ninja install
</syntaxhighlight>
''Note: Using [https://en.wikipedia.org/wiki/Ccache ccache] and [https://ninja-build.org/ ninja] is not required, but very common because it speeds up compilation.''
<li>Run Inkscape
<syntaxhighlight lang="bash">
$PREFIX/bin/inkscape
</syntaxhighlight>
</ol>


== Compiling How To ==
= Using Homebrew =


'''Note''': You could use the [http://fink.sourceforge.net/pdb/package.php/inkscape inkscape package] from the [http://fink.sourceforge.net Fink project] to install Inkscape from source but this package is usally older that the precompiled Development Versions and even that the Official Release so this does not seem usefull.
If you are using [https://brew.sh/ Homebrew] instead, you can still use the above guidelines with small modifications.


'''Requirements''':
List of '''packages''' to install with brew
#Mac OS X 10.3 of higher
#A full [http://fink.sourceforge.net/faq/usage-fink.php?phpLang=en#unstable unstable fink] installation
#Inkscape source code. You can get the [http://www.inkscape.org/download.php official release source code], a [http://www.inkscape.org/cvs-snap/ CVS snapshot] or a copy of the [http://sourceforge.net/cvs/?group_id=93438 cvs repository] (the module name is "inkscape")


'''Installing dependencies''':
<syntaxhighlight lang="bash">
brew install \
    adwaita-icon-theme \
    bdw-gc \
    boost \
    cairomm \
    ccache \
    cmake \
    double-conversion \
    gdl \
    gettext \
    graphicsmagick \
    gsl \
    gtk-mac-integration \
    gtkmm3 \
    gtkspell3 \
    imagemagick \
    intltool \
    lcms2 \
    libsoup \
    libsvg-cairo \
    libxslt \
    ninja \
    poppler \
    potrace
</syntaxhighlight>


In a Terminal type:
Since '''Homebrew''' only offers <code>gettext</code> as a keg (not linked to <code>/usr/local</code>) an extra option needs to be passed on to <code>cmake</code>.
<pre>
fink install �
        intltool �
        glib2 glib2-dev glib2-shlibs �
        gtk+2 gtk+2-shlibs gtk+2-dev �
        libpng3 libpng3-shlibs �
        libsigc++2 libsigc++2-shlibs �
        gtkmm2.4 gtkmm2.4-dev gtkmm2.4-shlibs �
        libtool14 libtool14-shlibs �
        libxml2 libxml2-shlibs �
        libsigc++2 libsigc++2-shlibs �
        popt popt-shlibs �
        gc gc-shlibs
</pre>


Fink installs many packages from source so this is usually long.
Modify the script in step 5 by changing <code>LIBPREFIX="/usr/local"</code> and adding the following line to the cmake arguments:


'''Setting the build environment''':
<syntaxhighlight lang="bash">
    -DIntl_INCLUDE_DIR="/usr/local/opt/gettext/include" \
</syntaxhighlight>


You need set the following environment variables (taken right out of fink's <code>.info</code> file) for the compilation to work. They are is in bash syntax. You can create a file named <code>set_variables</code> for example and copy/paste this inside:
=See also=
<pre>
* [[Tracking Dependencies]]
#!/bin/bash
* [[Extension requirements]]
FINK="/sw"
*[[Compiling Inkscape]]
export LIBRARY_PATH="/usr/X11R6/lib:$FINK/lib"
*[[Notes on Packaging for OS X]]
export CPATH="$FINK/include"
* https://github.com/valerioa/Inkscape-MacOS-Curated-Build
export PATH="/usr/X11R6/bin:$PATH"
* [https://github.com/ipatch/homebrew-us-05/blob/master/inkscape/inkscape-building-for-macOS.md ipatch's collection of notes] about building Inkscape using Homebrew
export CC="ccache gcc"
export CXX="ccache g++"
export CFLAGS="-I$FINK/include -O3 -Wall"
export LDFLAGS="-L$FINK/lib"
export CXXFLAGS="$CFLAGS"
export CPPFLAGS="$CXXFLAGS"
</pre>


Then, open a Terminal and, in the directory where yhou created the file, type:
[[Category:Developer Documentation]]
<pre>
bash
source set_variables
</pre>
 
'''Building''':
 
Open a Terminal and cd to Inkscape's sources directory. Type:
<pre>
./configure --prefix=/some/directory/
make
make install
</pre>
 
You have to put your build products somewhere you have write access to (for example you home directory) in order to be able to package the application from there afterwards. That is what the <code>--prefix</code> option is for.
 
'''Packaging''':
 
The process is automatized. You just have to open a Terminal, cd to Inkscape's sources directory and type:
<pre>
cd packaging
./osx-app.sh /path/to/bin/inkscape ../Info.plist macosx
</pre>
 
You will end up with two files in current directory: Inkscape.app that you can copy to your Applications directory and Inkscape.dmg for distribution.
 
-- Kees Cook, Michael Wybrow, Jean-Olivier Irisson
 
----
----
 
 
== News and History about compiling under OS X ==
 
----
 
 
Since gc 6.4 is needed, once fink is updated, you can install: "fink install gc gc-shlibs", but until then, you'll need to compile it yourself.  :(
 
Some packaging links:
http://freespace.ausgamers.com/2005/02/creating-os-x-application-bundles-step.html
http://java.sun.com/developer/technicalArticles/JavaLP/JavaToMac3/
 
-----
 
See the new Info.plist.in file in CVS, as well as packaging/osx-app.sh for building an .app directory.  I have no idea what I'm doing, and I'm doing it blind, so any help is appreciated.  I'm guessing at appropriate paths in src/path-prefix.h, which get activated with configure's --enable-osxapp now.
 
Also, we probably need to do all this stuff too:
http://gimp-app.sourceforge.net/gimp.app.howto.txt
 
------
 
I have succesfully built Inkscape 0.40-1 via Fink under Mac OS X 10.3
 
After I have moved to "~/Desktop/Inkscape.app/Contents" following the way explained for the Gimp.app
 
The application lauches itself with a double-click and it is available there http://niwaconcept.free.fr//x11/Inkscape.zip
 
But if it can be stored there that would be better. The file is 60 Mb do dwnload, and then 280 Mb for the software itself.
 
M-Rick
 
upload:inkscape-0.40-2.jpg
upload:inkscape-0.40-1.jpg
 
----
 
I've downloaded the zip and copied the resulting .app to /Applications.
 
Running it gives the following errors:
 
<pre>/Applications/Inkscape.app/Contents/MacOS robmyers$ ./Inkscape
dyld: ./Inkscape can't open library: /Volumes/Utilisateurs/Users/aymeric/Desktop/Gimp/ScriptExec/build/ScriptExec.build/ScriptExec.build/Objects-normal/ppc/libstdc++_ZeroLink.dylib 
(No such file or directory, errno = 2)
Trace/BPT trap</pre>
 
- robmyers .
 
----
 
Strange ....
And it puts all the path of my computer ...
 
And scriptExec is the script used by gimp.app, once compiled it is said to change the name.
 
When I ran inkscape from my computer, I did from many locations and no problems, I will see I have errors feedbacks.
 
I am not specialized in programming so if someone wants to help no problem.
 
M-Rick
 
----
 
Ok it's done.
 
Anyway, there are a few bugs, also present in Fink :
 
Some menus appear behind the windows.
 
Impossible to export as bitmap, there is an error message "The chosen area to be exported is invalid" and I have it even if I change the path.
 
I made a DMG, you can download and test it there http://niwaconcept.free.fr//x11/Inkscape.zip
 
M-Rick
 
----
 
That works perfectly. And the .dmg window looks very good, it's a perfect Mac installer.
 
Thanks!
 
- robmyers .
 
----
 
Erk! But when I try it on a machine without Fink installed, I get the following error:
<pre>
dyld: /Applications/Inkscape.app/Contents/Resources/bin/inkscape can't open library: /sw/lib/libgtkmm-2.4.1.dylib  (No such file or directory, errno = 2)
</pre>
 
This despite the fact that libgtkmm is present in the Inkscape.app/Contents/Resources/lib/ directory.
 
- robmyers .
 
 
----
 
Yes, I just made an update for it. I tricked it, because it is looking for a sw folder, so i made a link to the software, just double-click it and and it will create it automatically for you, until I find the way to not have to do this.
 
M-Rick
 
----
 
Does Gimp.app do this? What happens if someone uses Fink and /sw already exists?
 
Downloading, running and installing, this now works after a couple of runs. Don't know if I was being impatient. :-)
 
- Inkscape MacOSX Testing Team (i.e. robmyers :-) ).
 
----
 
No Gimp.app doesn't do that. Inkscape does that because I haven't found yet the way it tries to find the share folder.
If you already have Fink installed, well, it will not erase it just add the link.
 
Inkscape.app has a problem with the GTK pixmaps location, so I have made a script inside the software that will create a link automatically. So for the first launch, it is better to launch under an admin session.
But if you have Fink already installed, it won't work unless you are root, so if you don't want to login as root, you can change the settings of the folders /sw and /sw/share to Group/Admin and Acces/Read and Write.
 
If someone finds the way to correct this, we won't have to do this trick anymore.
 
M-Rick
 
----
 
I think the program will need to add the pixmap location dynamically to $GTK_PATH on startup using setenv before starting Inkscape proper?
 
- robmyers .
 
----
 
I've installed inkscape.app. It works quite well on Japanese environment. "KANJI" can be used!
 
Ken
 
upload:japanese.jpg
 
-----
 
I've installed it and it works. Very nice. The background image in the DMG is a nice touch, though you could maybe add the standard 'drag this icon to your applications folder' text to that. I still find Inkscape rather slow -- with the Windows version I assumed it was just a porting issue. Is the same true here? I have an SVG document with about 1000 objects. BTW, curious bug -- tooltips for floating palettes appear ''below'' them!
 
-----
 
Damn, I'm at work and don't have my mac with me! Can't wait to get home and install this!!! I'll see what I can do about some of these problems, too.
 
-----
 
I gave the DMG a try on my PowerBook running 10.3, with Fink and Gimp.app installed.  It seems to work ok, except most of the tool icons don't show up.  When I hover over them I get a blue Aqua-lozenge background and the tooltip, but the icon never shows up.  The only ones that do are New File, Open File, Save, Print, Undo, Redo, Copy, Cut, and Paste.  FYI.
 
-Ken-ichi
 
 
-----
 
A note about the icons: the app icon is fantastic, as is the inkscape SVG document icon. The other document icons are good too, but the file extension badge shouldn't stick out from the page image (see [http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGIcons/chapter_5_section_2.html#//apple_ref/doc/uid/20000967/TPXREF117]).
 
------
 
Has anyone besides me noticed that inkscape loads VERY slowly (>1.5 minutes)?  Is this normal?
 
Marcus Collins
 
------
 
On my PowerBookG4 12in 867MHz, loading time of Inkscape(fink): 20 sec, Inkscape.app: 135 sec. VERY slowly.(v_v)
 
Ken
 
----
 
Well yes it is very slow. Even via Fink, the delay in launch time is due to library checking .... I ond't know how to solve it, so if someone is ready to check the sources it's OK. I don't know the exact command it uses to check them. Once this corrected, it will launch fast as in Fink.
 
For the pixmaps, it's because of the problem just above, since I don't know how it checks the lib paths, the pixmaps checking is wrong, so you must make a link from Inkscape.app/Contents/Resources/lib/libgtkmm-2.4.1.dylib to /sw/lib
 
M-Rick
 
----
 
I've added Inkscape to FreeSMUG (Free Software Mac User Group) directory:
http://www.freesmug.org/review/inkscape
 
Happy MhACking.
 
Gand.
 
----
 
About freesmug.org you talk about menus that appears behind windows. It appears only if you use quartz-wm. For people who have for example kde, it works fine, but it's slower to launch/use.
 
Darwinports has the 0.41 package now. It still has awfull dependencies (why compiling ALL gnome just to get inkscape?). But it works fine. I didn't try your .dmg file thou.
 
iznogoud_
 
----
 
Dose Inkscape.app work well on Tiger?
 
Ken
----
I have tried, and tried again, but I am unable to compile Fink on Tiger. I know it's early days (only been out for a week) but I find it interesting that compilation fails - what has changed? Does it involve the new compiler? (GCC 4.x) Error is:
 
  object-edit.cpp: In function `void sp_spiral_outer_set(SPItem*, const
  NR::Point&, const NR::Point&, unsigned int)':
  object-edit.cpp:842: error: `__isfinite' undeclared (first use this function)
  object-edit.cpp:842: error: (Each undeclared identifier is reported only once
  for each function it appears in.)
  make[2]: *** [object-edit.o] Error 1
  make[1]: *** [all-recursive] Error 1
 
I am busy downloading Inkscape.app with the hope that it will work.
 
Dawid Loubser
----
Help! Please help me get this to work. I need Inkscape!
 
If you need Inkscape and inkscape.app isn't working, try fink. You'll need to install the unstable branch, but this works on 10.3 and 10.4 just fine. http://fink.sourceforge.net
 
----
Problems with isnan and isfinite again. New fink package should build fine on tiger.
 
If you are compiling yourself, to save you an hour, add -D__LONG_DOUBLE_128__ to you CPPFLAGS.
 
Peter
 
 
 
Hi. Try to compile with darwinport. Some warnings and an error :
  gc.cpp: In function `void Inkscape::GC::init()':
  gc.cpp:190: error: assuming cast to type 'void* (*)(size_t)' from overloaded function
  make[2]: *** [gc.o] Error 1
  make[1]: *** [all-recursive] Error 1
  make: *** [all] Error 2
 
Tried gcc 4.0 and 3.4. Tried the -D__LONG_DOUBLE_128__ as well. Got this error or the one above. I'll try fink
 
 
-----
 
Can anyone help?
 
I've just installed inkscape through fink on Tiger and all works fine except that when I run inkscape I get the following errors (in a dialogue box):
 
    One or more extensions failed to load...
 
A look in the error-log file: extension-errors.log, shows the following:
 
Extension "Postscript Input" failed to load because a dependency was not met.
Dependency::
  type: extension
  location: path
  string: org.inkscape.input.sk
 
Extension "EPS Input" failed to load because a dependency was not met.
Dependency::
  type: extension
  location: path
  string: org.inkscape.input.ps
 
I really need eps and postscript support (there are also a couple of other extensions missing, but these are less important). Did anyone else have this problem or know a work around. Fink says all my packages are up to date... and I have gs and pstoedit installed already...
 
Justin.
 
----
 
I'm having a problem running inkscape app on Mac OS 10.4.1. Here's the crash log:
 
<pre>
Host Name:      iMac
Date/Time:      2005-05-26 22:14:32.458 +0200
OS Version:    10.4.1 (Build 8B15)
Report Version: 3
 
Command: inkscape-0.40
Path:    /Users/karl/Desktop/Inkscape.app/Contents/Resources/bin/inkscape-0.40
Parent:  Inkscape [1029]
 
Version: ??? (1.0)
 
PID:    1030
Thread: Unknown
 
Link (dyld) error:
 
Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /Users/karl/Desktop/Inkscape.app/Contents/Resources/lib/libJPEG.dylib
</pre>
 
-- Karl
 
-----
 
On Tiger, I have downloaded the .dmg image of Inkscape and
dragged it into /Applications.
 
Then remove or rename a few libraries inside the Inkscape directory:
<pre>
cd /Applications/Inkscape.app/Contents/Resources/lib/
mv libjpeg.dylib libjpeg.dylib.original
mv libtiff.dylib libtiff.dylib.original
mv libpng.dylib libpng.dylib.original
</pre>
 
Then, as root (sudo sh), link the "share" directory to the place
where Inkscape expects it:
<pre>
cd /sw/share
ln -s /Applications/Inkscape.app/Contents/Resources/share/inkscape inkscape
</pre>
 
Start Inkscape, have patience (1-2 minutes, no idea why), and it
will start.
 
-- Alex.
 
----
 
I have downloaded the latest package on this page, but it doesn't do a thing. When I start inkscape inside the package, it starts up, starts x11 if that wasn't up yet, and after a couple of seconds it quits. Running it from the Terminal does the same thing, and I'm not getting any errors on the stdout/stderr. Has someone experienced similar problems with inkscape on Tiger? And maybe someone has found a solution?
 
I can't find inkscape in fink, either.
 
<b>Update</b> I should hit myself... The above post by Alex told me how to get inkscape to run on Tiger, and I simply didn't see it. So for all other people having similar problems: try Alex' tips! I had to wait for 1-2 minutes on this pbook as well, but it finally shows up and runs fine.
 
Has anyone figured out why some drop down boxes and such do show up behind the dialogs? Has this anything to do with the aggresive behavior of those windows to always be on top of other windows? I have tried several options in the inkscape preferences pane, but this didn't do away with the boxes-behind-dialogs problem. Is there a way this can be disabled while running or at compile time?
 
Anthony,-
 
----
 
Confirm Inkscape.dmg is looking good on tiger, congratulations
 
edited Alex's message as a second 'inkscape' is needed ~:" thanks Alex and the team
 
not clear why inkscape is not in fink packages though.
 
Peepo
 
----
Inkscape is in fink's unstable tree. It is not in the binary release because it requires some packages that are not in the stable tree yet.
 
Note that I belive the startup time will improve with Mac OS X 10.4.2
 
Peter
 
(Suggest dividing this page up: The category CompilingMacOsX ought to comprise only instructions for compiling on Mac OS X! -Ben).
 
(Also the material specific to verion 0.40 et cetera should be removed, it is not going to be expected here -Ben)
 
(Arguably Tiger material goes into a new area: 'For thill seekers' or, if Tiger is now mainstream, the whole page is re-organised on that basis, and the Panther material placed somewhere else! -Ben)

Revision as of 17:26, 18 April 2020

Using MacPorts

  1. Download and install MacPorts
  2. Edit the MacPorts variants config (optional).
    Add this line to /opt/local/etc/macports/variants.conf
    -x11 +quartz
  3. In Terminal (Applications>Utilities>Terminal) type
    sudo port install \
         adwaita-icon-theme \
         boehmgc \
         boost \
         cairo \
         ccache \
         cmake \
         double-conversion \
         gdl3 \
         gettext \
         gsl \
         gtkmm3 \
         gtk-osx-application-gtk3 \
         lcms2 \
         libsoup \
         libxslt \
         ninja \
         poppler \
         potrace \
         py-lxml \
         py-numpy \
         -x11 +quartz
    
  4. In Terminal, get Inkscape
    git clone --recurse-submodules https://gitlab.com/inkscape/inkscape.git
    
  5. And build inkscape
    # use a clean MacPorts environment (optional)
    LIBPREFIX="/opt/local"
    export PATH="$LIBPREFIX/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    
    # where to install
    PREFIX="$PWD/install-prefix"
    
    # where to build
    mkdir build
    cd build
    
    cmake \
        -G Ninja \
        -DCMAKE_PREFIX_PATH="$LIBPREFIX" \
        -DCMAKE_INSTALL_PREFIX="$PREFIX" \
        -DCMAKE_C_COMPILER_LAUNCHER=ccache \
        -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
        -DWITH_OPENMP=OFF \
        ..
    
    ninja
    ninja install
    

    Note: Using ccache and ninja is not required, but very common because it speeds up compilation.

  6. Run Inkscape
    $PREFIX/bin/inkscape
    

Using Homebrew

If you are using Homebrew instead, you can still use the above guidelines with small modifications.

List of packages to install with brew

brew install \
    adwaita-icon-theme \
    bdw-gc \
    boost \
    cairomm \
    ccache \
    cmake \
    double-conversion \
    gdl \
    gettext \
    graphicsmagick \
    gsl \
    gtk-mac-integration \
    gtkmm3 \
    gtkspell3 \
    imagemagick \
    intltool \
    lcms2 \
    libsoup \
    libsvg-cairo \
    libxslt \
    ninja \
    poppler \
    potrace

Since Homebrew only offers gettext as a keg (not linked to /usr/local) an extra option needs to be passed on to cmake.

Modify the script in step 5 by changing LIBPREFIX="/usr/local" and adding the following line to the cmake arguments:

    -DIntl_INCLUDE_DIR="/usr/local/opt/gettext/include" \

See also