Я пытаюсь скомпилировать двоичный файл в объектный файл MACH_O, чтобы его можно было связать в dylib. dylib написан на c/c++.
В linux используется следующая команда: ld -r -b binary -o foo.o foo.bin
Я пробовал различные варианты на OSX, но безрезультатно:
ld -r foo.bin -o foo.o
gives:
ld: warning: -arch not specified
ld: warning: ignoring file foo.bin, file was built for unsupported file format which is not the architecture being linked (x86_64)
Создается пустой .o файл
ld -arch x86_64 -r foo.bin -o foo.o
ld: warning: ignoring file foo.bin, file was built for unsupported file format which is not the architecture being linked (x86_64)
Снова создается пустой .o файл. Проверка файлов с помощью nm дает: nm foo.o nm: no name list
Бинарный файл на самом деле является прошивкой, которая будет загружена на внешнее устройство.
Спасибо за внимание