0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【ns2-2.35】をUbuntu16.04にインストールする時のエラーの解決

Last updated at Posted at 2019-07-12

こんにちは
これが初投稿となります.

この記事について

ns2-2.35をクリーンなUbuntu16.04にインストールする際に起こりうるエラーについての忘備録です.
基本的にエラーメッセージを理解することができれば,この記事は必要ないでしょう.
初めてNS2やUbuntuに触れる人向けかもしれません.

#Ubuntu 10.04でも確認しました.

起こりうる3つのエラー

インストールコマンドを叩くと,パッケージ不足起因のエラーが2つ,コードの間違い起因のエラーが1つ起こりうる.

  • パッケージ不足
    • libx11が無い
    • xorgが無い
  • コードの間違い

libx11が無い

エラーログ

./ns-allinone-2.35/tk8.5.10/unix/../generic/tk.h:76:23: fatal error: X11/Xlib.h: そのようなファイルやディレクトリはありません
compilation terminated.
make: *** [tk3d.o] エラー 1
tk8.5.10 make failed! Exiting ...
For problems with Tcl/Tk see http://www.scriptics.com

解決策

libx11をインストールする.
ターミナルを開き,下記コマンドを実行する.
apt-getが使えない場合は,代わりにaptを使用する.

$sudo apt-get install libx11-dev

xorgが無い

エラーログ

checking for X11 header files
can't find X includes
otcl-1.14 configuration failed! Exiting ...
Please check http://www.isi.edu/nsnam/ns/ns-problems.html

解決策

xorgをインストールする.
ターミナルを開き,下記コマンドを実行する.

$sudo apt-get install xorg-dev

コードの間違い

公式サイトで配布されているNS2のパッケージは,コードが1箇所間違ったまま配布されているため,修正する必要がある.

エラーログ

linkstate/ls.cc:396:28: required from here
linkstate/ls.h:137:20: error: ‘erase’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
linkstate/ls.h:137:20: note: declarations in dependent base ‘std::map, std::allocator<std::pair > >’ are not found by unqualified lookup
linkstate/ls.h:137:20: note: use ‘this->erase’ instead
make: *** [linkstate/ls.o] エラー 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

解決策

ソースコードの修正を行う.

ns-allinone-2.35/ns-2.35/linkstateにあるls.hをテキストエディタで開く.
137行目付近の

修正前
void eraseAll() { erase(baseMap::begin(), baseMap::end()); }

のeraceの前に
this->
を挿入する.

修正後
void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }

最後に

使い慣れてくるとエラーメッセージの意味もすぐにわかるようになりますが,初めてインストールする時には困ったものでした.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?