[SOLVED] Error When Performing "make all" : /usr/bin/ld: -f may not be used without -shared
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Error When Performing "make all" : /usr/bin/ld: -f may not be used without -shared
Software: CosmoMC
Today, after I have successfully compiled the camb, the CFITSIO and WMAP_5yr_likelihood_v3(whchi I have ran "make check" to make sure it was properly compiled) , I ran "make all" in the source subdirectory and an error poped out.
Here is my Makefile in the source subdirectory(the green part denotes the step which the error occured):
#You may need to edit the library paths for MKL for Intel
#Beware of using optmizations that lose accuracy - may give errors when running
#Edit for CFITSIO directories
cfitsio = /home/limh/mywork/cfitsio_81
#/usr/local/Cluster-Users/cpac/cmb/2.1.0/cfitsio
WMAP = /home/limh/mywork/WMAP5/likelihood_v3
IFLAG = -I
INCLUDE=
#Intel MPI (assuming mpif77 set to point to ifort)
#change -lmkl_ia32 to -lmkl_p3 for MKL versions earlier than 6 (6 needed for ifc 8+)
F90C = gfortran
FFLAGS = -O2 -ffree-form
LAPACKL = -Wl,-framework -Wl,accelerate
...
PROPOSE = propose.o
CLSFILE = CMB_Cls_simple.o
#Can use params_H if you prefer more generic parameters
PARAMETERIZATION = params_CMB.o
WMAP_inc = $(IFLAG)$(cfitsio)/include $(IFLAG)$(WMAP)
WMAP_lib = -L$(cfitsio)/lib -L$(WMAP) -lcfitsio
CLSLIB = $(WMAP_lib) -L../camb -lcamb $(LAPACKL)
F90FLAGS = -DMATRIX_SINGLE $(FFLAGS) $(WMAP_inc) $(IFLAG)../camb $(INCLUDE)
DISTFILES = utils.o Matrix_utils.o settings.o GetDist.o
WMAPOBJS = $(WMAP)/read_archive_map.o \
$(WMAP)/read_fits.o \
$(WMAP)/WMAP_5yr_options.o \
$(WMAP)/WMAP_5yr_util.o \
$(WMAP)/WMAP_5yr_tt_pixlike.o \
$(WMAP)/WMAP_5yr_likelihood.o \
$(WMAP)/WMAP_5yr_gibbs.o \
$(WMAP)/WMAP_5yr_tt_beam_ptsrc_chisq.o \
$(WMAP)/br_mod_dist.o
OBJFILES= $(WMAPOBJS) utils.o Matrix_utils.o settings.o cmbtypes.o Planck_like.o \
cmbdata.o WeakLen.o mpk.o supernovae.o SDSSLy-a-v3.o\
$(CLSFILE) paramdef.o $(PROPOSE) $(PARAMETERIZATION) calclike.o \
conjgrad_wrapper.o EstCovmat.o postprocess.o MCMC.o driver.o
I am by no means an expert and don't understand the error message, so could you please help me? Any advice is welcome.
Thanks a lot for your help!
A desperate fish
Error: usr/bin/ld: -f may not be used without -shared
Man page for gfortran:
Code:
-ffree-form
-ffixed-form
Specify the layout used by the source file. The free form layout was introduced in Fortran 90.
Fixed form was traditionally used in older Fortran programs. When neither option is specified, the
source form is determined by the file extension.
I'll take a wild stab at the situation here..
The linker is telling you that to use the -f option, as in -ffree-form, that you need to use the -shared option as well. Alternately, you could remove the -ffree-form option from the FFLAGS and eliminate the problem (theoretically).
According to the man page section above, those two options can/will be automatically determined by the linker, based on file extensions. So you should be able to get by without it.
So, if it were me, I would edit the "Flags" line I put at the very top of this post, and change it to ONE of the following:
FFLAGS = -O2
or
FFLAGS = -O2 -ffree-form -shared
and see if it works.
NOTE: I'm not any kind of expert with Fortran, or with GCC/G77/G90 for that matter, but I base my suggestion on experience with similar, pesky errors, when building C/C++ stuff for my system. Therefore, there's no guarantees here that this will work, and if it DOES, there's no guarantees that the end result will be as expected.
Good luck!
Sasha
Last edited by GrapefruiTgirl; 08-27-2009 at 09:06 PM.
Hi ,Sasha~^-^
After I have removed the "-f may not be used without shared" problem,
I stepped into another one:
/usr/bin/ld: accelerate: No such file: No such file or directory
collect2: ld returned 1
make: *** [cosmomc] Error 1
Maybe it is more luminous--that is to say I don't have a file called "accelerate" in the camb subdirectory, but I don't have a "framework" or "ramework" as well! Why didn't the program report that it couldn't find the framework ,but the "accelerate"?
Maybe it was due to the "-" before the "ramework",I think.But I don't know well enough. I don't know what the line "LAPACKL = -Wl,-framework -Wl,accelerate" mean. What is -Wl?
-Wl is a label indicating the beginning of a list of things that the linker should include. The intention is so that the linker doesn't "forget" to include ALL items in the list, when doing its job. For example:
-Wl,hello, goodbye, testing, biggleboggle,-Wl
makes sure that the linker included everything between the -Wl tags.
Code:
From "man ld":
Note---if the linker is being invoked indirectly, via a compiler driver (e.g. gcc) then all the linker
command line options should be prefixed by -Wl, (or whatever is appropriate for the particular compiler
driver) like this:
gcc -Wl,--startgroup foo.o bar.o -Wl,--endgroup
This is important, because otherwise the compiler driver program may silently drop the linker options,
resulting in a bad link.
try:
shell# man ld
for the exact syntax & context.
I think you may be right: try removing that leading dash, in front of "framework"
While waiting for your reply, I had turned to the "Intel® Fortran Compiler User and Reference Guides" for help and find that "-Wl" is one of the options of the compiler,which I didn't find in other Fortran User Guides. so I think it is an unique option of the Intel Fortran compiler. I used the Gfortran compiler,maybe the compiler couldn't recognized the "-Wl" and then came the error.
Solution: I drop this "bizarre" line in the Makefile and go on "make all". It worked!! But with 3 warnings about the syntex "Goto" in the codes. I will go on to see whether the difference of compilers would bring any problem in running the program.
Thank you for your generous and prompt help for a fish! You can contact me via my email. Discussing with you is a great time for me!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.