Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26747 Discussions

ifort: command line error: '-fminshared' conflicts with '-fpic'

江_捷_
Beginner
173 Views

I am using the latest code CAMB 2017-Jan with latest OSX 10.12.3 and latest ifort 17.0.2,when I run make there comes

Kongs-MacBook-Pro:CAMB-Jan2017 jiangjie$ make
mkdir -p Release
ifort -fast -W0 -WB -fpp  -qopenmp -module Release -IRelease/ -c constants.f90 -o Release/constants.o
ifort -fast -W0 -WB -fpp  -qopenmp -module Release -IRelease/ -c utils.F90 -o Release/utils.o
ifort -fast -W0 -WB -fpp  -qopenmp -module Release -IRelease/ -c subroutines.f90 -o Release/subroutines.o
ifort -fast -W0 -WB -fpp  -qopenmp -module Release -IRelease/ -c inifile.f90 -o Release/inifile.o
ifort -fast -W0 -WB -fpp  -qopenmp -module Release -IRelease/ -c power_tilt.f90 -o Release/power_tilt.o
ifort -fast -W0 -WB -fpp  -qopenmp -module Release -IRelease/ -c recfast.f90 -o Release/recfast.o
ifort -fast -W0 -WB -fpp  -qopenmp -module Release -IRelease/ -c reionization.f90 -o Release/reionization.o
ifort -fast -W0 -WB -fpp  -qopenmp -module Release -IRelease/ -c modules.f90 -o Release/modules.o
ifort -fast -W0 -WB -fpp  -qopenmp -module Release -IRelease/ -c bessels.f90 -o Release/bessels.o
ifort -fast -W0 -WB -fpp  -qopenmp -module Release -IRelease/ -c equations.f90 -o Release/equations.o
ifort -fast -W0 -WB -fpp  -qopenmp -module Release -IRelease/ -c halofit_ppf.f90 -o Release/halofit_ppf.o
ifort -fast -W0 -WB -fpp  -qopenmp -module Release -IRelease/ -c lensing.f90 -o Release/lensing.o
ifort -fast -W0 -WB -fpp  -qopenmp -module Release -IRelease/ -c SeparableBispectrum.F90 -o Release/SeparableBispectrum.o
ifort -fast -W0 -WB -fpp  -qopenmp -module Release -IRelease/ -c cmbmain.f90 -o Release/cmbmain.o
ifort -fast -W0 -WB -fpp  -qopenmp -module Release -IRelease/ -c camb.f90 -o Release/camb.o
ifort -fast -W0 -WB -fpp  -qopenmp -module Release -IRelease/ Release/constants.o  Release/utils.o   Release/subroutines.o Release/inifile.o  Release/power_tilt.o  Release/recfast.o Release/reionization.o Release/modules.o Release/bessels.o Release/equations.o Release/halofit_ppf.o Release/lensing.o Release/SeparableBispectrum.o Release/cmbmain.o Release/camb.o inidriver.F90 -cxxlib -o camb
mkdir -p Releaselib
ifort -shared -fpic -fast -W0 -WB -fpp  -qopenmp -module Releaselib -IReleaselib/ -c constants.f90 -o Releaselib/constants.o
ifort: command line error: '-fminshared' conflicts with '-fpic'
make: *** [Releaselib/constants.o] Error 1

I know nothing about fortran and just want to run the code, can anybody help me fix the problem? Thanks very much.

0 Kudos
3 Replies
Kevin_D_Intel
Employee
173 Views

The –shared option is not a valid option on macOS with ifort. The equivalent option is –dynamiclib. However, given the presence of the –c in the command-line, it is not clear a dynamic library is attempting to be built at the point of the failure in the makefile.

If the app’s build process at some point builds a dynamic library, then perhaps the –shared option should be replaced with –dynamiclib somewhere downstream in the makefile.

It is probably best that you check with the providers of the application about the best course of action regarding this error.

Steve_Lionel
Black Belt Retired Employee
173 Views

The documentation of -fminshared says:

This option specifies that a compilation unit is a component of a main program and should not be linked as part of a shareable object.

This option allows the compiler to optimize references to defined symbols without special visibility settings. To ensure that external and common symbol references are optimized, you need to specify visibility hidden or protected by using the -fvisibility-fvisibility-hidden, or -fvisibility-protectedoption.

Also, the compiler does not need to generate position-independent code for the main program. It can use absolute addressing, which may reduce the size of the global offset table (GOT) and may reduce memory traffic.

It sure reads to me that you can't use this option and -shared at the same time.

Kevin_D_Intel
Employee
173 Views

Perhaps we have a new driver issue w/17.02 as well. I do not see this message when mixing -shared -fpic with 17.0 initial release but the OP is using 17.0.2. -shared should be ignored from my understanding. I'll investigate further.

Reply