I'm trying to use XROTOR, need to use a Makefile but ifort: command not found - cygwin

I am about 3 hours new to Linux/Cygwin/virtually anything even borderline computer science. I have been tasked with installing a program for rotors/propellers for research (XROTOR), but I cannot figure out how to run the program. It seems to have been developed in Fortran (maybe?), and came with a README. The README is asking me to build the file, but I have no clue what that means. I have downloaded Cygwin, and have gotten as far as the "make libPLT.a" line. I then cd'ed to the bin folder, and typed in "make xrotor" like the README states, but I keep getting the following error:
$ make
ifort -c -I../src -O -static ../src/xrotor.f
sh: ifort: command not found
make: *** [Makefile:147: xrotor.o] Error 127
I've included the README as well. I don't know what I'm doing, and I figured this was a decent place to start. Any help is GREATLY appreciated!!!
EDIT: Left the README out for whatever reason, sorry. I've written it out here:
General
XROTOR and its plot library should compile on any Unix system
with normal Fortran-77, C, and X-Windows support. So far,
XROTOR has been tested on the following systems:
DEC-5000
Alpha
SGI
* Sun
* RS/6000
* HP-9000
* Pentium/Linux
The systems marked with "*" have peculiar features which require slight
modifications to the Makefiles in the plotlib/ and bin/ directories.
Examine these Makefiles before building the plot library and Xrotor.
Build Sequence
To install, first build the plot library in ./plotlib ...
% cd plotlib
% make libPlt.a
Then build the programs in ./bin ...
% make xrotor
% make jplot

The README is missing some details, but you need to compile the program from sources,
and to do so you need to adjust some variables in the Makefile's
As prerequisite for compiling you need gcc-fortran,make and library libX11-devel
plus the X11 system for the graphic. Installing xinit is a good start.
$ tar -xf Xrotor7.55.tar.tgz
$ cd Xrotor
$ cd plotlib
than modify config.make to set PLTLIB = libPlt.a
I used my preferred editor, but other are also ok
$ vim config.make
To build:
$ make libPlt.a
gfortran -c -O2 -fdefault-real-8 plt_base.f
gfortran -c -O2 -fdefault-real-8 plt_font.f
gfortran -c -O2 -fdefault-real-8 plt_util.f
gfortran -c -O2 -fdefault-real-8 plt_color.f
gfortran -c -O2 -fdefault-real-8 set_subs.f
gfortran -c -O2 -fdefault-real-8 gw_subs.f
gfortran -c -O2 -fdefault-real-8 ps_subs.f
gcc -c -O2 -DUNDERSCORE Xwin.c
gfortran -c -O2 -fdefault-real-8 plt_old.f
gfortran -c -O2 -fdefault-real-8 plt_3D.f
ar r libPlt.a plt_base.o plt_font.o plt_util.o plt_color.o set_subs.o gw_subs.o ps_subs.o Xwin.o plt_old.o plt_3D.o
ar: creating libPlt.a
ranlib libPlt.a
Than moving to program build directory
$ cd ../bin
again modify Makefile.gfortran to set PLTOBJ = ../plotlib/libPlt.a and LIBS = -L/usr/lib -lX11
$ vim Makefile.gfortran
and build all program in one shot
$ make -f Makefile.gfortran
gfortran -c -I../src -O ../src/xrotor.f
gfortran -c -I../src -O ../src/xoper.f
gfortran -c -I../src -O ../src/xdesi.f
gfortran -c -I../src -O ../src/xmodi.f
...
gfortran -c -I../src -O ../src/plotdata.f
gfortran -o xrotor xrotor.o xoper.o xdesi.o xmodi.o xaero.o xjmap.o xio.o xnoise.o xrotpl.o xcasepl.o xbend.o xinte.o xutils.o jputil.o plutil.o modify.o srclin.o spline.o userio.o vortex.o plotdata.o ../plotlib/libPlt.a -L/usr/lib -lX11
gfortran -c -I../src -O ../src/jplot.f
../src/jplot.f:107:72:
PAUSE 'Hit return to see J values'
1
Warning: Deleted feature: PAUSE statement at (1)
../src/jplot.f:112:72:
PAUSE 'Hit return to see CP values'
1
Warning: Deleted feature: PAUSE statement at (1)
gfortran -o jplot jplot.o xutils.o jputil.o userio.o ../plotlib/libPlt.a -L/usr/lib -lX11
gfortran -c -I../src -O ../src/jplote.f
gfortran -o jplote jplote.o xutils.o jputil.o userio.o ../plotlib/libPlt.a -L/usr/lib -lX11
The Warning means that the PAUSE command does not exist anymore so the progran will
likely not pause on the expected locations.
This could explain why it is not working as expected, but probably as the code is very old some code assumptions about the Unix system are not anymore valid.
Running it after starting the Xwindow graphic system from inside a Xterm
$ ./xrotor
=========================
XROTOR Version 7.55
=========================
Note: The following floating-point exceptions are signalling: IEEE_DENORMAL
STOP COLORSPECTRUM: Non-monotonic color axis. Check COLWIDTH.

Need to edit the COLORSPECTRUMTRP subroutine xrotor/plotlib/plt_color.f. Add the following after line 508
COLWIDTH=(/1.0,1.20000005,0.5,1.4,1.0,1.20000005,1.5/)

Related

Cross compiling portAudio for Intel Edison

I am using the cross compile environemt from the Intel Site and have successfully compiled several other libraries using it (libsndfile, alsa, fftw) but when I try to compile portaudio it refuses to link to the proper directories. Here is the error I get:
if test -n " bindings/cpp" ; then for dir in " bindings/cpp"; do make -C $dir all; done ; fi
make[1]: Entering directory '/home/theslat/Downloads/portaudio/bindings/cpp'
Making all in lib
make[2]: Entering directory '/home/theslat/Downloads/portaudio/bindings/cpp/lib'
/bin/sh ../libtool --tag=CXX --mode=link i586-poky-linux-g++ -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mstackrealign -fno-omit-frame-pointer --sysroot=/usr/edison/sysroots/core2-32-poky-linux -O2 -pipe -g -feliminate-unused-debug-types -version-info 0:12:0 -no-undefined -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o libportaudiocpp.la -rpath /usr/local/lib BlockingStream.lo CallbackInterface.lo CallbackStream.lo CFunCallbackStream.lo CppFunCallbackStream.lo Device.lo DirectionSpecificStreamParameters.lo Exception.lo HostApi.lo InterfaceCallbackStream.lo MemFunCallbackStream.lo Stream.lo StreamParameters.lo System.lo SystemDeviceIterator.lo SystemHostApiIterator.lo ../../../lib/libportaudio.la
libtool: link: i586-poky-linux-g++ -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mstackrealign -fno-omit-frame-pointer --sysroot=/usr/edison/sysroots/core2-32-poky-linux -fPIC -DPIC -shared -nostdlib /usr/edison/sysroots/core2-32-poky-linux/usr/lib/crti.o /usr/edison/sysroots/core2-32-poky-linux/usr/lib/i586-poky-linux/4.9.1/crtbeginS.o .libs/BlockingStream.o .libs/CallbackInterface.o .libs/CallbackStream.o .libs/CFunCallbackStream.o .libs/CppFunCallbackStream.o .libs/Device.o .libs/DirectionSpecificStreamParameters.o .libs/Exception.o .libs/HostApi.o .libs/InterfaceCallbackStream.o .libs/MemFunCallbackStream.o .libs/Stream.o .libs/StreamParameters.o .libs/System.o .libs/SystemDeviceIterator.o .libs/SystemHostApiIterator.o -Wl,-rpath -Wl,/home/theslat/Downloads/portaudio/lib/.libs -Wl,-rpath -Wl,/usr/local/lib ../../../lib/.libs/libportaudio.so -L/usr/edison/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux/../../lib/i586-poky-linux/gcc/i586-poky-linux/4.9.1 -L/usr/edison/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux/../../lib/i586-poky-linux/gcc -L/usr/edison/sysroots/core2-32-poky-linux/lib -L/usr/edison/sysroots/core2-32-poky-linux/usr/lib/i586-poky-linux/4.9.1 -L/usr/edison/sysroots/core2-32-poky-linux/usr/lib /usr/lib/libstdc++.so -lm -lc -lgcc_s /usr/edison/sysroots/core2-32-poky-linux/usr/lib/i586-poky-linux/4.9.1/crtendS.o /usr/edison/sysroots/core2-32-poky-linux/usr/lib/crtn.o -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mstackrealign --sysroot=/usr/edison/sysroots/core2-32-poky-linux -O2 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-soname -Wl,libportaudiocpp.so.0 -o .libs/libportaudiocpp.so.0.0.12
/usr/lib/libstdc++.so: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:311: libportaudiocpp.la] Error 1
make[2]: Leaving directory '/home/theslat/Downloads/portaudio/bindings/cpp/lib'
make[1]: *** [Makefile:333: all-recursive] Error 1
make[1]: Leaving directory '/home/theslat/Downloads/portaudio/bindings/cpp'
make: *** [Makefile:251: all-recursive] Error 2
It seems like it is trying to link against my computers normal libstdc++ and I don't know why. I have tried feedin configure a variaty of LDFLAG with the right directories and have reinstalled the toolchain and all my multilibs but no luck.
I also ran into this issue and the easiest way is to source the environment file again after doing a sudo su on the same command line and then do a make install.
Here are the steps I followed to cross compile portaudio for intel edison:
Download the cross compiler edison-toolchain-20150120-linux64.tar.bz2 and the script toolchain-20140724-linux64.sh from this link
Extract the toolchain, run the script (you can put it in your home directory somewhere if you wish) and set up the cross-compile environment
$ tar -xvf edison-toolchain-20150120-linux64.tar.bz2
$ chmod +x toolchain-20140724-linux64.sh
$ ./toolchain-20140724-linux64.sh
$ source /opt/poky-edison/1.6/environment-setup-core2-32-poky-linux
Check the environment on your shell:
$ echo $CC
$ i586-poky-linux-gcc -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mstackrealign -fno-omit-frame-pointer --sysroot=/opt/poky-edison/1.6/sysroots/core2-32-poky-linux
Configure, compile and install portaudio:
$ ./configure
$ make
$ sudo su
# source /opt/poky-edison/1.6/environment-setup-core2-32-poky-linux
# make install
I am suprised that nobody grabbed this but also that it was difficult to find the proper answer anywhere else despite seeing many other people with similar (unresolved issues). The answer is frankly so simple I am embarrased that I overlooked it, but here it is so maybe someone else can find it.
make install required root privilages if the cross-compile SDK is in /opt or somewhere else you do not own. But... sudo does not preserve the environmental variable I had set up for the toolchain! Very simple, also su -m does not work the way I thought it did. Working solutions as follows:
Just install the SDK somewhere in your home directory. you now have write permissions, problem solved.
Run a single command as root while preserving the environment: su -m <yourUserName> -c '$CC main.cpp -lfoo -lbar ...'
The key in numer 2 is the username after -m, at least on my system leaving out the username there produced no errors but failed to preserve my environment.

Makefile warning: Warning: File `main.cpp' has modification time 2.1e+04 s in the future

I have a working Makefile, but there is a warning that I couldn't fix.
#Use the g++ compiler
CC = g++
# Compiler flags:
# -Wall (most warnings enabled)
# -g (for debugging with gdb)
CFLAGS = -Wall
# Executable name:
TARGET = deque_adt
all: main.o deque_adt.o deque_adt
$(TARGET): main.o deque_adt.o
$(CC) $(CFLAGS) main.o deque_adt.o -o $(TARGET)
main.o: main.cpp deque_adt.h
$(CC) $(CFLAGS) main.cpp -c
deque_adt.o: deque_adt.cpp deque_adt.h
$(CC) $(CFLAGS) deque_adt.cpp -c
clean:
rm *.o *~ $(TARGET)
error:
make: Warning: File `main.cpp' has modification time 2.1e+04 s in the future
g++ -Wall main.cpp -c
g++ -Wall deque_adt.cpp -c
g++ -Wall main.o deque_adt.o -o deque_adt
make: warning: Clock skew detected. Your build may be incomplete.
Can someone help me out to figure out the problem? I have tried to switch between the elements but it still gives the same warning.
To expand on Ben Voigt's answer:
find /your/dir -type f -exec touch {} +
will update the timestamp on all files in the directory. You can then make clean && make again.
check your computer time. I had the same problem and the root cause was my computer time was in the past - when I update it, it was work perfectly.
That message is usually an indication that some of your files have modification times later than the current system time.
Chech if your system time is in the past. Example:
$ date
If so You have several ways to fix this. the easier one is to install an ntp server:
apt install ntp
Or
yum install ntp
Or ...
Regarding of your operating system (Ubuntu, Centos, ...etc)
just set your system date:
example
date -s "2 OCT 2006 18:00:00"
I've faced the same issue, did the below approach on Ubuntu 20.04 and it worked for me.
touch main_.cpp
cp main.cpp main_.cpp
rm main.cpp
mv main_.cpp main.cpp

Swap unix compiler flags with a shorter one

I've been running ns3 sumulations in linux and every time I compiled I had to type
g++ -Wall -o simulacija simulacija.cc -DNS3_ASSERT_ENABLE -DNS3_LOG_ENABLE `pkg-config --libs --cflags
libns3.16-core-debug libns3.16-network-debug libns3.16-applications-debug libns3.16-internet-debug
libns3.16-point-to-point-debug libns3.16-point-to-point-layout-debug libns3.16-csma-debug
libns3.16-csma-layout-debug libns3.16-topology-read-debug libns3.16-wifi-debug`
Is there a way to shorten the flags to eg:
g++ -Wall simulacija.cc -o simulacija -my_params
Thank you
The GCC compiler supports the # notation to embed a sequence of arguments inside a file. Read near end of GCC overall options page.
So you could put in some file params.args the following lines
-Wall
-I /usr/local
-DNS3_ASSERT_ENABLE
-DNS3_LOG_ENABLE
-O
and just invoke
g++ #params.args simulacija.cc -o simulacija
You could have a Makefile rule to build that params.args (e.g. with pkg-config etc...)
Actually, it is time to learn how to use GNU make.
Notice that the # option is not understood by some other compilers like GCC handles it.
You can create a shell script myparams.sh that outputs your parameters:
#!/bin/sh
echo -n "-DNS3_ASSERT_ENABLE -DNS3_LOG_ENABLE"
pkg-config --libs --cflags libns3.16-core-debug [...]
Now you can run
g++ -Wall simulacija.cc -o simulacija `./myparams.sh`
(Don't forget to chmod +x myparams.sh)

My lib_LTLIBRARIES library links, but check_LTLIBRARIES one does not?

I have a new c++ project built with autoconf, automake and libtool. Functionality is divided up into support libraries and user binaries. There is also a set of unittests binaries which link against these libraries, are built and run at make check time, but are not installed.
I said the the project is new. I'm actually just now getting around to extracting the first library that should be installed. Until now the (small amount of) written code was just compiled directly into a unittests.
My attempted Makefile.am snippet looks like this:
lib_LTLIBRARIES += libfoo.la
libfoo_la_SOURCES = foo.cc
In make check, I get this:
/bin/bash ./libtool --tag=CXX --mode=link g++ -Wall -Wextra -Werror -ansi -fprofile-arcs -ftest-coverage -g -O0 -fprofile-arcs -ftest-coverage -L/usr/local/lib -Wl,-rpath /usr/local/lib -o libfoo.la -rpath /usr/local/lib foo.lo -lboost_thread-mt -lboost_system-mt -pthread
libtool: link: g++ -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.6.1/crtbeginS.o .libs/foo.o -L/usr/local/lib -lboost_thread-mt -lboost_system-mt -L/usr/lib/gcc/x86_64-linux-gnu/4.6.1 -L/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/4.6.1/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/crtn.o -fprofile-arcs -O0 -fprofile-arcs -Wl,-rpath -pthread -pthread -Wl,-soname -Wl,libfoo.so.0 -o .libs/libfoo.so.0.0.0
/usr/bin/ld: cannot find libfoo.so.0: No such file or directory
collect2: ld returned 1 exit status
Notice the missing library is precisely the one I'm trying to compile.
(The library is not libfoo, but I am able to reproduce the same error with this stub library. The Makefile.am and error lines above are literal and unedited.)
If I change the automake lines to
check_LTLIBRARIES += libfoo.la
libfoo_la_SOURCES = foo.cc
then the compile looks like this:
/bin/bash ./libtool --tag=CXX --mode=link g++ -Wall -Wextra -Werror -ansi -fprofile-arcs -ftest-coverage -g -O0 -fprofile-arcs -ftest-coverage -L/usr/local/lib -Wl,-rpath /usr/local/lib -o libfoo.la foo.lo -lboost_thread-mt -lboost_system-mt -pthread
libtool: link: ar cru .libs/libfoo.a .libs/foo.o
libtool: link: ranlib .libs/libfoo.a
libtool: link: ( cd ".libs" && rm -f "libfoo.la" && cp -p "../libfoo.la" "libfoo.la" )
..and everything works fine (except my library isn't installed, being in check_.)
Notice the only difference in the command lines is some additional arguments in the 2nd one:
... -Wl,-rpath /usr/local/lib -o libfoo.la -rpath /usr/local/lib foo.lo -lboost_thread-mt ...
I don't know offhand if this new argument shouldn't be there, but it does appear to be causing the problem. Does anyone know what I'm missing?
Some more details:
On osx lion, this works fine (and the command lines are different.) This error manifests on
ubuntu 12.04, possibly other linuxes.
noinst_LTLIBRARIES and EXTRA_LTLIBRARIES work like check_LTLIBRARIES: no extra arguments, and it links. It seems libtool 'convenience' libraries are specifically the ones without these arguments.
automake 1.11.1
autoconf 2.68
libtool 2.4
EDIT
(Manually) dropping -Wl,-rpath /usr/local/lib from the arguments also fixes the problem.
I did it to myself. While bringing in autoconf support for boost, I encountered a bug described here. My work-around followed the suggestion of one post:
diff --git a/m4/boost.m4 b/m4/boost.m4
index 3d4e47c..9dd0c43 100644
--- a/m4/boost.m4
+++ b/m4/boost.m4
## -403,7 +403,7 ## dnl generated only once above (before we start the for loops).
LDFLAGS=$boost_save_LDFLAGS
LIBS=$boost_save_LIBS
if test x"$Boost_lib" = xyes; then
- Boost_lib_LDFLAGS="-L$boost_ldpath -Wl,-R$boost_ldpath"
+ Boost_lib_LDFLAGS="-L$boost_ldpath -Wl,-rpath $boost_ldpath"
Boost_lib_LDPATH="$boost_ldpath"
break 6
else
The -rpath introduced here is the same one apparently causing the issue. If I revert this change, the problem goes away (I am of course left with the first issue, but that's another story.)

Can't seem to install id3v2 on linux, doesn't seem to be any errors

I'm tryin to follow the direction to install id3v2. I installed id3lib and did not receive any errors. I now try to do "make" and then "make install" as they suggest that I do.
I get the following responses when I go through the process.
I was under the assumption that I would be able to use the program by typing "id3v2 ....."
However, it seems that the system doesn't find the command. Does that mean the program was not installed? If so, how would I try to find a solution?
[root#ip-xxx-xxx-xxx-xxx id3v2-0.1.12]# make
g++ -Wall -I/opt/local/include/ -DVERSION="\"0.1.12\"" -c -o convert.o convert.cpp
g++ -Wall -I/opt/local/include/ -DVERSION="\"0.1.12\"" -c -o list.o list.cpp
g++ -Wall -I/opt/local/include/ -DVERSION="\"0.1.12\"" -c -o id3v2.o id3v2.cpp
g++ -Wall -I/opt/local/include/ -DVERSION="\"0.1.12\"" -c -o genre.o genre.cpp
g++ -L/opt/local/lib/ -pedantic -Wall -g -o id3v2 convert.o list.o id3v2.o genre.o -lz -lid3
[root#ip-xxx-xxx-xxx-xxx id3v2-0.1.12]# make install
install -c -s id3v2 /opt/local/bin/id3v2
nroff -man id3v2.1 > /opt/local/share/man/man1/id3v2.1
[root#ip-xxx-xxx-xxx-xxx id3v2-0.1.12]# id3v2
-bash: id3v2: command not found
I've looked at the make file itself and it says:
install: all
install -c -s id3v2 ${PREFIX}/bin/id3v2
nroff -man id3v2.1 > ${PREFIX}/share/man/man1/id3v2.1
The Prefix hard coded into the make file is:
/opt/local
Now I think it must be true that it is installing it in the wrong directory. Is it normal to adjust the Makefile? am I barking up the wrong tree?
Most likely path where you installed is not in $PATH. You can either call it with the full path:
/opt/local/bin/id3v2
or add this path to your $PATH:
export $PATH=$PATH:/opt/local/bin
To make it permanent append this line to $HOME/.profile

Resources