Я пытаюсь создать статический двоичный файл на Subsurface на MacOSX, чтобы мы могли обеспечить простую двоичную загрузку.Я не знаю, как решить проблемы, которые у меня возникают, но это может быть только потому, что я сосу на C.
Вот что я делаю.Я уже установил gconf и gtk2 из MacPorts , и я строю без libusb для простоты:
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"
Результат таков:
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
СейчасЕсли я перейду по ссылке /usr/lib/crt0.o в /usr/lib/crt1.o, я получу это вместо:
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
И если вместо этого я создам libdivecomputer и подповерхность с "-arch i686", Я получаю это:
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
Я на MacOSX Lion с XCode 4.2.1.