32-bit Fortran on 64-bit Server - gcc

I have a 32-bit Fortran application that I need to run on a 64-bit ubuntu server. I have verified the application on a 32-bit ubuntu machine and it runs fine; however, I get the following error when I run in on the 64-bit server:
error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory
Doing some research on this, I've tried the following with no joy:
sudo apt-get install libgfortran3:i386 which can't locate the package
Manually install a 32-bit .deb package of libgfortran (failed with
error about incorrect architecture)
Install getlibs and have it determine what the dependencies are
Run ldconfig -v which finds libgfortran.so.3 -> libgfortran.so.3.0.0 under /usr/lib/x86_64-linux-gnu:...
... and then try to change the path to LD_LIBRARY_PATH to that, which did nothing (though I have to say that my knowledge gets very sparce once we start talking about library paths...)
Check if ia32-libs are installed, which they are
removed and re-installed libgfortran, then randpkg --configure --pending and dpkg --path-include=/usr/lib/x86_64-linux-gnu.
I'd like to stay away from creating a 32-bit chroot if at all possible but at this point I don't if there is anything else to do that could keep me from having to do so...
Do any of you have an idea as to something else I could do? Thank you.

Try to install the package lib32gfortran3, as that would install the 32 bit version of the libgfortran library. Before starting the program, you may eventually need to set LD_LIBRARY_PATH="/usr/lib32:" but probably it will run also without this.

I'm not sure if this was an oversight on my part or something else; but here are the two steps that fixed it all:
Run sudo apt-get install gfortran on a 64-bit machine which will install the GNU Fortran Compiler
Recompile the application, on the 64-bit machine, using gfortran.
The strange part was that at this point I was still not able to just copy/paste the application file to other 64-bit machines and run it. Rather, I first had to separately install gfortran on each machine, even if I wasn't planning on compiling anything. Once gfortran was installed, the application would run, no matter where it was compiled... I presume that the libgfortran3 must have been some dependency...

Related

Installing Make in Cygwin

I am trying to build a Linux project in windows 7 environment usign cygwin. However I am continuously getting below error while configuring make for cygwin installation.
-bash: make: command not found
After searching on inernet the only solution is re running of setup and installed make package. I have installed automake1.15 but it is in noarch folder and there is no binary make.exe in bin folder.
run command setup-x86_64.exe -q --packages=make(because make is not installed) in command prompt where the setup-x86_64.exe file is available
There's a big difference between the 2:
[GNU]: Automake - Generates Makefile templates
[GNU]: GNU Make - Builds software from sources (via Makefiles)
So you need to select Make from Cygwin setup.
Notes:
Automake (or any package, as a matter of fact) is downloaded in the noarch dir, when it's compatible with any OS (Cygwin, in this case) architecture (32 bit and 64 bit (currently)), meaning that it doesn't contain binaries (.exes, .dlls (.sos)), only script-like files
Make on the other hand, does contain binaries (/usr/bin/make itself it is a binary) and will be downloaded in the appropriate dir (x86_64 or x86)
The download dir is not the same thing as the installation dir (there may be more than one, and it's under Cygwin installation dir)
For more (generic) details, check [Cygwin]: Installing and Updating Cygwin Packages.
[Cygwin]: Cygwin FAQ - Does the Cygwin Setup program accept command-line arguments? might also be a good starting point for command line options (check [SO]: Installing Make in Cygwin (#PJain's answer)).
Final note: Cygwin is kind of obsolete. Switch to WSL(2), which runs a real Ubuntu (no wrappers / adapters) as a VM (in Hyper-V - which runs at a totally different level).

go tool: no such tool "compile"

I recently started trying go to program some web based applications. At first, everything went fine, until I wanted to cross compile a binary for a different platform. I'm running MacOS and I wanted to compile a binary for linux, so I changed GOOS to linux and GOARCH to amd64. Since then, I always get the error message
go tool: no such tool "compile"
I'm using GoClipse, but running the compile manually by
go install hello.go
I get the same error. When changing back to compiling for darwin architecture, I get the same error now, so basically I'm totally unable to compile any code written in Go at the moment.
I installed it via the binary packages provided by google. In the end I actually got it back to work by just reinstalling it. Sometimes I'm just blind to the easy solution.
After that, I succeeded in cross compiling for linux machine after compiling the necessary cross-compilers by running env GOOS=linux GOARCH=arm GOROOT_BOOTSTRAP=/usr/local/go ./make.bash --no-clean from the Go sources directory.
Thanks for all you efforts, sorry to have kept you busy on such a simple matter.
You have the wrong x64 or x386 package installed most likely. I had 32 installed running 64 bit. Reinstall fixed. Good luck.
You might be able to get away with that if you install Go 1.5, however if you use anything that depends on cgo, you will have to install a cross-compiler linker or install Linux on a virtual machine to be able to cross compile for Linux.
In my case is due to the fact that GOPATH and GOROOT are not set correctly, maybe you can check go env. Here is a discussion may be useful.
The way I figured-out what file is read and caused Go to look for the compile binary in the wrong place can be solved using:
$ strace go tool -n compile 2>&1 |grep openat
openat(AT_FDCWD, "/home/nwaizer/.config/go/env", O_RDONLY|O_CLOEXEC) = 3
In that file, the IDE Goland, add a path to some project, causing the havoc.

Is it possible to set up GStreamer for use in MinGW, similar to how it's done in Linux?

Apologies for the tardy title, I'm not quite sure how to phrase this question. At its most basic, I'm attempting to compile a program with GStreamer. When running the configure script for said program I get the following error:
0:20.39 configure: checking for gstreamer-1.0 >= 1.0
0:20.39 gstreamer-app-1.0
0:20.39 gstreamer-plugins-base-1.0
0:20.39 configure: error: gstreamer and gstreamer-plugins-base development pack
ages are needed to build gstreamer backend. Install them or disable gstreamer su
pport with --disable-gstreamer
The build environment I'm compiling in:
Windows 7 (64-Bit)
MINGW & MSYS
Visual C/C++ 2010 SP1 (command line)
Now if this error occurred on a Linux distro, - say Ubuntu - it could be remedied by running the following commands:
apt-get install libgstreamer-plugins-base1.0-dev
apt-get install libgstreamer1.0-dev
What is the equivalent for Windows? I've found two type of versions that can be used: The gstreamer bin from the developer website, which has the following structure:
bin
include
lib
share
And a dynamic library of gstreamer for mingw with the following structure:
bin
lib
How am I supposed to let mingw/msys know that the gstreamer library is installed? Do I place the folders above in the relevant MSYS directories? Then, how does the configure know that it's installed and ready to be used?
I hope what I'm asking makes sense, please let me know if anything is confused. Cheers!
Using the first solution (official binaries from GStreamer), you need to tell the configure script where everything is located.
The simplest way is to set the environment variable PKG_CONFIG_PATH to where the .pc files are located. Generally it's in
$install_directory/lib/pkgconfig/
Replace $install_directory with the actual location, ex if it's installed in /c/GStreamer :
PKG_CONFIG_PATH=/c/GStreamer/lib/pkgconfig ./configure
That should make configure figure out everything

Where is my gcc.exe?

I need to create a simple C application with just a compiler and a text editor. So I installed mingw from here. I was surprised, when I went to the bin folder and there was no gcc.exe.
Given that other people speak about using it, I suppose it should be there. What did I do wrong?
Sounds like I shoul've read a little bit more than I did. Downloading and running the installer is only the very beginning of getting gcc.
After installation, mingw-get.exe appears in the /bin folder. This commands initiates a rather long download process:
mingw-get install gcc
After this, another downloading command is necessary to get C++ compiler and make:
mingw-get install gcc g++ mingw32-make

How can I setup linux to compile FORTRAN code into windows binaries?

I'm working on a FORTRAN project and I would like to build all of the binaries that I want to maintain on a linux machine that is dedicated for automated builds. I have successfully used mingw to build 32-bit and 64-bit binaries from C source for windows machines on the linux machine with the following packages on Ubuntu.
apt-get install mingw32
apt-get install mingw-w64
Then I run the following commands to actually compile:
gcc -b amd64-mingw32msvc -V 4.4.4 -o <...other options>
However, the mingw packages that I've obtained via apt-get do not include FORTRAN compilers.
Anybody got any ideas on what I can do?
if you got mingw32 and the Gnu C cross compiler is working for you ... when why not just get the Gnu Fortran cross compiler, too?
http://www.nber.org/sys-admin/mingw32-fortran-fedora.html
EXAMPLE apt-get install mingw32-gcc-fortran
I know this is an old thread but a few things seem to have changed and people might still be interested in the topic.
Problem: I want to use my linux machine to compile some code and create a .exe that I can send to people using Windows.
Solution: Essentially here: http ://mxe.cc/
What I did:
Check to see if your system has all the software you need here
run
git clone -b stable https://github.com/mxe/mxe.git
It will download a few small things and create the directory "mxe" (probably in your home folder)
cd into that mxe directory and run "make". HOWEVER: this would take hours and take up a few GB on your hard drive so instead run something like
make mpfr eigen opencsg cgal qt
For more ideas on how to shorten that all see this or the mxe tutorial or somewhere else ;)
The easiest way to compile stuff then seems to be something like:
~/mxe/usr/bin/i686-pc-mingw32-gfortran -c main.f95
~/mxe/usr/bin/i686-pc-mingw32-gfortran main.o -o outfile.exe
Of course you can chose something other than fortran, just consult the mxe/usr/bin to see what its called.
You can always download and install a prebuilt compiler from the MinGW(-w64) project itself:
Windows 64-bit: http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/rubenvb/4.6.2-1/
Windows 32-bit: http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/rubenvb/4.6.2-1/
Just unpack somewhere and add the cross*/bin directory to PATH.
I include (obj)c(++) and fortran.
On Ubuntu 18.04 I use
apt install gfortran-mingw-w64
Then use the compiler x86_64-w64-mingw32-gfortran in place of gfortran. If you're using cmake, you can configure the compiler from the build directory like so:
FC=x86_64-w64-mingw32-gfortran cmake ..

Resources