View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000015OpenFOAM[All Projects] Bugpublic2010-08-28 09:402010-08-31 15:08
Reporterl_r_mcglashan 
Assigned Tomattijs 
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

-  Notes
(0000008)
l_r_mcglashan (reporter)
2010-08-28 09:44

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)
mattijs (manager)
2010-08-30 16:42

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)
2010-08-31 09:23

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)
mattijs (manager)
2010-08-31 15:05

I've pushed that into 17x.

commit 2a888da4797b5e6b203f7fa4c3f64468c3973429

Thanks.
(0000015)
mattijs (manager)
2010-08-31 15:08

commit 2a888da4797b5e6b203f7fa4c3f64468c3973429

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