2016-09-30 04:27 BST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000015OpenFOAM[All Projects] Bugpublic2010-08-31 16:08
Reporterl_r_mcglashan 
Assigned Touser4 
PrioritylowSeveritytweakReproducibilityN/A
StatusresolvedResolutionfixed 
PlatformLinuxOSFedoraOS Versionfc13.x86_64
Product Version 
Target VersionFixed in Version 
Summary0000015: DSO Link Issues
DescriptionIt appears that there is a lot of implicit linking with the Pstream library for many of the applications. In Fedora 13 this is no longer allowed:

http://fedoraproject.org/wiki/UnderstandingDSOLinkChange

Running Allwmake results in most of the applications failing to be built.
Steps To ReproduceRunning wmake on (as an example) potentialFoam leads to:

SOURCE=potentialFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/home/lrm29/github/OpenFOAM-1.7.x.f13/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/lrm29/github/OpenFOAM-1.7.x.f13/src/OpenFOAM/lnInclude -I/home/lrm29/github/OpenFOAM-1.7.x.f13/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/potentialFoam.o
/home/lrm29/github/OpenFOAM-1.7.x.f13/src/finiteVolume/lnInclude/readSIMPLEControls.H: In function ‘int main(int, char**)’:
/home/lrm29/github/OpenFOAM-1.7.x.f13/src/finiteVolume/lnInclude/readSIMPLEControls.H:6: warning: unused variable ‘momentumPredictor’
/home/lrm29/github/OpenFOAM-1.7.x.f13/src/finiteVolume/lnInclude/readSIMPLEControls.H:9: warning: unused variable ‘transonic’
g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/home/lrm29/github/OpenFOAM-1.7.x.f13/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/lrm29/github/OpenFOAM-1.7.x.f13/src/OpenFOAM/lnInclude -I/home/lrm29/github/OpenFOAM-1.7.x.f13/src/OSspecific/POSIX/lnInclude -fPIC Make/linux64GccDPOpt/potentialFoam.o -L/home/lrm29/github/OpenFOAM-1.7.x.f13/lib/linux64GccDPOpt \
         -/home/lrm29/github/OpenFOAM-1.7.x.f13/lib/linux64GccDPOpt/openmpi-1.4.1/lPstream -lfiniteVolume -lOpenFOAM -liberty -ldl -lm -o /home/lrm29/github/OpenFOAM-1.7.x.f13/applications/bin/linux64GccDPOpt/potentialFoam
g++: unrecognized option '-/home/lrm29/github/OpenFOAM-1.7.x.f13/lib/linux64GccDPOpt/openmpi-1.4.1/lPstream'
/usr/bin/ld: Make/linux64GccDPOpt/potentialFoam.o: undefined reference to symbol 'Foam::OPstream::write(Foam::Pstream::commsTypes, int, char const*, long)'
/usr/bin/ld: note: 'Foam::OPstream::write(Foam::Pstream::commsTypes, int, char const*, long)' is defined in DSO /home/lrm29/github/OpenFOAM-1.7.x.f13/lib/linux64GccDPOpt/openmpi-1.4.1/libPstream.so so try adding it to the linker command line
/home/lrm29/github/OpenFOAM-1.7.x.f13/lib/linux64GccDPOpt/openmpi-1.4.1/libPstream.so: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [/home/lrm29/github/OpenFOAM-1.7.x.f13/applications/bin/linux64GccDPOpt/potentialFoam] Error 1

A possible fix would be to change Make/options for (as an example) potentialFoam from

EXE_INC = \
    -I$(LIB_SRC)/finiteVolume/lnInclude

EXE_LIBS = -lfiniteVolume

to

EXE_INC = \
    -I$(LIB_SRC)/finiteVolume/lnInclude

EXE_LIBS = -L$(FOAM_MPI_LIBBIN) \
           -lPstream \
           -lfiniteVolume

Alternatively the wmake rules could be altered, although I'm not sure how to prevent unnecessary linking to libraries that don't require Pstream.
Additional InformationI wasn't sure whether to report this, but I suppose it's possible that this may become more widespread in other OS's in the future.
TagsInstallation
Attached Files

-Relationships
+Relationships

-Notes

~0000008

l_r_mcglashan (reporter)

Woops, the error message should be:

SOURCE=potentialFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/home/lrm29/github/OpenFOAM-1.7.x.f13/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/lrm29/github/OpenFOAM-1.7.x.f13/src/OpenFOAM/lnInclude -I/home/lrm29/github/OpenFOAM-1.7.x.f13/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/potentialFoam.o
/home/lrm29/github/OpenFOAM-1.7.x.f13/src/finiteVolume/lnInclude/readSIMPLEControls.H: In function ‘int main(int, char**)’:
/home/lrm29/github/OpenFOAM-1.7.x.f13/src/finiteVolume/lnInclude/readSIMPLEControls.H:6: warning: unused variable ‘momentumPredictor’
/home/lrm29/github/OpenFOAM-1.7.x.f13/src/finiteVolume/lnInclude/readSIMPLEControls.H:9: warning: unused variable ‘transonic’
g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/home/lrm29/github/OpenFOAM-1.7.x.f13/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/lrm29/github/OpenFOAM-1.7.x.f13/src/OpenFOAM/lnInclude -I/home/lrm29/github/OpenFOAM-1.7.x.f13/src/OSspecific/POSIX/lnInclude -fPIC Make/linux64GccDPOpt/potentialFoam.o -L/home/lrm29/github/OpenFOAM-1.7.x.f13/lib/linux64GccDPOpt \
         -lfiniteVolume -lOpenFOAM -liberty -ldl -lm -o /home/lrm29/github/OpenFOAM-1.7.x.f13/applications/bin/linux64GccDPOpt/potentialFoam
/usr/bin/ld: Make/linux64GccDPOpt/potentialFoam.o: undefined reference to symbol 'Foam::OPstream::write(Foam::Pstream::commsTypes, int, char const*, long)'
/usr/bin/ld: note: 'Foam::OPstream::write(Foam::Pstream::commsTypes, int, char const*, long)' is defined in DSO /home/lrm29/github/OpenFOAM-1.7.x.f13/lib/linux64GccDPOpt/openmpi-1.4.1/libPstream.so so try adding it to the linker command line
/home/lrm29/github/OpenFOAM-1.7.x.f13/lib/linux64GccDPOpt/openmpi-1.4.1/libPstream.so: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [/home/lrm29/github/OpenFOAM-1.7.x.f13/applications/bin/linux64GccDPOpt/potentialFoam] Error 1

~0000009

user4

Thanks for the reference. What a strange behaviour to make default.

Can you try adding -Xlinker --add-needed to the link line? So in $WM_DIR/rules/linux64Gcc/c++ change LINKLIBSO to:

LINKLIBSO = $(CC) $(c++FLAGS) -shared -Xlinker --add-needed

Can you let us know if this works?

~0000013

l_r_mcglashan (reporter)

I see, the Fedora GCC now has the default option --no-add-needed! Well spotted. I can see why they made the change, although in this case it's just annoying rather than helpful.

This worked, as it was the applications that had the problem:

LINKEXE = $(CC) $(c++FLAGS) -Xlinker --add-needed

~0000014

user4

I've pushed that into 17x.

commit 2a888da4797b5e6b203f7fa4c3f64468c3973429

Thanks.

~0000015

user4

commit 2a888da4797b5e6b203f7fa4c3f64468c3973429
+Notes

-Issue History
Date Modified Username Field Change
2010-08-28 10:40 l_r_mcglashan New Issue
2010-08-28 10:44 l_r_mcglashan Note Added: 0000008
2010-08-30 17:42 user4 Note Added: 0000009
2010-08-31 09:40 user2 Assigned To => user4
2010-08-31 09:40 user2 Status new => assigned
2010-08-31 10:23 l_r_mcglashan Note Added: 0000013
2010-08-31 10:36 user2 Tag Attached: Installation
2010-08-31 16:05 user4 Note Added: 0000014
2010-08-31 16:08 user4 Note Added: 0000015
2010-08-31 16:08 user4 Status assigned => resolved
2010-08-31 16:08 user4 Fixed in Version => 1.7.x
2010-08-31 16:08 user4 Resolution open => fixed
+Issue History