unicfdlab / libAcoustics

libAcoustics - OpenFOAM library for far-field noise computation
139 stars 56 forks source link

compiling issue #102

Closed jansi143 closed 1 year ago

jansi143 commented 1 year ago

Hello together, i'm copmiling the libAcoustics on another machine today but haven't been successful yet. I compiled fftw-3.3.10, use openfoam2112-devel and try to compile libAcoustics-digitef-dev-2112 on openSUSE 15.4. Got a lot of output, some warnings but at the end following error. Do you know what to do here? Can you also tell me if it would be a problem to compile libAcoustics-2112 with openfoam-2212? I had other errors then. g++ -std=c++14 -m64 -pthread -DOPENFOAM=2112 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -Wno-unknown-pragmas -O3 -DNoRepository -ftemplate-depth-100 -I/usr/lib/openfoam/openfoam2112/src/randomProcesses/lnInclude -I/usr/lib/openfoam/openfoam2112/src/sampling/lnInclude -I../../../Sources/lib/lnInclude -I/usr/lib/openfoam/openfoam2112/ThirdParty/platforms/linux64Gcc/fftw-system/include -iquote. -IlnInclude -I/usr/lib/openfoam/openfoam2112/src/OpenFOAM/lnInclude -I/usr/lib/openfoam/openfoam2112/src/OSspecific/POSIX/lnInclude -fPIC -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPInt32Opt/FileInterface/FileInterface.o Make/linux64GccDPInt32Opt/Interpolator/Interpolator.o Make/linux64GccDPInt32Opt/surfaceNoise.o -L/usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib \ -lrandomProcesses -lsampling -L/home/janosch/OpenFOAM/janosch-2112/platforms/linux64GccDPInt32Opt/lib -lAcoustics -L/usr/lib/openfoam/openfoam2112/ThirdParty/platforms/linux64Gcc/fftw-system/lib -lfftw3 -lOpenFOAM -ldl \ -lm -o /home/janosch/OpenFOAM/janosch-2112/platforms/linux64GccDPInt32Opt/bin/surfaceNoise /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: cannot find -lAcoustics: No such file or directory collect2: error: ld returned 1 exit status make: *** [/usr/lib/openfoam/openfoam2112/wmake/makefiles/general:150: /home/janosch/OpenFOAM/janosch-2112/platforms/linux64GccDPInt32Opt/bin/surfaceNoise] Error 1

mkraposhin commented 1 year ago

1) Hi, try to install default openmpi that comes with OpenFOAM-2112 2) Usually it's not a good idea to compile libAcoustics with different versions of OpenFOAM.

jansi143 commented 1 year ago

Hey Matvey,

thanks for your reply. Unfortunately i got only openmpi2 installed which is default for OpenFOAM-2112. Might you got another idea?

Regards Jan

mkraposhin commented 1 year ago

Hi, try to find libAcoustics.so on your filesystem. If you can't find it, then the problem in the compilation or linkage of the library itself

jansi143 commented 1 year ago

Ok i just realized, that it wasn't the first error in the output. I'm sorry. Here's the first error i see. The Text interpreter in this Forum misunderstands the one sign in the log as the end of the code. It's therefor not to see. But the error is to see. I also added the full log as a file.

    -lcompressibleTransportModels -lsampling -lturbulenceModels -lincompressibleTurbulenceModels -lcompressibleTurbulenceModels -lincompressibleTransportModels -lfluidThermophysicalModels -lspecie -lfileFormats -lfiniteVolume -lmeshTools -lforces -lsurfMesh -L/usr/lib/openfoam/openfoam2112/ThirdParty/platforms/linux64Gcc/fftw-system/lib -lfftw3  -o /home/janosch/OpenFOAM/janosch-2112/platforms/linux64GccDPInt32Opt/lib/libAcoustics.so
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: /usr/local/lib64/libfftw3.a(apiplan.o): relocation R_X86_64_32S against .rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
make: *** [/usr/lib/openfoam/openfoam2112/wmake/makefiles/general:184: /home/janosch/OpenFOAM/janosch-2112/platforms/linux64GccDPInt32Opt/lib/libAcoustics.so] Error 1

So i recompiled fftw3 with -fPIC option. Like./configure -fPIC.

./configure --enable-shared

  sudo make CFLAGS=-fPIC

  sudo make install

Now it seems to work. Thanks for your help anyway.

Best regards

Jan

log_compile_libAcoustics.txt