在Linux上安装和编译GNUstep

Ubuntu安装GNUstep (Objective-C 2.0) 在Ubuntu系统上配置Objective-C 2.0环境 阅读详情
 In Installing and Using GNUstep and Objective-C on Linux, we covered the steps involved in installing the GNUstep environment on Linux distributions for which pre-built GNUstep packages are available. Unfortunately, very few Linux distributions have pre-built packages available making it necessary download and build the GNUstep sources on most systems.

The purpose of this chapter of Objective-C 2.0 Essentials is to outline the steps necessary to download and build the GNUstep sources. The process outlined here is known to work on Fedora, Red Hat Enterprise Linux and CentOS. The steps should be largely similar for other Linux distributions, though the exact command to perform package installations may differ from the one used here. For details on how to install specific packages for your chosen Linux distribution it may be necessary to refer to the corresponding documentation.

Contents

[hide]
Installing gcc and Objective-C Support on Linux

The first step in the build process is to install gcc together with the gcc Objective-C package. These packages are calledgcc and gcc-obj respectively and on Red Hat, Fedora and CentOS systems may be installed as follows:

su - 
yum install gcc
yum install gcc-objc

Once installed, the next step is to resolve some additional package dependencies.

Package Dependencies

A Linux distribution is essentially a Linux kernel and a range of packages. Each distribution consists of a vast array of packages, many of which are not installed by default when the operating system is first installed. The idea behind this is to keep the size of the installed operating system to a minimum, encouraging users to only install a package when they actually need it. Consequently, there are many packages upon which GNUstep is dependent that are not installed by default on most Linux systems. Before we can embark on a GNUstep environment build, therefore, it is necessary to install these package dependencies. Fortunately, these can be installed using a single command:

yum install make libpng libpng-devel libtiff libtiff-devel libobjc libxml2 libxml2-devel 
                libX11-devel libXt-devel libjpeg libjpeg-devel

Keep in mind that some of these packages may already be installed, in which case the package manager will simply move on to the next package. In addition, many of these packages will have dependencies of their own which will be added to the installation process automatically.

Once the packages are installed we are ready to download the GNUstep source code.

Obtaining the GNUstep Source Code

The GNUstep core consists of the following packages:

  • GNUstep Make
  • GNUstep Base
  • GNUstep GUI
  • GNUstep Backend

Each of these packages needs to be built and installed on your Linux system in order to gain access to the full power of Objective-C and to be able to work with the examples in the remainder of this book. Fortunately a single package calledGNUstep Startup is provided that contains the source code for all four of the above packages. This package can be downloaded from theGNUstep.org website download page. Be sure to download the latest stable release of theGNUstep Startup software.

Once the package has been downloaded to a suitable work folder it can be unpacked as follows (where <version> is replaced by the version number of the package you downloaded):

tar xvfz gnustep-startup-<version>.tar.gz

The source files will be unpacked into a new directory named gnustep-startup-<version> (once again substituting <version> for the version you downloaded). Change directory into this folder as follows:

cd gnustep-startup-<version>

Configuring the Build Process

Before the build process can be started it must first be configured. This is an automated process that scans the system on which the build is to take place to find out about the packages that are installed and then creates a build configuration file and a Makefile. This configuration is performed by executing the following command in the GNUstep directory created in the previous section of this chapter:

./configure

Building GNUstep

Once the configuration script process is complete it is time to begin the GNUstep build. This is achieved by typing the following command:

make

Once executed, the build process will display an opening message similar to the following:

GNUstep Installation


     This is an automatic installation script for GNUstep.

This script tries to build and install the core libraries for
GNUstep. Log files of the build process are kept so that if some
part of the build does not work, you can send the log files to
our attention (at bug-gnustep@gnu.org). From these we can try to
determine what the problem is.


Press the Return key to begin continue:

Press any key to continue to the system check phase. At the end of this phase a list of errors and warnings may appear. Any errors will prevent the build from completing and should be addressed before proceeding. These typically involve installation of missing packages. Warnings can usually be ignored without impacting the subsequent build process.

Having reviewed the information provided, press any key to return to the build. The duration of the build will depend on the speed of the system but will usually be completed within a few minutes and display a message containing information some useful information:

---------------------------------------------------------

Installation Finished

---------------------------------------------------------

Now run the GNUstep initialization script (put this in your
.bashrc or other type of startup script). Note the '.' at the
beginning of the line.
. /usr/GNUstep/System/Library/Makefiles/GNUstep.sh

Now you can install some applications and start using GNUstep
Look for a few applications in the AppSources directory. The
typical way to install an application is:
  tar -zxf MyApplication.tar.gz
  cd MyApplication
  make
  make install (as root, unless GNUstep is in your home dir)

Then start the application:
  openapp MyApplication.app

Perhaps the most important piece of information in the above output is the reference to theGNUstep initialization script. This must be run prior to compiling any Objective-C applications and can be placed in the .bashrc startup script in your home directory. Make a note of the location listed in the message on your screen as the exact location may differ from the one shown above.

Testing the Objective-C and GNUstep Installation

Once the installation is complete, it can be tested by opening your favorite editor (if you don't have a favorite try GEdit by selecting Applications->Accessories->Text Editor) and entering some Objective-C code:

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{
        NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

        NSLog (@"hello world");
        [pool drain];
        return 0;
}

Objective-C source files have a .m file name extension, so save the file ashello.m in a suitable folder such that you will be able to locate the file in the next section.

Compiling Objective-C Code

Before an Objective-C program can be run it must first be compiled. Compilation is a process whereby the human readable Objective-C code in the source file (in our case hello.m) is converted to the machine code understood by the CPU. Prior to performing this compilation, however, the GNUstep environment must first be set up by executing theGNUstep.sh, the location of which was provided at the end of the installation process. Execute this script exactly as outlined in the installation message, for example:

. /usr/GNUstep/System/Library/Makefiles/GNUstep.sh

Failure to execute this script prior to compiling Objective-C code in a Terminal window will result in the compiler reporting errors similar to the following:

error: cannot find interface declaration for ‘NXConstantString’

From within a Terminal window change directory to the where you saved the hello.m source file and execute the following command to compile it:

gcc `gnustep-config --objc-flags` -L/usr/GNUstep/Local/Library/Libraries -lgnustep-base hello.m -o hello

If all goes well, the compilation should complete silently and the test application is ready to run. The program may be executed as follows:

./hello

Executing the program will result in output similar to the following:

2009-09-15 10:48:39.772 prog1[12906] hello world

Assuming you see output similar to the above example, Objective-C and GNUstep are successfully installed on your Linux system and you are ready to continue with the remainder of this book.

Linux中用Makefile编译Objective-c 1、安装GNUstep     sudo apt-get install build-essential     sudo apt-get install gobjc     sudo apt-get install gobjc++     sudo apt-get install gnustep-devel 如果你想一下子把GNUstep的东西都装上,一句sudo apt-get in 阅读详情

相关推荐

GNUStep入门教程(中文)

簡單來說, GNUstep 是實作 OpenStep 介面的開放軟體 (Open Source) 計劃, 目標為提供跨平台的物件導向程式開發環境. 早在 1985 年, Steve Jobs 離開蘋果電腦 (Apple) 後成立了 NeXT 公司, 並於 1988 年推出了 NeXT 電腦, 使用 NeXTStep 為作業系統. 在當時, NeXTStep 是相當先進的系統. 以 Unix (BSD) 為基礎, 使用 PostScript 提供高品質的使用者圖形介面, 並以 Objective-C 語言提供完整的物件導向環境. 儘管 NeXT 在軟體上的優異, 其硬體銷售成績不佳, 不久之後, NeXT 便轉型為軟體公司. 1994 年, NeXT 與昇陽 (Sun Microsystem) 合作推出 OpenStep 介面, 目標為跨平台的物件導向程式開發環境. NeXT 接著推出實作 OpenStep 介面的 OPENSTEP 系統, 可在 Mach, Microsoft Windows NT, Sun Solaris 及 HP/UX 上執行. 1996 年, 蘋果電腦買下 NeXT, 做為蘋果電腦下一代作業系統的基礎, OPENSTEP 系統便演進成為 MacOS X 的 Cocoa 環境. 在 1995 年, 自由軟體基金會 (Free Software Fundation) 開始了 GNUstep 計劃, 目的在實作 OpenStep 介面, 以提供 Linux/BSD 系統一個完整的程式發展環境. 但由於 OpenStep 介面過於龐大, 開發人力不足, 及許多技術在當時尚未成熟 (如 Display PostScript), 所以直到目前為止, GNUstep 才算是一個完整的程式開發環境. 儘管 OpenStep 早在 1994 年便提出, 其介面及架構在現今仍相當先進及實用, 使得開發 GNUstep 程式相當容易. GNUstep 使用 Objective-C 語言, 是 C 語言加上 SmallTalk 的物件導向的功能. 結合兩者的優點, 又不至於像 C++ 如此複雜. GNUstep 提供兩個主要的程式庫, Foundation 及 AppKit. Foundation 處理非圖形介面的部份, 如字串, 檔案, 網路, 基本資料結構, 多行緒等, 又稱之為 GNUstep Base. AppKit 則處理圖形介面的部份, 包含視窗, 使用者介面等, 又稱之為 GNUstep GUI. 由於 GNUstep 具有跨平台的特性, 有關繪圖及字型的部份, 則交由 GNUstep Back 來處理. 使用者可依所使用的作業系統, 選擇適當的後端處理 (Backend). GNUstep GUI 會自行處理與 Back 相關的功能, 程式開發者只要使用 GUI 程式庫, 便可適用於各種後端上, 完全不用考慮平台問題. 目前 GNU GCC 3.x 支援 Objective-C 語言, GNUstep 則提供 GNUstep Make 來簡化編譯 Objective-C 程式. GNUstep Make 提供類似 Makefile 的功能, 稱為 GNUmakefile. 與 Makefile 相比較之下 GNUmakefile 簡單許多.

VMWare 安装CentOS停在installing vmware tools,please wait......

原因: 安装顺序错误 解决: 这一步选择如下 直到点击“完成”后,进行编辑虚拟机设置,选择下载的centOS资源 确定后,开启虚拟机,进行安装

puhuihui的博客 958

【深度学习】肺结节分割项目实战二:分割肺实质

在后续训练模型的时候如果直接使用原始的肺部CT图像,其中的非肺区域会对训练造成干扰,因此我们需要提取分割肺实质。这一部分参考了kaggle上的教程。 从这张CT图像中可以看出扫描器以外的部分为黑色,背景和肺内部颜色较深,非肺组织和骨头颜色较浅。我们的目的是将肺部分割出来。由于肺部区域和其他部分对比明显,我们可以设置一个合适的阈值对图像中的区域进行隔离。 import argparse import os import numpy as np from medpy.filter.smoothing imp

weixin_42182906的博客 7240

安装vissim4.3,显示Installing Plug-Ins,please wait

本文介绍了在安装vissim4.3时遇到Installing Plug-Ins,please wait问题的解决办法。

乐观的lishan的博客 5926

用AI画电路板AI EDA初探Creating WiFi Radio with CELUS: A Step-by-Step Tutorial 使用CELU.IO创建WiFi收音机:分步教程

结论:整体还不太成熟,所选器件单元是欧美思维,器件选型成本和咱们华强北还是无法比。可以关注迭代,看客就当走马观花就行了;不过里面的单元模块还带有AI提问的这个比较好,值得国内EDA从业者学习。话不多说上正文:本教程目的是让我们深入了解如何使用CELUS设计平台构建WiFi收音机实战项目。本指南的重点是使用该平台来选择正确的解决方案,并整合一个项目,让您可以将音乐和节目从互联网直接传输到您自己构建的扬声器。

2301_81235726的博客 1万+

用ESP32-S3+OV2640摄像头+ILI9488屏,DIY一个能联网的智能猫眼(附完整代码)

本文详细介绍了如何利用ESP32-S3微控制器搭配OV2640摄像头和ILI9488显示屏,DIY一个功能强大的智能猫眼系统。从硬件选型、电路设计到软件开发,提供了完整的解决方案和优化技巧,包括图像采集显示、WiFi远程访问及低功耗设计,适合智能家居爱好者动手实践。

weixin_30897233的博客 501

OpenStack iaas-pre-host.sh

#/bin/bash source /etc/xiandian/openrc.sh # config env network systemctl stop firewalld.service systemctl disable firewalld.service >> /dev/null 2>&1 systemctl stop NetworkManager >...

热气球 3880

PostgreSQL14 离线安装全攻略:从下载到配置详解

本文详细介绍了PostgreSQL14在无网络环境下的离线安装全流程,涵盖RPM包与源码编译两种主流方法。文章重点解析了安装前的系统环境检查、依赖包准备、数据库初始化、远程访问配置以及安装后的关键检查与性能调优,旨在帮助运维和开发人员在离线服务器上高效、稳定地部署PostgreSQL14数据库。

p5l2m9n4o6q的博客 709

linux gnustep,Cent OS Objective-C:GCC+GNUstep 配置

第一个错误:E127 ErrorNo X11 libraries/headers were found for compiling GNUstep GUI. You mayhave X11 installed, but not the developer packages, which are requiredfor compiling anything that uses X. If you a...

weixin_29696799的博客 205

手把手教你学AI GPU的UMD驱动软件开发专栏简介

通过本专栏的学习,您将掌握UMD的核心概念、开发环境搭建、API实现、内存管理和同步技术,以及在实际AI场景中的应用。通过本专栏的学习,您将不仅掌握UMD驱动开发的核心技术,还将能够将这些技术应用到实际的AI应用场景中,为您的AI应用提供更高效的硬件加速支持。无论您是想开发自己的AI加速框架,还是希望深入理解现有AI加速库的工作原理,本专栏都将为您提供宝贵的知识和实践经验。:本专栏不仅讲解UMD驱动的核心概念,还通过精心设计的实战案例,引导您从零开始构建UMD驱动,真正掌握AI GPU驱动开发的技能。

MHD0815的博客 113

MIKE水动力笔记8_冷启动与热启动

在【MIKE水动力笔记5_建立水动力模型】中,讲到【Step 2 设置模型参数】中的【Initial Conditions】时,提到了冷启动与热启动。本博文就详细讲解何为冷启动、热启动,并通过一个案例具体分析两者不同。...

晏长街的博客 6568

在Linux上安装和使用GNUstep和Objective-C

The basics of Objective-C are supported by the GNU compiler collection. In order to utilize the full power of Objective-C together with the Cocoa /openStep environments on Linux, and to work with many...

编程代码大全 100

Excel 汉字首字母提取:四种方案对比与选型

本文对比了 Excel 中提取汉字首字母的四种方案:手动转换、VBA 脚本、映射表与 AI 工具。手动方式低效易错;VBA 适合无网环境但识别范围有限;映射表精度提升却无法解决多音字;AI 工具通过语义理解可一句话完成提取,是多数场景下的首选。

u011186532的专栏 395

Linux Object-C 编译环境安装

原文:http://www.techotopia.com/index.php/Installing_and_Using_GNUstep_and_Objective-C_on_Linux sudo apt-get install gnustep sudo apt-get install gnustep-devel sudo apt-get install gobjc . /u

Talents come from diligence 1764

STM32G0/G4电机控制中三角函数与浮点运算优化实战

三角函数(sin/cos)和浮点运算是电机矢量控制(FOC)的核心基础,直接影响Clark/Park变换、SVPWM及观测器的实时性与精度。在资源受限的MCU上,标准math.h库因无硬件FPU支持而引发严重时序抖动,导致电流环延迟、转矩脉动增大甚至系统复位。通过硬件加速(如STM32G4的CORDIC协处理器)或定制化定点算法(如STM32G0的查表+线性插值),可将sin/cos计算从数十微秒压缩至1–3 μs量级,提升30倍以上效率。该方案广泛适用于BLDC/PMSM驱动、伺服控制及高动态响应嵌入式运

weixin_35751412的博客 109

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

在linux环境下的Objective-c程序编译

@font-face { font-family: "Times New Roman"; }@font-face { font-family: "宋体"; }p.p0 { margin: 0pt; text-align: justify; font-size: 10.5pt; font-family: "Times New Roman"; }div.Section0 { page: Section...

weixin_30778805的博客 246

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

在 Ubuntu 中使用 GNUstep 搭建 Objective-C 开发环境

GNUstep 介绍见 http://www.gnustep.org/。 安装相关程序 直接 apt-get install 搞定。 build-essentialgnustepgnustep-develgnustep-examplesgobjcgobjc++ 设置环境变量 为了方便使用 GNUstep 的各种编译工具,需要先在 .bashrc 中导入 GNUstep 的脚本。 #

yuyezhulan的专栏 565

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

在Centos-5下安装Objective-C的编译环境

1. 安装gcc的objc编译功能: $ yum -y install gcc-objc   2. 从http://wwwmain.gnustep.org下载GNUstep Startup和GNUstep Base,并从源码进行安装。   3. 把gnustep tools目录加入到系统目录下(默认是/usr/GNUstep/System/Tools) $ export PATH=$P...

bollaxu的专栏 204

linux objective-c 环境配置与多文件编译

1、安装GNUstep linux环境下编写oc程序,首先需要安装GNUstep ubuntu环境下比较方便,apt-get install gnustep* 当然,我们为了编译oc程序并不需要全部  sudo apt-get install build-essential     sudo apt-get install gobjc     sudo apt-get inst

u011165931的专栏 516

如何在Centos7上搭建Objective-C环境

安装gcc-objc sudo yum install -y gcc-objc 安装依赖包 sudo yum install make libpng libpng-devel libtiff libtiff-devel libobjc libxml2 libxml2-devel libX11-devel libXt-devel libjpeg libjpeg-devel 下载GUNStep组件 本人下载的版本是gnustep-startup-0.32.0.tar.gz # cd ~ # tar xzvf.

走过路过不要错过 527
上一篇: 在Linux上安装和使用GNUstep和Objective-C
下一篇: iOS5编程--官方例子代码研究--5.TableMultiSelect
NickTang
博客等级 码龄24年 261粉丝 49原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值