NS3 bash: ./waf: No such file or directory error - linux-kernel

charlie#charlie:~/Desktop/ns-allinone-3.36.1/ns-3.36.1$ ls
AUTHORS build-support CMakeLists.txt doc ns3 scratch testpy.supp VERSION
bindings CHANGES.md contrib examples README.md src utils
build cmake-cache CONTRIBUTING.md LICENSE RELEASE_NOTES.md test.py utils.py
charlie#charlie:~/Desktop/ns-allinone-3.36.1/ns-3.36.1$ ./waf
bash: ./waf: No such file or directory
Could someone help me out to understand why waf module is not installed in my directory?

Related

Sphinx cannot locate config file when building from makefile

I am following this tutorial on integrating sphinx with github pages and it seems like the Makefile they use is not working. When I run make github from my project's root directory, I get the following error:
config directory doesn't contain a conf.py file (C:\path\to\project_root)
However, I can run make html successfully -- only make github does not work.
Here's the Makefile I used:
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = source
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
#$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
github:
#make html
#cp -a build/html/. ./docs
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
#$(SPHINXBUILD) -M $# "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
And here's my folder structure:
project_root
├─ build
├─ docs
├─ source
│ └─ conf.py
└─ Makefile
EDIT:
make github actually works in a git bash window. I'm on Windows so I suspect this is a platform dependent problem. Is there a way I can modify the Makefile to let it run make github successfully in windows powershell?
Apparently in Windows Makefile is not used at all, only make.bat.
I've wasted various hours on this as well. See Lex Li's answer here:
https://stackoverflow.com/a/65471768/2040843
(Make HTML not working for Sphinx documentation in windows 10)

Getting cmake to work under Cygwin on Windows 7

I installed the latest Cygwin on my Windows 7 machine: version 2.893 (64-bits). I made sure I included cmake, i.e. I was able to add several packages by running the Cygwin net release setup program again, after doing the first installation. I then tried to use cmake and made sure I invoked it from the bin directory:
user008#L0147816 /bin
$ ./cmake
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
//share/cmake-3.6.2
Usage
cmake [options] <path-to-source>
cmake [options] <path-to-existing-build>
Specify a source directory to (re-)generate a build system for it in the
current working directory. Specify an existing build directory to
re-generate its build system.
Run 'cmake --help' for more information.
I don't know where the build directory could be. I'm relatively new to Cygwin. I hope somebody has found a solution for getting cmake installed and working properly under Cygwin.
This looks cmake 101.
Assuming you want to just build a software download from somewhere
eg gl2ps:
# choosing a test area
$ cd /tmp
# downloading source
$ wget http://geuz.org/gl2ps/src/gl2ps-1.4.0.tgz
# expanding source code
$ tar -xf gl2ps-1.4.0.tgz
$ ls gl2ps-1.4.0-source/
CMakeLists.txt COPYING.LGPL gl2ps.h gl2ps.tex gl2psTestSimple.c
COPYING.GL2PS gl2ps.c gl2ps.pdf gl2psTest.c README.txt
# preparing a build area
$ mkdir build
$ cd build
# invoking cmake and pointing to the source directory
$ cmake ../gl2ps-1.4.0-source/
-- The C compiler identification is GNU 7.3.0
[cut ...]
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/build
# running the build
$ make
Scanning dependencies of target shared
[ 11%] Building C object CMakeFiles/shared.dir/gl2ps.o
...
[ 88%] Building C object CMakeFiles/gl2psTestSimple.dir/gl2psTestSimple.o
[100%] Linking C executable gl2psTestSimple.exe
[100%] Built target gl2psTestSimple
Instead for learning how to build with cmake, go to
https://cmake.org/cmake-tutorial/
Here a solution I just found.
Let's name 3 directories:
{cygwin64-path}/bin/: cmake.exe is here.
{cygwin64-path}/usr/share/: cmake module directory (such as cmake-3.20.0) is here.
{cygwin64-path}/share/: cmake.exe trying to find cmake-module-directory here, but it doesn't exist.
It's wired because cygwin install cmake-module-directory in {cygwin64-path}/usr/share/, but cmake.exe looks for the directory in {cygwin64-path}/share/.
So solution is simple. Each one below works.
METHOD 1: Create the directory {cygwin64-path}/share/ and copy all relevant directories and files from {cygwin64-path}/usr/share/ to the new directory.
METHOD 2: Create a Symbolic links {cygwin64-path}/share/ to {cygwin64-path}/usr/share/.
In windows 10 Administrator cmd.exe: mklink /J share usr\share and all works.
Or use WSL or Cygwin64 Terminal: ln -s usr/share share

How to build a .a file in golang

I tried go build xxx.go, no file output and no error prompt. I searched and found a solution said should use go install xxx.go, got a error :
go install: no install location for .go files listed on command line (GOBIN not set)
I search this error and found the solution is set the environment variable GOBIN, GOPATH and I did but it still does not work.
I solved myself.
The key is: after type go build xxx.go, nothing generate, but it's not an error!
I must continue type go install sourcedir, the source must inside a directory, then I found the .a file in pkg folder.
go install: no install location for .go files listed on command line (GOBIN not set)
Create a bin directory under GOPATH parallel to src.
For e.g:
GOPATH=/home/user/go
GOBIN=$GOPATH/bin
EDIT: after comment interaction.
Create your go workspace, refer to workspace doc
For e.g.:
Directory Structure: GOPATH is /home/user/go
/home/user/go/src/pic-project
└── pic.go
Go to /home/user/go/src/pic-project
go build pic.go
ls -ltr
-rw-r--r-- 1 jeeva staff 84 Jun 23 23:55 pic.go
-rwxr-xr-x 1 jeeva staff 1624096 Jun 24 00:02 pic
Binary is in the same directory.
Now, let's do go install, you can execute install command in following ways.
Inside project directory (binary will be in $GOPATH/bin directory)
go install
OR from anywhere in the terminal-
go install pic-project
Also if you have project with main func and sub packages. Execute go install <import-path>, it will produce binary and sub-packages as .a files.
go install github.com/user/foo
You will find foo.a under $GOPATH/pkg/GOOS_GOARCH/github.com/user/foo.a and binary in the $GOPATH/bin directory.

GNU Octave: Build a package from a directory instead of a tarball

I currently developing an interface for a library as a GNU Octave package. Normally packages in GNU Octave are installed via
pkg install tarball_of_the_package.tar.gz
But compressing the package for each test is more or less time consuming. Now my question is if it is possible to call somehow the pkg install mechanism from a directory which has a valid package structure like in the tarball? Running
pkg install .
from inside this directory yields an error:
unpack: FILETYPE must be "gunzip" for a directory
Even specifying the whole path as
pkg install /path/to/the/package/source
results in the same problem.
At the moment I am using GNU Octave 4.0.0 for my developments.
What most packages have is a Makefile at the root of the package with targets such as install that will handle that for you. See for example the Makefile for the statistics package which allow you to do:
$ hg clone http://hg.code.sf.net/p/octave/statistics
destination directory: statistics
requesting all changes
adding changesets
adding manifests
adding file changes
added 401 changesets with 996 changes to 172 files
updating to branch default
133 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd statistics/
$ make install
Creating package version 1.2.4 release ...
rm -rf "statistics-1.2.4"
hg archive --exclude ".hg*" --exclude "Makefile" --type files "statistics-1.2.4"
chmod -R a+rX,u+w,go-w "statistics-1.2.4"
tar cf - --posix "statistics-1.2.4" | gzip -9n > "statistics-1.2.4.tar.gz"
Installing package locally ...
octave --silent --eval 'pkg ("install", "statistics-1.2.4.tar.gz")'
For information about changes from previous versions of the statistics package, run 'news statistics'.
And of course, there's nothing stopping you from calling make install from the Octave session itself. The statistics package example is nicer because it only has m files. If your package also has code to be compiled, the image package has a more complex, but not by much, Makefile for that.

Correct directory structure for a Go Project?

I'm relatively new to Go and I've recently created a project that's going up on GitHub. I've tried to follow guides but there's a pressing question of why my binaries end up in src/?
My layout is like this:
ssm/ - Name of project
LICENSE
README.md
src/ - Source Code
files.go - All my source code is here.
src - The compiled binary ends up here
bin/ - Binaries
I set my $GOPATH to ~/Documents/Programming/Go/. From my gopath, I can't type go build ssm because it cannot find package. If I cd into the directory, it complains it can't load package: package .: no Go source files.
I have to actually go into src and compile there, which means the binary isn't in bin/.
What am I doing wrong?
See https://code.google.com/p/go-wiki/wiki/GithubCodeLayout
To be compatible with go get, your project's package name needs to be fully-qualified under the github.com domain:
$GOPATH/
src/github.com/<user>/ssm/
.git
LICENSE
README.md
files.go
bin/
Note that the base of the git repository (.git) is not the same as the $GOPATH.
Also, go build <package> will output a compiled executable to the current directory. If you want the exe to go to bin/, use go install <package> instead.
Your go code you can kept in a workspace. A workspace contains many source files (git, hg, svm, etc.). The Go tool understand the layout. We don't require Makefile or build.xml here. The basic directory layout is everything. If in any case if you are going to change the file layout, accordingly you need to change the build.
This is the general structure you can follow,
$GOPATH/
src/
github.com/username/repo/
mypkg/
mysrc1.go
mysrc2.go
cmd/mycmd/
main.go
bin/
mycmd
And, this is the standard workspace
$GOPATH/
bin/fixhub # installed binary
pkg/darwin_amd64/ # compiled archives
code.google.com/p/goauth2/oauth.a
github.com/...
src/ # source repositories
code.google.com/p/goauth2/
.hg
oauth # used by package go-github
...
github.com/
golang/lint/... # used by package fixhub
.git
google/go-github/... # used by package fixhub
.git
dsymonds/fixhub/
.git
client.go
cmd/fixhub/fixhub.go # package main
go get fetch many repositories whereas go install builds a binary out of them. It's convenient and easy to go for go development quickly. And, everyone in the go community follows the same. This puts src, bin and pkg into the home directory. And, $HOME/bin is already in our path before creating our workspace.

Resources