Compilation error on OSX

128 views
Skip to first unread message

Jimmy Chapman

unread,
Jun 13, 2018, 1:03:06 PM6/13/18
to aenet
Hello,
I am trying to install the potential generator on OSX and I'm running into a library issue. I've posted the compiler error below, with the full invocation trace. Obviously the compiler can't find a given library, but I'm not really sure how to fix this. I've encountered the exact same error on 3 different OSX machines, but don't encounter this problem when using linux. I would use linux, but the more powerful machine happens to run OSX. Any help you can provide would be greatly appreciated. Please let me know if there's any more information you might need to understand this problem better. Thank you.

.
.
.
gcc -shared Lbfgsb.3.0/blas_pic.o    Lbfgsb.3.0/lbfgsb_pic.o Lbfgsb.3.0/linpack_pic.o Lbfgsb.3.0/timer_pic.o -lm -lgfortran -v -o liblbfgsb.so

Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -dylib -arch x86_64 -macosx_version_min 10.11.0 -o liblbfgsb.so Lbfgsb.3.0/blas_pic.o Lbfgsb.3.0/lbfgsb_pic.o Lbfgsb.3.0/linpack_pic.o Lbfgsb.3.0/timer_pic.o -lm -lgfortran -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.3.0/lib/darwin/libclang_rt.osx.a


ld: library not found for -lgfortran
.
.
.

Nongnuch Artrith

unread,
Jun 13, 2018, 1:49:49 PM6/13/18
to Jimmy Chapman, aenet
Hi Jimmy,

Which version of OS X or macOS are you using?

The error message means that libgfortran cannot be found. Depending on how you installed GNU Fortran on your system, it might be needed to set the path to the library by hand (i.e., by defining the LD_LIBRARY_PATH environment variable). I have never tried installing aenet on OS X myself, but there seem to be several options to install gfortran/libgfortran. You could try anaconda (https://anaconda.org/anaconda/libgfortran). Homebrew apparently has had issues with this in the past (https://github.com/Homebrew/legacy-homebrew/issues/8539), not sure if this has been resolved by now. You could also install manually from GNU (https://gcc.gnu.org/wiki/GFortranBinaries) but that will likely require defining LD_LIBRARY_PATH.

Let us know if one of those options works. I think this could be useful for other Mac users as well.

Best,
Nong

--
You received this message because you are subscribed to the Google Groups "aenet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aenet+unsubscribe@googlegroups.com.
To post to this group, send email to ae...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Jimmy Chapman

unread,
Jun 13, 2018, 2:12:21 PM6/13/18
to aenet
So I went the brew route and it seems to have worked. An interesting point though, the OS came with its own version of gcc in /usr/local/bin which for whatever reason doesn't seem to know what gfortran is. brew installed its own version of gcc labeled in the format gcc-*. By updating the makefile to use this version of gcc the compilation worked fine.

I am now able to use the generate.* binary, however, when attempting to train the model I encounter a second issue (I've posted the error below). Going into train.f90 I see that line 566 is read(nodes(1:i-1), *) arch(il+1). Again, any help you can provide is greatly appreciated. Thank you.

#########################################
 Creating a new Al network
At line 566 of file train.f90
Fortran runtime error: End of file

Error termination. Backtrace:
#0  0x10e96f2dc
#1  0x10e96fed5
#2  0x10e970669
#3  0x10e994a4b
#4  0x10e98d636
#5  0x10e98f089
#6  0x10e917552
#7  0x10e90e64d
#8  0x10e917e45

Jimmy Chapman

unread,
Jun 25, 2018, 3:33:12 PM6/25/18
to aenet


On Wednesday, June 13, 2018 at 11:12:21 AM UTC-7, Jimmy Chapman wrote:
So I went the brew route and it seems to have worked. An interesting point though, the OS came with its own version of gcc in /usr/local/bin which for whatever reason doesn't seem to know what gfortran is. brew installed its own version of gcc labeled in the format gcc-*. By updating the makefile to use this version of gcc the compilation worked fine.

I am now able to use the generate.* binary, however, when attempting to train the model I encounter a second issue (I've posted the error below). Going into train.f90 I see that line 566 is read(nodes(1:i-1), *) arch(il+1). Again, any help you can provide is greatly appreciated. Thank you.

#########################################
 Creating a new Al network
At line 566 of file train.f90
Fortran runtime error: End of file

Error termination. Backtrace:
#0  0x10e96f2dc
#1  0x10e96fed5
#2  0x10e970669
#3  0x10e994a4b
#4  0x10e98d636
#5  0x10e98f089
#6  0x10e917552
#7  0x10e90e64d
#8  0x10e917e45


Hello,
So I was able to fix this above issue by recompiling everything from scratch many times. At some point the code just worked. I'm now facing an issue with setting up the python interface. This can be easily solved but I need a bit of information from you. The issue is that I need to run brew's version of gcc as I mentioned previously. However I don't know where to change gcc to gcc-8 from the python setup files. Can you direct as to where gcc gets invoked during the python setup? Thank you.

Nong Artrith

unread,
Jun 25, 2018, 5:20:53 PM6/25/18
to aenet
Dear Jimmy,

I am afraid I am not sure if we can help as this is not really an aenet issue.  The GCC version should not matter, as the different versions are (hopefully) binary compatible.  In addition, you would have to configure the compiler for your computer, it is not hard-coded in the setup.py script.  Perhaps take a look at the distutils docs to figure out how to do that on the Mac?

Best,
Nong

Nongnuch Artrith

unread,
Jun 25, 2018, 5:49:09 PM6/25/18
to Jimmy Chapman, aenet
I understood your question, and the answer is that the gcc version is not hard-coded in our Python files.  There is no file that determines the compiler, it is rather a system default that is specific to your system and Python configuration.  However, I am not convinced that GCC versions are the issue here.  

Keep in mind, though, that the aenet library has to be compiled with 'gfortran' (the GNU Fortran compiler) to be compatible with 'gcc' (The GNU compiler collection).

Nong


On Mon, Jun 25, 2018 at 2:26 PM, Jimmy Chapman <jamescha...@gmail.com> wrote:
Perhaps I wasn't clear in my question. I am not asking a compiler related question, as I have already figured out the issues related to compilers via the mac I'm running this on. My question is directed at which file determines the compiler used during the python setup. I need to manually edit this location to update it from gcc to gcc-8 on this machine, but I cannot find where the compiler gets determined during the setup. There must be a file somewhere that gets called that determines which compiler to use when setup.py is called.

James Chapman 
Materials Science and Engineering 
Georgia Institute of Technology
Atlanta, Georgia

Reply all
Reply to author
Forward
0 new messages