Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8722975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:31:26+00:00 2026-06-13T07:31:26+00:00

I am trying to make a static binary on Subsurface on MacOSX, so that

  • 0

I am trying to make a static binary on Subsurface on MacOSX, so that we can provide a simple binary download. I’m clueless as to solve the problems I get, but that might just be because I suck at C.

Here’s what I do. I have already installed gconf and gtk2 from MacPorts, and I’m building without libusb for simplicity:

git clone git://libdivecomputer.git.sourceforge.net/gitroot/libdivecomputer/libdivecomputer
cd libdivecomputer
autoreconf --install
./configure
make LDFLAGS="-static"
sudo make install
cd ..
git clone git://subsurface.hohndel.org/subsurface.git
cd subsurface
make LDFLAGS="-framework CoreFoundation -static"

The result is this:

gcc -framework CoreFoundation -static -o subsurface main.o dive.o profile.o info.o equipment.o divelist.o parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o gtk-gui.o statistics.o macos.o  -L/opt/local/lib -lxml2 -lz -lpthread -liconv -lm -L/opt/local/lib -lxslt -lxml2 -lz -lpthread -liconv -lm -L/opt/local/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangocairo-1.0 -lXext -lXrender -lXinerama -lXi -lXrandr -lXcursor -lXcomposite -lXdamage -lgdk_pixbuf-2.0 -lpangoft2-1.0 -lgio-2.0 -lXfixes -lcairo -lX11 -lpng14 -lpango-1.0 -lm -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl    /usr/local/lib/libdivecomputer.a  -lpthread
/usr/bin/ld_classic: can't locate file for: -lcrt0.o
collect2: ld returned 1 exit status
make: *** [subsurface] Error 1

Now, if I symlink /usr/lib/crt0.o to /usr/lib/crt1.o, I get this instead:

gcc -framework CoreFoundation -static -o subsurface main.o dive.o profile.o info.o equipment.o divelist.o parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o gtk-gui.o statistics.o macos.o  -L/opt/local/lib -lxml2 -lz -lpthread -liconv -lm -L/opt/local/lib -lxslt -lxml2 -lz -lpthread -liconv -lm -L/opt/local/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangocairo-1.0 -lXext -lXrender -lXinerama -lXi -lXrandr -lXcursor -lXcomposite -lXdamage -lgdk_pixbuf-2.0 -lpangoft2-1.0 -lgio-2.0 -lXfixes -lcairo -lX11 -lpng14 -lpango-1.0 -lm -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl    /usr/local/lib/libdivecomputer.a  -lpthread
ld: warning: ignoring file /usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/libgcc_static.a, file was built for archive which is not the architecture being linked (x86_64)
ld: warning: unexpected dylib (/System/Library/Frameworks//CoreFoundation.framework/CoreFoundation) on link line
ld: warning: unexpected dylib (/opt/local/lib/libxml2.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libz.dylib) on link line
ld: warning: unexpected dylib (/usr/lib/libpthread.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libiconv.dylib) on link line
ld: warning: unexpected dylib (/usr/lib/libm.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libxslt.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libgtk-x11-2.0.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libgdk-x11-2.0.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libatk-1.0.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libpangocairo-1.0.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libXext.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libXrender.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libXinerama.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libXi.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libXrandr.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libXcursor.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libXcomposite.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libXdamage.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libgdk_pixbuf-2.0.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libpangoft2-1.0.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libgio-2.0.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libXfixes.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libcairo.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libX11.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libpng14.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libpango-1.0.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libfreetype.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libfontconfig.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libgobject-2.0.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libgmodule-2.0.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libgthread-2.0.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libglib-2.0.dylib) on link line
ld: warning: unexpected dylib (/opt/local/lib/libintl.dylib) on link line
Assertion failed: (_pointerLocations.size() == 0), function size, file /SourceCache/ld64/ld64-123.2.1/src/ld/LinkEditClassic.hpp, line 961.
0  0x10226171c  __assert_rtn + 76
1  0x1023233f5  ld::tool::ExternalRelocationsAtom<x86_64>::size() const + 149
2  0x1022d8a17  ld::tool::OutputFile::updateLINKEDITAddresses(ld::Internal&) + 583
3  0x1022d1aae  ld::tool::OutputFile::write(ld::Internal&) + 142
4  0x102261caa  main + 1178
5  0x1022502b4  start + 52
collect2: ld returned 1 exit status
make: *** [subsurface] Error 1

And if I build libdivecomputer and subsurface with “-arch i686” instead, I get this:

gcc -framework CoreFoundation -arch i686 -static -o subsurface main.o dive.o profile.o info.o equipment.o divelist.o parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o gtk-gui.o statistics.o macos.o  -L/opt/local/lib -lxml2 -lz -lpthread -liconv -lm -L/opt/local/lib -lxslt -lxml2 -lz -lpthread -liconv -lm -L/opt/local/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangocairo-1.0 -lXext -lXrender -lXinerama -lXi -lXrandr -lXcursor -lXcomposite -lXdamage -lgdk_pixbuf-2.0 -lpangoft2-1.0 -lgio-2.0 -lXfixes -lcairo -lX11 -lpng14 -lpango-1.0 -lm -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl    /usr/local/lib/libdivecomputer.a  -lpthread
/usr/bin/ld_classic: /usr/lib/crt0.o incompatible, file contains unsupported type of section 2 (__IMPORT,__pointers) in load command 0 (must specify "-dynamic" to be used)
/usr/bin/ld_classic: incompatible flag -framework used (must specify "-dynamic" to be used)
collect2: ld returned 1 exit status
make: *** [subsurface] Error 1

I’m on MacOSX Lion with XCode 4.2.1.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:31:27+00:00Added an answer on June 13, 2026 at 7:31 am

    The solution was not to build this thing statically, but to include the libraries in the .app bundle. Both the binary and the library needed to be updated with install_name_tool to use relative paths:

    $ otool -L subsurface
    subsurface:
        /opt/local/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.8.0)
        /opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.7)
        ...
    $ install_name_tool -change /opt/local/lib/libxml2.2.dylib \
      @executable_path/../Resources/lib/libxml2.2.dylib subsurface
    $ otool -L subsurface
    subsurface:
        @executable_path/../lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.8.0)
        /opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.7)
        ...
    

    gtk-mac-bundler can be used to automate this process. More details in the Subsurface macosx packaging directory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to make a simple search inside a static HTML page using
I'm trying for a week to make my XSP server work with simple static
We are trying to make all our blocks and pages static so that designer
I am trying to make a cache class that makes url into a static
I'm trying to make it so that users will see the same static URL
I am trying to make a configuration manager class, that can store arbitrary objects
so im trying to make a game with just a simple static background at
I'm trying make an entity with doctrine that has three associations with other entities
I am fairly new to iOS development and trying make a simple app which
Trying to make this jQuery filter that uses .find case-insensitive. For example, when the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.