Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[problem when installation] cannot find -lgfortran #6150

Closed
tndoan opened this issue Mar 13, 2014 · 12 comments
Closed

[problem when installation] cannot find -lgfortran #6150

tndoan opened this issue Mar 13, 2014 · 12 comments

Comments

@tndoan
Copy link

tndoan commented Mar 13, 2014

I have problem during the installation of Julia in CentOS 6.5. My make command is

 make USE_SYSTEM_LLVM=1

and the output is

 END OF TESTS
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make[4]: *** [../libopenblasp-r0.2.8.so] Error 1
make[3]: *** [shared] Error 2
*** Clean the OpenBLAS build with 'make -C deps clean-openblas'. Rebuild with 'make OPENBLAS_USE_THREAD=0 if OpenBLAS had trouble linking libpthread.so, and with 'make OPENBLAS_TARGET_ARCH=NEHALEM' if there were errors building SandyBridge support. Both these options can also be used simultaneously. ***
make[2]: *** [openblas-v0.2.8/libopenblas.so] Error 1
make[1]: *** [julia-release] Error 2
make: *** [release] Error 2

make -C deps getall is also used but the problem is still the same.
I have found one old solution but it needs to downgrade the gcc. Is it necessary? Are there any way to solve the problem? There is one more solution but the symbol link already exists in my computer.

One more thing is that I don't have root privilege so installing new software is not easy for me.

@tkelman
Copy link
Contributor

tkelman commented Mar 13, 2014

You probably don't have gfortran installed. If you had root access, you could just run yum install gcc-fortran. Without root access, you can try downloading an appropriate rpm for your system - something like ftp://fr2.rpmfind.net/linux/centos/6.5/os/i386/Packages/gcc-gfortran-4.4.7-4.el6.i686.rpm for 32 bit, or ftp://fr2.rpmfind.net/linux/centos/6.5/os/x86_64/Packages/gcc-gfortran-4.4.7-4.el6.x86_64.rpm for 64 bit. Then you can try installing the rpm locally in your home folder via these steps http://ajaya.name/?p=6353

@tndoan
Copy link
Author

tndoan commented Mar 13, 2014

Thanks @tkelman for your quick response but I dont think because I could run the gfortran. Here is the proof

$ gfortran --version
GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)
Copyright (C) 2010 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

@tkelman
Copy link
Contributor

tkelman commented Mar 13, 2014

What is gcc --version then? How about gfortran -print-file-name=libgfortran.so? You probably need to add LDFLAGS=-L/path/to/libgfortran or something to that effect.

@tndoan
Copy link
Author

tndoan commented Mar 13, 2014

Here is the output of 2 commands

$ gcc --version
gcc (GCC) 4.7.2 20121015 (Red Hat 4.7.2-5)
Copyright (C) 2012 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

$ gfortran -print-file-name=libgfortran.so
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgfortran.so

I have followed your instruction by adding export LDFLAGS=-L/usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgfortran.so but it does not work.

@tkelman
Copy link
Contributor

tkelman commented Mar 13, 2014

Take off the libgfortran.so at the end, -L flags should just be folders not files.

This issue should be reported upstream on OpenBlas' tracker, if it isn't there already (@xianyi?). OpenBlas is using $(CC) to link the shared library, probably to handle cases where there is no Fortran compiler available. When a Fortran compiler is being used, it adds -lgfortran and hopes that will be enough. If gcc and gfortran are all the same version and have the same library paths, then that usually works.

In your case you have a newer version of gcc than gfortran. What does gcc -print-file-name=libgfortran.so say? If it just says libgfortran.so without any more detailed path, that means your newer gcc installation doesn't include Fortran. The best solution would be to use the Fortran compiler front-end for linking the shared library when Fortran is being used in OpenBlas. You could also maybe force using the older version of gcc (and g++) when you build Julia, using CC and CXX environment variables.

@tndoan
Copy link
Author

tndoan commented Mar 14, 2014

You are right, after changing to export LDFLAGS=-L/usr/lib/gcc/x86_64-redhat-linux/4.4.7/, it is ok and the installation continues running. However, after a while, it prompts a new error

make[2]: llvm-config: Command not found

I guess I need to ask the admin to install llvm to the server. Thanks for your help.

@tndoan tndoan closed this as completed Mar 14, 2014
@tkelman
Copy link
Contributor

tkelman commented Mar 14, 2014

I guess I need to ask the admin to install llvm to the server.

If you don't have LLVM installed, then don't specify USE_SYSTEM_LLVM=1. Julia's makefiles will download the source and compile it for you if you leave that off.

@tndoan
Copy link
Author

tndoan commented Mar 14, 2014

In my first installation, I don't specify this option and the errors appear

llvm[5]: Linking Release executable FileCheck (without symbols)
/usr/bin/ld: /home/tndoan/julia/deps/llvm-3.3/build_Release/Release/bin/FileCheck: undefined reference to symbol 'pthread_cancel@@GLIBC_2.2.5'
/usr/bin/ld: note: 'pthread_cancel@@GLIBC_2.2.5' is defined in DSO /lib64/libpthread.so.0 so try adding it to the linker command line
/lib64/libpthread.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[5]: *** [/home/tndoan/julia/deps/llvm-3.3/build_Release/Release/bin/FileCheck] Error 1
make[4]: *** [FileCheck/.makeall] Error 2
make[3]: *** [all] Error 1
make[2]: *** [llvm-3.3/build_Release/Release/lib/libLLVMJIT.a] Error 2
make[1]: *** [julia-release] Error 2
make: *** [release] Error 2

After using this option, my installation could reach the point in previous post.

@tkelman
Copy link
Contributor

tkelman commented Mar 14, 2014

Hm, versioned symbols in libpthread. Try export LDFLAGS="-L/usr/lib/gcc/x86_64-redhat-linux/4.4.7/ -Wl,--no-as-needed"?

Or maybe export LDFLAGS="-L/usr/lib/gcc/x86_64-redhat-linux/4.4.7/ -L/lib64"

@tndoan
Copy link
Author

tndoan commented Mar 14, 2014

Hi, I have tried your solution but the error is still the same.

@tkelman
Copy link
Contributor

tkelman commented Mar 14, 2014

I'm not sure then. My RHEL 5 machine doesn't have this issue. Consider asking for help on the LLVM mailing list? And/or searching for RPM binary installations of llvm and llvm-devel.

@tndoan
Copy link
Author

tndoan commented Mar 14, 2014

ok. Thanks so much for your help 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants