Building FMINUIT from source for Octave - makefile

I'm trying to install a package called fminuit http://www.fis.unipr.it/~giuseppe.allodi/Fminuit/Fminuit_building.html
on ubuntu 18.04 machine using Octave. The installation step "make -f Makefile.f2c_lnx.Octave" gives me the following error
WrapIO_Matlab.c:4:10: fatal error: mex.h: No such file or directory
Any idea how to remedy this,
cheers, Damir

The build instructions provided by FMINUIT ask you to manually adapt the Makefile to your setup. I'm guessing you did one of those steps incorrectly. I'm running Octave 6.0.0 (current development sources) and worked fine:
$ wget http://www.fis.unipr.it/~giuseppe.allodi/Fminuit/fminuit-src.tar.gz
$ tar xzf fminuit-src.tar.gz
$ cd fminuit-2011.05.31/fminuit/
# modify Makefile.f2c_lnx.Octave
$ make -f Makefile.f2c_lnx.Octave
$ make -f Makefile.f2c_lnx.Octave install
The tricky part is knowing what to modify on the Makefile. For my case, these were the lines (you need to know the exact Octave version and where you installed it):
#Octave prefix directory (typically /usr or /usr/local): modify if needed
-PREFIX=/usr
+PREFIX=/usr/local
#major version number
-OCTAVE_MAJOR=2
+OCTAVE_MAJOR=6
#minor-release version number
-OCTAVE_MINOR=9.12
+OCTAVE_MINOR=0.0
OBJS= mnintr_wrkrnd.o intrac.o WrapIO_Matlab.o doflush.o
MINUIT=Minuit_.o
INSTDIR=../bin/linux_$(ARCH)/octave$(OCTAVE_MAJOR)
The fminuit Makefile will "install" inside the fminuit source directory. You may also want to adjust its INSTDIR value. You need to adjust your Octave path to use it:
>> addpath('/wherever/you/build/fmunuit/fminuit-2011.05.31/bin/linux_x86_64/octave6')
>> fminuit # you probably can figure out how to call this function
error: fminuit: Too few input arguments

Related

/bin/sh: 1: go: not found , but `go` is clearly in the PATH variable

Been pulling out my hairs on this one, it must be so simple but for some reason I can't get it to work..
I'm using go1.15, on Ubuntu 18.04, trying to build lnd from source off of github.
I run sudo make install after all the preliminaries but keep getting error
GO111MODULE=on go install -v -tags="" -ldflags " -s -w -X github.com/lightningnetwork/lnd/build.Commit=v0.11.0-beta-199-g98da919bf1c421dd4a976506761e626e39384a8d -X github.com/lightningnetwork/lnd/build.CommitHash=98da919bf1c421dd4a976506761e626e39384a8d -X github.com/lightningnetwork/lnd/build.GoVersion= -X github.com/lightningnetwork/lnd/build.RawTags=" github.com/lightningnetwork/lnd/cmd/lnd
/bin/sh: 1: go: not found
Makefile:139: recipe for target 'install' failed
make: *** [install] Error 127
i have GOPATH=/usr/local/go and have added /usr/local/go/bin to my PATH variable
can't understand what i am doing wrong
go version returns normally
I'm an intermediate programmer, but been using Linux for many years and do not understand what is going on.
Just in case somebody finds this the answer is that the golang installation instructions say to update your PATH variable in ~/.profile but this only applies to interactive shells, not scripts. So if you want to properly update this for scripts you'll have to find another way. My quick fix was just inserting a PATH update into the script itself.
Link for solution is:
Bash script can't execute Go command

How to install catdoc on Mac (without using macports)

background
I really would like to search for a term in a directory full of Word docs. So I stumbled across this lovely solution. However this solution requires that catdoc is installed on mac.
what I have tried
now homebrew obviously doens't have catdoc:
$ brew install catdoc
Updating Homebrew...
Error: No available formula with the name "catdoc"
==> Searching for a previously deleted formula...
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
Error: No formulae found in taps.
macports does, but I use homebrew and It's not a good idea to have both on my machine.
So I did what any self respecting semi-programmer would do: try to install it from source:
$ ./configure
see outpout
$ ./make
see output
the last part of ./make gives me this
1 warning generated.
gcc -o catppt catppt.o pptparse.o charsets.o substmap.o fileutil.o confutil.o numutils.o ole.o -lm
echo "#! /usr/bin/wish" >wordview
echo set charset_lib "\"/usr/local/share/catdoc\"">>wordview
cat wordview.tcl >>wordview
chmod 0755 wordview
touch build
make[1]: Nothing to be done for `all'.
then when i run make install i get this
make: `install' is up to date.
and obviously catdoc doesn't work:
$ which catdoc
>> nothing
Question
How can I install this?
You could just use the built-in textutil to convert MS-Word documents to text:
textutil -stdout -cat txt SomeFile.doc
or
textutil -stdout -cat txt *.doc
To build catdoc / catppt / xls2csv on Mac OS X (macos)
tested with catdoc-0.95 on Mac OS X 10.9.5
Configuration
First, unless your documents are likely to be written in a Cyrillic language, start with:
$ ./configure --with-input=cp1252 --with-output=mac-roman
(if you are more likely to encounter files from Windows)
... or ...
$ ./configure --with-input=mac-roman --with-output=mac-roman
(if you are more likely to encounter files from MacOS)
Building
$ make all (or just $ make)
Installation
make --directory=src install; make --directory=doc install; make --directory=charsets install
This should compensate for the error you received, abbood. It appears the primary Makefile isn't running the install portion of the three subdirectories, for some reason. If a permissions error is reported, precede the above command with "sudo".
I don't believe this should be necessary, but I'm not familiar enough with makefiles to provide a more proper (textbook) fix.
One can, of course, get the same effect by:
$ cd src
$ make install
$ cd ../doc
$ make install
$ cd ../charsets
$ make install
$ cd ..
Cleanup
To remove all files created by make, type:
$ make clean
To remove all files created by make as well as those created by ./configure, type
$ make distclean

Is there an easy way to COLOR-CODE the compiler outputs?

gcc (or other compilers) often generate huge text output and it's very difficult to see where the error is or miss warnings. I've done some search but havn't found a clean simple solution to color code the compiler output (so for instance warnings are yellow, errors are red, etc...)
Gcc 4.9 seems to have added this feature via the -fdiagnostics-color flag:
here's an alternative if you are looking for something very simple:
#!/bin/bash -e
make ${#} 2>&1 | perl -wln -M'Term::ANSIColor' -e '
m/Building|gcc|g++|\bCC\b|\bcc\b/ and print "\e[1;32m", "$_", "\e[0m"
or
m/Error/i and print "\e[1;91m", "$_", "\e[0m"
or
m/Warning/i and print "\e[1;93m", "$_", "\e[0m"
or
m/Linking|\.a\b/ and print "\e[1;36m", "$_", "\e[0m"
or
print; '
Just alias your make to this script and make sure it's executable...
Debian and Ubuntu gives the colorgcc package for that purpose.
And I usually run gcc (and make) thru emacs with M-x compile then the messages are colorized.
addenda
GCC 4.9 has a native colorization facility and GCC 6 - released end of April 2016 - (and probably GCC 5 too) is enabling it by default (when stdout is a terminal).
Ok, I'll just leave a notice about my own (python based) tool also :)
It is called Pluggable Output Processor and designed not only to colorize output of one particular program. Here is sample GCC output before:
After:
See colorgcc, a perl script that coulours the gcc output.
How to install and use colorgcc to colorize your gcc compiler output:
At least 3 answers here so far mention colorgcc, but NONE OF THEM EXPLAIN HOW TO INSTALL IT! (And it's not obvious). So, here's how to install the latest version in Ubuntu!
Go here and click "Clone or download" --> "Download Zip". I saved it into "~/Downloads/Install_Files"
Navigate to it in your file browser and right click it and go to "Extract Here." I now have a directory called "~/Downloads/Install_Files/colorgcc-master".
Copy the "colorgcc.pl" script to "/usr/bin/colorgcc" to "install" it (be sure to use the correct directory according to where you extracted it above): sudo cp ~/Downloads/Install_Files/colorgcc-master/colorgcc.pl /usr/bin/colorgcc
Make it executable: sudo chmod +x /usr/bin/colorgcc
Make the "~/bin" directory if it does not yet exist: mkdir ~/bin
*Make symbolic links that point to "/usr/bin/colorgcc" so that whenever you call gcc or g++ it automatically calls colorgcc instead:
ln -s /usr/bin/colorgcc ~/bin/g++
ln -s /usr/bin/colorgcc ~/bin/gcc
(if you ever want to uninstall colorgcc for some reason just delete these symbolic links "~/bin/g++" and "~/bin/gcc", and the Perl script: "/usr/bin/colorgcc" and you're done)
Done!
Here is a sample g++ output now when I call g++ -Wall -std=c++11 time_until_overflow_2.cpp -o time_until_overflow_2:
*Note: making these symbolic links in "~/bin" only works if "~/bin" is in your PATH variable in a location before the folder where the actual gcc and g++ executables are located. To ensure you have "~/bin" in your path you can view the PATH variable contents with: echo $PATH. If you don't see "/home/YOUR_USERNAME/bin" at the beginning of your path, add it with: export PATH=~/bin:$PATH.
References:
See here for more info. and for where I originally learned most of these steps: https://imranfanaswala.wordpress.com/2009/02/02/setting-up-colorgcc/. Thanks Imran Fanaswala!
~GS
you can use GilCC which is a Ruby tool that will convert GCC output to color in real-time. Right now you have two choices: Perl script (colorGCC) or GilCC and if you already work with Ruby you will like GilCC.
Unique to GilCC; GilCC has warning and errors counters and also shows compile time, very handy when you are trying to improve things. Because it is in Ruby it is cross platform. It is flexible and you can add more gems to customize it anyway you want.
The link to the download page is here.
https://github.com/gilmotta/GilCC
Although GCC 4.9 has -fdiagnostics-color option to enable colored outputs to terminals, I have created a tiny tool called 'crror' to get colorized compiler output.
It supports outputs from make as well. I can add colorize patterns for other tools if anyone requires.

Binary fortran file crashes under Make

I have a binary that runs under my default shell.
The binary runs perfectly o.k. with:
./binary input.dat
However, if I put this inside a make file:
SHELL=/bin/bash
runos:
./binary input.dat
The code crashes and leaves me quite helpless.
Here is what I tested so far, everything inside my Make file and in the shell:
ulimit -a: identical.
Set the shell to bash as seen above.
diff of the environment variables in SHELL and Make with:
env | sort > vars.1
inside make
env | sort > vars.2
Then run the binary with the extra variables in Make with the following command:
env SHLVL=2 MAKELEVEL=1 MAKEFLAGS= ./binary input.dat
strace in the shell and inside make:
strace -o debug binary input.dat
The code keeps on crashing in Make, and runs in the shell. I am already thinking to dump Make for my test cases and just write shell scripts. But I am curious to know what is the difference.
The Fortran code (a mix of F77, F90 and F95) was compiled with gfortran-4.4 and the following options:
FFLAGS= -g -fbacktrace
So, the concrete question is, what can I do to make this binary run under make in Debian!?
update:
I just tested again in a CentOS machine (v5.8), The code inside Makefile does not crash (GNU Make version 3.81).
I also tested on my Debian Wheezy and openSUSE 11.4, both with GNU Make version 3.82 - It crashes!
I tested on Debian Squeeze with GNU Make version 3.81, and it does crash. So, I think it is not dependent on the GNU Make version.
error when crashing:
enter timeloop
------------------------------------------------------------------------
timestep: 1 time: 2.500E-02 days delt: 2.500E-02 days
-------------------------------------------
terminated in routine react_snia
maximum number of iterations exceeded
bye now ...
-------------------------------------------
failure in timeloop
no further time step reduction possible
try reducing min. time step, bye now ...
trying to work around 'GNU Make' using 'waf'
It has been a while since I wanted to test waf, so here is another interesting observation:
I wrote a wscript which contains a function:
import os
def run(ctx):
os.system('./binary input.dat')
And waf run runs!
If I changed the run method to:
import subprocess as sp
def run(ctx):
sp.call('./binary input.dat', shell=True)
The binary also works as expected.
So, now I am thinking GNU Make forks a new sub-shell in a way that causes may binary to fail (although, under RHEL 5.8 Make did work).
solution: compile make from sources ...
Read to find out more.
OK, so after being pretty much desperate, I did what I simply should have done before blame make for all my troubles.
I thought the problem is Debian specific. But I am guessing the version in CentOS-5.8 is a patched version, although it says it's v.3.81.
So, for those who wonder my solution was:
wget http://ftp.gnu.org/gnu/make/make-3.82.tar.gz
tar xvzf make-3.82.tar.gz
cd make-3.82
./configure
./build.sh
# copy make to the directory with the binary and input and run the local make version
./make
# everything works as expected !!!
I thought let's narrow it down -
wget http://ftp.gnu.org/gnu/make/make-3.80.tar.gz
tar xvzf make-3.80.tar.gz
cd make-3.80
./configure
./build.sh
# copy make to the directory with the binary and input and run the local make version
./make
# everything works as expected !!!
Is it the version 3.81 ?
wget http://ftp.gnu.org/gnu/make/make-3.81.tar.gz
tar xvzf make-3.81.tar.gz
cd make-3.81
./configure
./build.sh
# copy make to the directory with the binary and input and run the local make version
./make
# FAIL! Like with the make version in Debian.
Hence, I think I bumped into some very weird bug in GNU Make v.3.81.

$PATH is not working

The following file worked yesterday, but today it isn't working any more.
Could be caused by either the apt-get upgrade or autoremove that I performed.
For some reason $PATH isn't working, I have no idea why not.
$ cat GW
#!/bin/bash
PATH="/media/Data/Wine/WineVersions/1.3.24/bin:$PATH"
export WINEPREFIX="/media/Data/Wine/WinePrefixes/GW"
export WINEDEBUG="-all"
cd "/media/Data/Wine/WinePrefixes/GW/drive_c/Program Files/Guild Wars"
wine Gw.exe
$ ./GW
./GW: line 6: /media/Data/Wine/WineVersions/1.3.24/bin/wine: No such
file or directory
$ ls /media/Data/Wine/WineVersions/1.3.24/bin/wine
/media/Data/Wine/WineVersions/1.3.24/bin/wine
I also tried export PATH="blablabla" but that didn't work either.
Edit: Requested info
$ file /media/Data/Wine/WinePrefixes/GW/drive_c/Program\ Files/Guild\ Wars/Gw.exe
/media/Data/Wine/WinePrefixes/GW/drive_c/Program Files/Guild Wars/Gw.exe: PE32 executable for MS Windows (GUI) Intel 80386 32-bit
# Not a symlink
$ ls -l /media/Data/Wine/WineVersions/1.3.24/bin/wine gives -rwxr-xr-x 1 j j 7244
2011-08-11 17:18 /media/Data/Wine/WineVersions/1.3.24/bin/wine
Apparently /media/Data/Wine/WineVersions/1.3.24/bin/wine exists, but is an orphaned symlink or otherwise broken.
I autoremoved a bunch of libraries that wine required, I hadn't installed the standard wine package, instead using individual builds.
ia32-libs allowed the executable to start, I am cross-referencing the contents of /var/log/apt/history.log with apt-cache showpkg wine1.2 to find what I need to install.

Resources