I try to use packages that use scipy.weave for numeric optimization, and are met with a CompileError from the scipy.weave.inline calls.
Some experimentation brings out a minimal failing example:
import scipy.weave
scipy.weave.inline('printf("%d\\n",1);')
which results in a massive error dump that I for space reason have put on pastebin: http://pastebin.com/0QR4kq2V
The first error in the dump is
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/complex:47:28: error: bits/c++config.h: No such file or directory
and the last output is
CompileError: error: Command "g++ -fno-strict-aliasing -fno-common -dynamic -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -DNDEBUG -g -O3 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -I/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/scipy/weave -I/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/scipy/weave/scxx -I/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/7.3/include/python2.7 -c /Users/mik/.python27_compiled/sc_f6039f30c0a12f4687924b6a12ef83730.cpp -o /var/folders/_z/qd8rt65n1n56_nvv4nyy7xlh0000gn/T/mik/python27_intermediate/compiler_ecdbc4f3f030692747d93319f8d429b2/Users/mik/.python27_compiled/sc_f6039f30c0a12f4687924b6a12ef83730.o" failed with exit status 1
I run MacOSX 10.8.4,
> g++ --version
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
and
> python --version
Python 2.7.3 -- EPD 7.3-2 (32-bit)
I've not used weave at all myself, so I don't know if it has specific SDK requirements, but I suspect that the issue is that you should not be using the 10.5 SDK with the newer Xcode that you appear to be using. I also have that version and it only has the 10.7 and 10.8 SDKs installed. Several releases back Xcode stopped using the /Developer folder and it is all installed inside the Xcode application bundle now. So the first thing I would try would be to move /Developer somewhere out of the way and try building again and see if that takes care of it. If so then you should be able to remove /Developer entirely.
Related
I've been trying to get gfortran working on MacOs Ventura(with a M1 chip) for quite some time.
Briefly, the big problem is that gfortran works (when installed via homebrew) until the moment I install Anaconda/conda. After installing Conda, gfortran stops working and I don't know how to make it work correctly. And I need both (conda and gfortran) installed and working.
If I install gcc via homebrew, gfortran works perfectly(version 12.2.0). However, when installing Conda the following message appears when I try to compile something in fortran(in this case it was just a "Hello World"):
gfortran hello.f90 -o trash
ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/lib/libSystem.tbd' for architecture arm64
collect2: error: ld returned 1 exit status
To get around this, I uninstalled gcc from homebrew and installed it using Conda. I installed the latest available version(11.2.0) using conda install gfortran=11.2.0.
gfortran —version
gfortran: warning: could not understand version 13.02.00
GNU Fortran (GCC) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
And when I run "which gfortran”, it returns:
/Users/Odilon/opt/anaconda3/bin/gfortran
However, when trying to compile something the following message is displayed(I am using gfortran hello.f90 -o trash, where "trash" is just the name of the executable I chose):
gfortran: warning: could not understand version 13.02.00
ld: -rpath can only be used when targeting Mac OS X 10.5 or later
collect2: error: ld returned 1 exit status
xcode is in the last version(14.2) and Command Line tools is installed.
I need gfortran and conda to be installed and working normally on the MacOS.
How do I resolve these errors?
How can I make gfortran work normally even with Conda installed on the system?
Thanks in advance for the answers and help!
The new MacOS Ventura seems to have broken gfortran MacOS version control. To reproduce my error you only have to do
gfortran --version
And the output is
gfortran: warning: could not understand version ‘13.00.00’
GNU Fortran (GCC) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This in itself is just a warning so it might not be a big deal but it breaks "./configure" scripts that require some MacOS versions, e.g. if you try to compile LoopTools you get the following error (in the log file)
arm64-apple-darwin20.0.0-gfortran: warning: could not understand version '13.00.00'
ld: -rpath can only be used when targeting Mac OS X 10.5 or later
collect2: error: ld returned 1 exit status
Since the version cannot be properly read it cannot be compared.
Is there some sort of work around this bug?
I had installed gfortran through conda but aparantly the version is from last year.
I solved it by removing it from conda (had to remove conda entirely due to linking issues) and installed it with brew : brew install gcc.
I am usually coding on OSX and compile all my program with : -Wall -Wextra -Werror
I download on another laptop nixos and when i want to compile the same project, i have -Wunused-result error.
I can disable it with : -Wno-unused-result but why this flag error appear on this os ?
I found nowhere a default flag configuration file or environment variable.
For curious the program i'm trying to compile is : libft.
If you're compiling on OSX and haven't installed gcc, Apple has provided clang pretending to be gcc. The pretense isn't very good, since there are a lot of differences in warnings (and exit-codes). You can see what you are running using
gcc --version
and (for instance ‐ I have installed gcc using MacPorts under /opt):
$ path -lL gcc
-rwxr-xr-x 3 root admin 1131416 Jun 10 2016 /opt/local/bin/gcc
-rwxr-xr-x 1 root wheel 18176 Jul 8 22:52 /usr/bin/gcc
$ /opt/local/bin/gcc --version
gcc (MacPorts gcc5 5.4.0_0) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ /usr/bin/gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
As you can see, /usr/bin/gcc is really clang, and (barring Apple improving things further), will produce similar messages.
On OS X 10.11.6, I installed gcc 6.2.0 using homebrew. It lives over in usr/local/Cellar/gcc/6.2.0/bin. After getting it to link (it didn't do this automagically), I cd there and try the solution from this other thread to create an alias
ln -s gcc-6 gcc
then gcc --version gives me
cc (GCC) 4.9.2 20141029 (prerelease)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
All this is because trying to install things crashes because of -rdynamic flags, that I hope is fixed in a newer version.
You created the symlink with the proper target name (gcc) but forgot to set the PATH to your newly installed location (or set it after the system path).
What's confusing is that your system already has a version of gcc installed. You have to override the default path so your gcc command comes first.
edit your ~/.profile file and check PATH adjustment. Add a line in the end which contains:
export PATH=/usr/local/Cellar/gcc/6.2.0/bin:$PATH
Then open a new terminal and ensure that which gcc prints
/usr/local/Cellar/gcc/6.2.0/bin/gcc
I seek some help with 2 Makefiles for 2 different software that are much older than my iMAC machine. I think the software assumes the C compiler to be GCC, while my new iMAC has CLANG as default I think...
I know there are some other threads on this general topic such as at : Compile program using a Makefile with gcc instead of clang
But I wonder if there are Makefile specific modifications for these 2 software that you can suggest I perform. I dont have any experience with modifying Makefiles or flags etc.
The 2 Makefiles and the software that they come from can be all accessed from the folder at Dropbox. Thank you!
My make attempt for mdust looks like this:
Checked http://b110-wiki.dkfz.de/confluence/display/nextrnai/Step-by-step+installation+on+MAC for details on
Installation of mdust
Mdust can be downloaded via this link.
Unpack the file. In the folder created open fastafile.c and delete the third line #include (malloc.h is not needed under Mac OS X, but leads to an error with make). Finally typemake (ignore warnings) which creates the mdust script required by NEXT-RNAi (compilation requires prior installation of Apple Developer Tools / Xcode).
tar -xvzf mdust.tar.gz
cd mdust
emacs fastafile.c (delete line include )
make
So I opened fastafile.c with vi and deleted the
line include
But now, when I try make, I think I see CLANG Vs gcc compiler issues.
DCook04-2:mdust anand$ make
gcc -O2 -Wall -I. -I- -D_REENTRANT -c fastafile.c -o fastafile.o
clang: error: '-I-' not supported, please use -iquote instead
make: *** [fastafile.o] Error 1
My make attempt for RECON may have worked, only warning, no errors per STDOUT. Longer STDOUT, so in folder with link above, and obviously named file.
More info that's hopefully relevant:
DCook04-2:src anand$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
DCook04-2:src anand$ clang -v
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix