C言語:入門しない入門:文房具としての開発環境。たった1行で解決するGCCコンパイル。特に、ncurses

消しゴム、ボールペン感覚で C言語を使う

事実上、sudo apt-get install gcc なんて不要になっていますね。

さて、今や開発しない人にとっても、gccは意識しなくても常備薬、文房具レベルで必須のものです。知らないうちに仕事してくれています。

ごくたまに好みのツールの最新版をコンパイルしてみたいという希望が湧く場合もあるでしょう。そういう時にはgcc開発環境が必要です。最新版をコンパイルするついでに、ちょっとだけメッセージを日本語にして使ってみたり、オプション指定文字列を変えてみたり、わがままに使うには必需品なのです。その前にライブラリをいれてとか。消しゴムを使うのに、消しゴムを購入しに文具店にいったりするようなものです。ばかげています。そう思うカジュアルなユーザー向けに、本稿は書かれています。

そうです。おおざっぱに使いたいのに、configure に応じて、ライブラリを足していったりめんどうこの上なし。エラーメッセージだけだと検索しても容易に必要なライブラリ名に辿りつけなかったりするケースがあります。ゼロ知識ベースなので。

ライブラリ名に辿り着いただけでは終わりではありません。なぜか一挙に入れてくれないのです。ググってもわからないので野生の勘で考えます。専門知識があれば別なのでしょうが、私には一切ありません。

話は打ち切って、結論。以下を食わせるとたいていのCUIアプリはコンパイルできます。たぶんです。何も考える必要はありません。そう、こういうことを教えてほしいです。何も考えずにコンピューターは使いたいのです。だから自分で書いておきます。ニーズ、ウォンツは多様なので仕方ないといえば仕方ない話ではあります。

引き継いて使ってきたGCCのライブラリリストを掲示します。

昔、職業プログラマーの友達が私にいいました。「全ライブラリを指定していれてしまう」。これも賢い方法なのかもしれません。私は別のクレバーを目指したいので、もう少しだけミニマムに。これ以外のライブラリは容易にインストールできるので除外しています。必要に応じて導入してください。

"覚えておくと色々重宝する、dpkg --get/set-selections" で導入します。または、

sudo apt-get install lib32ncurses5-dev lib32ncursesw5-dev .....長い

つまり、

sudo apt-get install lib32ncurses5 lib32ncurses5-dev lib32ncursesw5 lib32ncursesw5-dev lib64ncurses5 libcunit1-ncurses libcunit1-ncurses-dev libncurses5:amd64 libncurses5:i386 libncurses5-dev:amd64 libncurses5-dev:i386 libncursesw5:amd64 libncursesw5:i386 libncursesw5-dev:amd64 libx32ncurses5 libx32ncurses5-dev libx32ncursesw5 ncurses-base ncurses-bin ncurses-term
と1行で終わります。


ncurses 20個 これで揃う版リスト

lib32ncurses5 install
lib32ncurses5-dev install
lib32ncursesw5 install
lib32ncursesw5-dev install
lib64ncurses5 install
libcunit1-ncurses install
libcunit1-ncurses-dev install
libncurses5:amd64 install
libncurses5:i386 install
libncurses5-dev:amd64 install
libncurses5-dev:i386 install
libncursesw5:amd64 install
libncursesw5:i386 install
libncursesw5-dev:amd64 install
libx32ncurses5 install
libx32ncurses5-dev install
libx32ncursesw5 install
ncurses-base install
ncurses-bin install
ncurses-term install


ライブラリ関係 一式 232個 大雑把版リスト(参考) 末尾に1行install コマンド

autotools-dev install
comerr-dev install
devscripts install
dpkg-dev install
gir1.2-gudev-1.0 install
icu-devtools install
ideviceinstaller install
krb5-multidev install
lib32gcc-4.8-dev install
lib32ncurses5-dev install
lib32ncursesw5-dev install
lib32tinfo-dev install
libart-2.0-dev install
libatk-bridge2.0-dev:amd64 install
libatk1.0-dev install
libatkmm-1.6-dev:amd64 install
libavahi-client-dev install
libavahi-common-dev install
libavahi-glib-dev install
libavdevice53:amd64 install
libavutil-dev:amd64 install
libbluetooth-dev install
libbonobo2-dev:amd64 install
libbonoboui2-dev:amd64 install
libbz2-dev:amd64 install
libc-dev-bin install
libc6-dev:amd64 install
libc6-dev:i386 install
libc6-dev-i386 install
libc6-dev-x32 install
libcairo2-dev install
libcairomm-1.0-dev:amd64 install
libcanberra-dev:amd64 install
libcunit1-ncurses-dev install
libcups2-dev install
libcxx-gtk-utils-dev:amd64 install
libdbus-1-dev:amd64 install
libdbus-glib-1-dev install
libdbusmenu-glib-dev:amd64 install
libdecoration0-dev install
libdevmapper-event1.02.1:amd64 install
libdevmapper1.02.1:amd64 install
libdjvulibre-dev:amd64 install
libdrm-dev:amd64 install
libegl1-mesa-dev install
libexif-dev install
libexpat1-dev:amd64 install
libflac-dev:amd64 install
libfontconfig1-dev install
libfreetype6-dev install
libfribidi-dev install
libfuse-dev install
libgail-dev install
libgcc-4.8-dev:amd64 install
libgcc-4.8-dev:i386 install
libgconf2-dev install
libgcroots-dev install
libgcrypt11-dev install
libgdk-pixbuf2.0-dev install
libgl1-mesa-dev install
libglade2-dev:amd64 install
libglade2.0-cil-dev install
libglademm-2.4-dev install
libgladeui-1-dev install
libgles2-mesa-dev install
libglib2.0-cil-dev install
libglib2.0-dev install
libglibmm-2.4-dev:amd64 install
libglu1-mesa-dev install
libgmp-dev:amd64 install
libgnome-keyring-dev install
libgnome2-dev:amd64 install
libgnomecanvas2-dev:amd64 install
libgnomeui-dev:amd64 install
libgnomevfs2-dev:amd64 install
libgnustep-base-dev install
libgnutls-dev install
libgpg-error-dev install
libgraphviz-dev install
libgtk-3-dev install
libgtk2.0-cil-dev install
libgtk2.0-dev install
libgtkmm-2.4-dev:amd64 install
libgudev-1.0-0:amd64 install
libgudev-1.0-0:i386 install
libgudev1.0-cil install
libharfbuzz-dev install
libibus-1.0-dev install
libice-dev:amd64 install
libicu-dev:amd64 install
libid3tag0-dev install
libidl-dev:amd64 install
libido3-0.1-dev install
libilmbase-dev install
libimobiledevice-utils install
libimobiledevice4:amd64 install
libindicate-dev install
libindicate-gtk3-dev install
libjasper-dev install
libjavascriptcoregtk-3.0-dev install
libjbig-dev:amd64 install
libjpeg-dev:amd64 install
libjpeg-turbo8-dev:amd64 install
libjpeg8-dev:amd64 install
libjson-glib-dev install
libkrb5-dev install
liblcms2-dev:amd64 install
liblqr-1-0-dev install
libltdl-dev:amd64 install
liblzma-dev:amd64 install
libmagickcore-dev install
libmagickwand-dev install
libmirclient-dev:amd64 install
libmirprotobuf-dev:amd64 install
libmtdev1:amd64 install
libncurses5-dev:amd64 install
libncurses5-dev:i386 install
libncursesw5-dev:amd64 install
libobjc-4.8-dev:amd64 install
libogg-dev:amd64 install
libopenexr-dev install
liborbit2-dev install
libp11-kit-dev install
libpango1.0-dev install
libpangomm-1.4-dev:amd64 install
libpcre3-dev:amd64 install
libpixman-1-dev install
libpng12-dev install
libpopt-dev:amd64 install
libprotobuf-dev:amd64 install
libpthread-stubs0-dev:amd64 install
libpython-dev:amd64 install
libpython2.7-dev:amd64 install
libqt4-dev install
libqt4-dev-bin install
libqt5opengl5-dev:amd64 install
libqt5svg5-dev install
libqt5x11extras5-dev install
librsvg2-dev install
libselinux1-dev:amd64 install
libsepol1-dev install
libsigc++-2.0-dev:amd64 install
libsm-dev:amd64 install
libsoup2.4-dev install
libsqlite3-dev:amd64 install
libssl-dev:amd64 install
libstdc++-4.8-dev:amd64 install
libtasn1-6-dev install
libtiff5-dev:amd64 install
libtimezonemap1-dev install
libtinfo-dev:amd64 install
libtinfo-dev:i386 install
libudev1:amd64 install
libudev1:i386 install
libuim-dev:amd64 install
libusb-dev install
libvorbis-dev:amd64 install
libwayland-dev install
libwebkit2gtk-3.0-dev install
libwebkitgtk-3.0-dev install
libwebkitgtk-common-dev install
libwmf-dev install
libx11-dev:amd64 install
libx11-xcb-dev:amd64 install
libx32ncurses5-dev install
libx32tinfo-dev install
libxau-dev:amd64 install
libxcb-dri2-0-dev:amd64 install
libxcb-dri3-dev:amd64 install
libxcb-glx0-dev:amd64 install
libxcb-present-dev:amd64 install
libxcb-randr0-dev:amd64 install
libxcb-render0-dev:amd64 install
libxcb-shape0-dev:amd64 install
libxcb-shm0-dev:amd64 install
libxcb-sync-dev:amd64 install
libxcb-xfixes0-dev:amd64 install
libxcb1-dev:amd64 install
libxcomposite-dev install
libxcursor-dev:amd64 install
libxdamage-dev:amd64 install
libxdmcp-dev:amd64 install
libxext-dev:amd64 install
libxfixes-dev:amd64 install
libxft-dev install
libxi-dev install
libxinerama-dev:amd64 install
libxkbcommon-dev install
libxml2-dev:amd64 install
libxpm-dev:amd64 install
libxrandr-dev:amd64 install
libxrender-dev:amd64 install
libxshmfence-dev:amd64 install
libxt-dev:amd64 install
libxxf86vm-dev:amd64 install
libzinnia-dev install
linux-libc-dev:amd64 install
linux-libc-dev:i386 install
makedev install
manpages-dev install
manpages-ja-dev install
mesa-common-dev install
mircommon-dev:amd64 install
python-dbus-dev install
python-dev install
python2.7-dev install
qt4-dev-tools install
qtbase5-dev:amd64 install
qtbase5-dev-tools install
qtdeclarative5-dev install
qttools5-dev-tools install
ruby-dev install
ruby1.9.1-dev install
system-config-printer-udev install
udev install
x11proto-composite-dev install
x11proto-core-dev install
x11proto-damage-dev install
x11proto-dri2-dev install
x11proto-fixes-dev install
x11proto-gl-dev install
x11proto-input-dev install
x11proto-kb-dev install
x11proto-randr-dev install
x11proto-render-dev install
x11proto-xext-dev install
x11proto-xf86vidmode-dev install
x11proto-xinerama-dev install
xserver-xorg-input-evdev install
xserver-xorg-video-fbdev install
xtrans-dev install
zlib1g-dev:amd64 install

sudo apt-get install autotools-dev comerr-dev devscripts dpkg-dev gir1.2-gudev-1.0 icu-devtools ideviceinstaller krb5-multidev lib32gcc-4.8-dev lib32ncurses5-dev lib32ncursesw5-dev lib32tinfo-dev libart-2.0-dev libatk-bridge2.0-dev:amd64 libatk1.0-dev libatkmm-1.6-dev:amd64 libavahi-client-dev libavahi-common-dev libavahi-glib-dev libavdevice53:amd64 libavutil-dev:amd64 libbluetooth-dev libbonobo2-dev:amd64 libbonoboui2-dev:amd64 libbz2-dev:amd64 libc-dev-bin libc6-dev:amd64 libc6-dev:i386 libc6-dev-i386 libc6-dev-x32 libcairo2-dev libcairomm-1.0-dev:amd64 libcanberra-dev:amd64 libcunit1-ncurses-dev libcups2-dev libcxx-gtk-utils-dev:amd64 libdbus-1-dev:amd64 libdbus-glib-1-dev libdbusmenu-glib-dev:amd64 libdecoration0-dev libdevmapper-event1.02.1:amd64 libdevmapper1.02.1:amd64 libdjvulibre-dev:amd64 libdrm-dev:amd64 libegl1-mesa-dev libexif-dev libexpat1-dev:amd64 libflac-dev:amd64 libfontconfig1-dev libfreetype6-dev libfribidi-dev libfuse-dev libgail-dev libgcc-4.8-dev:amd64 libgcc-4.8-dev:i386 libgconf2-dev libgcroots-dev libgcrypt11-dev libgdk-pixbuf2.0-dev libgl1-mesa-dev libglade2-dev:amd64 libglade2.0-cil-dev libglademm-2.4-dev libgladeui-1-dev libgles2-mesa-dev libglib2.0-cil-dev libglib2.0-dev libglibmm-2.4-dev:amd64 libglu1-mesa-dev libgmp-dev:amd64 libgnome-keyring-dev libgnome2-dev:amd64 libgnomecanvas2-dev:amd64 libgnomeui-dev:amd64 libgnomevfs2-dev:amd64 libgnustep-base-dev libgnutls-dev libgpg-error-dev libgraphviz-dev libgtk-3-dev libgtk2.0-cil-dev libgtk2.0-dev libgtkmm-2.4-dev:amd64 libgudev-1.0-0:amd64 libgudev-1.0-0:i386 libgudev1.0-cil libharfbuzz-dev libibus-1.0-dev libice-dev:amd64 libicu-dev:amd64 libid3tag0-dev libidl-dev:amd64 libido3-0.1-dev libilmbase-dev libimobiledevice-utils libimobiledevice4:amd64 libindicate-dev libindicate-gtk3-dev libjasper-dev libjavascriptcoregtk-3.0-dev libjbig-dev:amd64 libjpeg-dev:amd64 libjpeg-turbo8-dev:amd64 libjpeg8-dev:amd64 libjson-glib-dev libkrb5-dev liblcms2-dev:amd64 liblqr-1-0-dev libltdl-dev:amd64 liblzma-dev:amd64 libmagickcore-dev libmagickwand-dev libmirclient-dev:amd64 libmirprotobuf-dev:amd64 libmtdev1:amd64 libncurses5-dev:amd64 libncurses5-dev:i386 libncursesw5-dev:amd64 libobjc-4.8-dev:amd64 libogg-dev:amd64 libopenexr-dev liborbit2-dev libp11-kit-dev libpango1.0-dev libpangomm-1.4-dev:amd64 libpcre3-dev:amd64 libpixman-1-dev libpng12-dev libpopt-dev:amd64 libprotobuf-dev:amd64 libpthread-stubs0-dev:amd64 libpython-dev:amd64 libpython2.7-dev:amd64 libqt4-dev libqt4-dev-bin libqt5opengl5-dev:amd64 libqt5svg5-dev libqt5x11extras5-dev librsvg2-dev libselinux1-dev:amd64 libsepol1-dev libsigc++-2.0-dev:amd64 libsm-dev:amd64 libsoup2.4-dev libsqlite3-dev:amd64 libssl-dev:amd64 libstdc++-4.8-dev:amd64 libtasn1-6-dev libtiff5-dev:amd64 libtimezonemap1-dev libtinfo-dev:amd64 libtinfo-dev:i386 libudev1:amd64 libudev1:i386 libuim-dev:amd64 libusb-dev libvorbis-dev:amd64 libwayland-dev libwebkit2gtk-3.0-dev libwebkitgtk-3.0-dev libwebkitgtk-common-dev libwmf-dev libx11-dev:amd64 libx11-xcb-dev:amd64 libx32ncurses5-dev libx32tinfo-dev libxau-dev:amd64 libxcb-dri2-0-dev:amd64 libxcb-dri3-dev:amd64 libxcb-glx0-dev:amd64 libxcb-present-dev:amd64 libxcb-randr0-dev:amd64 libxcb-render0-dev:amd64 libxcb-shape0-dev:amd64 libxcb-shm0-dev:amd64 libxcb-sync-dev:amd64 libxcb-xfixes0-dev:amd64 libxcb1-dev:amd64 libxcomposite-dev libxcursor-dev:amd64 libxdamage-dev:amd64 libxdmcp-dev:amd64 libxext-dev:amd64 libxfixes-dev:amd64 libxft-dev libxi-dev libxinerama-dev:amd64 libxkbcommon-dev libxml2-dev:amd64 libxpm-dev:amd64 libxrandr-dev:amd64 libxrender-dev:amd64 libxshmfence-dev:amd64 libxt-dev:amd64 libxxf86vm-dev:amd64 libzinnia-dev linux-libc-dev:amd64 linux-libc-dev:i386 makedev manpages-dev manpages-ja-dev mesa-common-dev mircommon-dev:amd64 python-dbus-dev python-dev python2.7-dev qt4-dev-tools qtbase5-dev:amd64 qtbase5-dev-tools qtdeclarative5-dev qttools5-dev-tools ruby-dev ruby1.9.1-dev system-config-printer-udev udev x11proto-composite-dev x11proto-core-dev x11proto-damage-dev x11proto-dri2-dev x11proto-fixes-dev x11proto-gl-dev x11proto-input-dev x11proto-kb-dev x11proto-randr-dev x11proto-render-dev x11proto-xext-dev x11proto-xf86vidmode-dev x11proto-xinerama-dev xserver-xorg-input-evdev xserver-xorg-video-fbdev xtrans-dev zlib1g-dev:amd64


おまけ:必要容量はどう考えるのか。パーティションの圧迫


SSDに限定していえば、/(25GB)と/homeを別スライスにしているメイン環境で、/は、25GB中13GBの使用量です。著名?アプリははいっています。Linuxは小さいですね。もっと小さく20GB位でもいいのかも。とはいえ、先日まで20GBを超えていました。

今はいろいろダイエットしています。/tmp が大型ゴミだらけだったのです。/homeは、50GB ほど確保しています。パーティション変更ですこしづつ大きくなりました(gparted)。