看板 EE_DSnP 關於我們 聯絡資訊
身為老人來回一下XD GNU/Linux 和 Mac OSX 雖然都是UNIX的作業環境 但是它們的kernel是完全不一樣的系統 Linux是單核心,為潛在的硬體,提供了大量完善的硬體抽象操作。 Mac是微核心,結構由一個非常簡單的硬體抽象層和一組比較關鍵的原語或系統呼叫組成 (後來改成混合核心,但還是比較偏向微核心) 核心詳見 http://zh.wikipedia.org/zh-tw/内核 以不同核心為起點發展出來的bianry,也會不一樣 GNU/Linux, BSD是用ELF http://en.wikipedia.org/wiki/Executable_and_Linkable_Format ELF was designed with the assumption that there would be only one ABI per system architecture. ^^^ 與 kernel 溝通的介面 PS BSD 原本是用 UNIX 最初的a.out binary format 原本ELF是用模擬的方式運行的,但後來Linux太盛行了所以也改用 ELF http://www.freebsd.org/doc/handbook/binary-formats.html Mac OSX是用Mach-O http://en.wikipedia.org/wiki/Mach-O Mach-O 的一個特色是,可以包含不同格式的binary code進去一個檔案 在過去,蘋果有PowerPC-32, PowerPC-64, x86, x86-64等不同的機器 使用Mach-O可以製作fat binary file來讓一個軟體可在不同機器上運行 這歸功於微核心強大的ABI介面 :D Mach-O 還有雙層命名空間的設計 可以避免dynamic library的變數及function打架 The two-level namespace feature of OS X v10.1 and later adds the module name as part of the symbol name of the symbols defined within it. This approach ensures a module’s symbol names don’t conflict with the names used in other modules. To perform special tasks or to provide an enhanced user experience, your application may need to launch other applications or create processes to run command-line tools. To maintain a high degree of interoperability and provide a consistent user experience, your applications should use specific system functions and frameworks to execute processes and launch applications. -- OSX Mach-O programming topics 結論是,如果你要使用Linux的ELF static library 那你就不能編譯 而且我記得當年修課時,termios的相關程式碼要稍微改一些才能在mac上面跑 還是使用linux吧,不要跟開發環境過不去XD -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.136.182.210
XDucka:專業推 11/25 13:27
ypf791:推 11/25 13:52
kaiwen789:專業推!! 感謝學長的回答!!! 11/25 18:36