How to fix error: invalid value 'f95' in '-x f95'? - macos

I'm using Fortran with CodeBlocks IDE, and when I try to build my code I get this error
error: invalid value 'f95' in '-x f95'
and after that there is no executable file. The thing is, when I write in the
terminal
gfortran nameofmyfile.f
I get the correct executable file "a.out".
Question: How can I fix this problem?
Especifications: I have mac OS X 10.8.5, installed xcode, gcc, and gfortran.

Your IDE uses the clang compiler which does not support Fortran.
See also https://answers.launchpad.net/mg5amcnlo/+question/698961 and https://developer.apple.com/forums/thread/70010.

Related

Error while trying trying to run make command

I am trying to install a program and when I run make or make -f Makefile (following the installation instructions) I get the following output:
g77 -O5 -Wall -c prep_output.f -o prep_output.o
dyld: Symbol not found: ___keymgr_global
Referenced from: /usr/local/bin/g77
Expected in: /usr/lib/libSystem.B.dylib
make: *** [prep_output.o] Abort trap: 6
I am working on a macOS Mojave 10.14.6. Following some other proposed solutions in similar problems, I've already installed Command line tools in my Xcode but that didn't do the trick. Any suggestions please??
Thanks in advance
EDIT:
I got rid of g77 and installed a compatible version of gcc (gcc8) through MacPorts. After running the make command I get the following:
g77 -O5 -Wall -c prep_output.f -o prep_output.o
make: g77: No such file or directory
make: *** [prep_output.o] Error 1
So I guess the program still needs the g77 setup? This is the program btw ([http://www.cfht.hawaii.edu/~arnouts/LEPHARE/install.html]). Is there a way to rely to the gfortran compiler for building the program?
Thanks in advance
P.S. I noticed that when I install g77 I get the following error:
x usr/local/: Can't set user=0/group=0 for usr/local`
`tar: Error exit delayed from previous errors.
However it still installs g77..
The error message indicates that your installation of g77 is broken. This has nothing to do with make or the particular project you're trying to build, except inasmuch as the project is trying to use g77 in the first place. That is a bit surprising, actually, since g77 has been obsolete for years (gfortran is the current GNU Fortran compiler), but I'm uncertain what exactly to expect from XCode in this area.
On the other hand, since the full path to the binary is /usr/local/bin/g77, I'm further inclined to think that you're not using XCode for this at all. Possibly you've dumped a g77 built on some other system into your /usr/local/bin, and it's not compatible with your Mojave system.
Your best bet is probably to
Get rid of your broken g77 installation.
Install Fink or MacPorts, or a similar project.
Install the Fink / MacPorts / whatever package for gfortran (maybe gcc-gfortran or similar in some of those) to get a working Fortran compiler.
Rely on that compiler to build your project.

Nim compiler fails with "Requested command not found: gcc.exe"

I tried to launch first program in nim. I downloaded Windows installer from the official site and did the installation with all possible components. But when I try to run the program I get the message:
"unhandled exception: Requested command not found: 'gcc.exe -c -w -IC:nimlib -o
c:nimworknimcacheaa.o c:nimworknimcacheaa.c'. OS error: [OSError] >
Process terminated with exit code 1"
is it possible to fix this situation?
From Nim's website:
Note: The Nim compiler requires a C compiler to compile software. On Windows we recommend that you use Mingw-w64. GCC is recommended on Linux and Clang on Mac.
Make sure to add the gcc binaries to your PATH.
download nim lag and exract the file and paste it in your directory lib

Can't compile gegl (gimp) on PPC Leopard

I compile gegl-0.2.0 (needed to compile gimp-2.8) on PowerPC Mac Leopard 10.5.4.
All other programs such as glib-2.38.2, intltool-0.50.2 and babl which are necessary to compile gimp have been compiled fine.
I have this kind of errors while compiling gegl:
GEGL-geglmodule.c-Message: Module '../../operations/common/.libs/layer.so.dSYM
/Contents/Resources/DWARF/layer.so' load error: dlopen(../../operations/common
/.libs/layer.so.dSYM/Contents/Resources/DWARF/layer.so, 10): no suitable image found.
Did find
../../operations/common/.libs/layer.so.dSYM/Contents/Resources/DWARF/layer.so: can't map
I get this for each .so file produced by gegl, such as box-blur.so, brightness-contrast.so, motion-blur.so, contrast-curve.so, etc. Also I get this kind of errors for each of those .so files:
warning: no debug symbols in executable (-arch ppc)
CC motion-blur.c
CCLD motion-blur.la
The env variables are:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export CPPFLAGS="-I/usr/local/include:/usr/include -fno-inline"
export LIBS=-L/usr/local/lib
export CFLAGS="-Wno-long-double -arch ppc -fno-inline"
export DYLD_LIBRARY_PATH=/usr/X11/lib
If I remove the DYLD_LIBRARY_PATH variable, an error like "libjpeg.dylib,libpng.dylib,libtiff.dylib and libgl.dylib can't be found" comes up.
The compiler I use is (Apple) gcc-3.3, but the same errors come up if I use gcc-4.0 or gcc-4.2. I don't use XCode for anything.
What's the basic problem here and how to solve it? Thanks.
After some research, I discovered that the only way to prevent this error from happening was to prevent CC from producing dsym code. Surely it 's not so simple as it's in Xcode. It turned out that I had to edit the Makefile. There at the 188th line was:
DSYMUTIL = 'dsymutil'
I made it:
DSYMUTIL= ''
and that prevented dsym from being generated and I finally got rid of that error.
But after that I I got another error, about some "xxx.xml" file. To solve it, I added this to configure command:
./configure --disable-docs
Then I got the gegl perfectly compiled. FYI.

xcode gcc compiler showing argument list too long

i m trying to complie a .cpp file in Xcode 3.2.6 in Snow Leapord 10.6.8.
I m getting
i686-apple-darwin10-gcc-4.2.1: error trying to exec '/Developer/usr/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/cc1plus': execv: Argument list too long
Command /Developer/usr/bin/gcc-4.2 failed with exit code 1
while compiling using gcc 4.2 and even tried compiling with gcc 4.0
Can someone provide any pointers on how to resolve this?
Thanks in advance.
I'm not working with Mac, but had the same error on Ubuntu. I pass too much of arguments to gcc input. Try to check your gcc parameters.

MATLAB MEX can't find standard library with XCode 4.3 (Mac)

I am getting started with using MEX files for MATLAB (R2012a) compiled from C code (using XCode 4.3) on my Mac (running OSX 10.7.3, Lion). I have already installed the MATLAB provided XCode patch which configures MATLAB to use the new llvm-gcc compiler under XCode 4.2+, but I am still getting the following error attempting to compile the example file using mex timestwo.c:
/Applications/MATLAB_R2012a.app/extern/include/matrix.h:852:20: error: stdlib.h: No such file or directory
In file included from timestwo.c:1:
/Applications/MATLAB_R2012a.app/extern/include/mex.h:161:19: error: stdio.h: No such file or directory
The compilation then breaks
mex: compile of ' "timestwo.c"' failed.
Error using mex (line 206)
Unable to complete successfully.
Clearly, the compiler can't find the standard library header directory, but what do I need to change to successfully compile?
Ah, found it!
The MATLAB provided template uses /Developer/... for the SDK location, but this changed under XCode4.3 to live under the XCode.app. To fix things, I had to edit my ~/.matlab/R2012a/mexopts.sh file to set the SDKROOT directory to the new location.
To do this, search for SDKROOT in the mexopts.sh file and change it to read:
SDKROOT='/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/'
Note, I chose the 10.7 sdk b/c I am on Lion. Use 10.6 if you are on Snow Leopard
I am running Mac Mountain Lion and Matlab R2012b, and the following solution worked for me: Matlab 2012a Mex to work with Xcode 4.5 on Mountain Lion
To be precise,
I was getting the following errors:
error: stdio.h: No such file or directory
error: stdlib.h: No such file or directory
error: math.h: No such file or directory
So what I did to solve this issue:
I installed Xcode with Command Line Tools, and then edited the file "/Applications/MATLAB_R2012b.app/bin/mexopts.sh" by:
changing CC from gcc-4.2 to llvm-gcc-4.2
changing CXX from gcc-4.2 to llvm-g++-4.2
setting SDKROOT to '/'
Then I ran "mex -setup" in MATLAB, chose number 1, and chose y to overwrite the old /Users/insertyournamehere/.matlab/R2012b/mexopts.sh
That solved it :)
You will find valuable information here: http://www.mathworks.fr/support/solutions/en/data/1-FR6LXJ/

Resources