gfortran, OpenMP and static linking

2022-09-16 Thread Andrew Benson via Fortran
I've been following the fix proposed by Bernhard in this thread: https://gcc.gnu.org/pipermail/fortran/2021-April/055907.html to allow static linking of Fortran codes compiled with -fopenmp. (I know that static linking of OpenMP codes isn't guaranteed to work, but this fix has worked well for m

Re: gfortran, OpenMP and static linking

2021-04-04 Thread Harald Anlauf via Fortran
Hi Bernhard, > $ gfortran -o omp -fopenmp omp.f90 -static -Wl,--whole-archive -lpthread > -Wl,--no-whole-archive && OMP_NUM_THREADS=2 ./omp that does indeed do the trick! As suggested in your other mail, I should ask Jakub for his opinion. (Statically compiling/linking on the same machine with

Re: gfortran, OpenMP and static linking

2021-04-04 Thread Bernhard Reutner-Fischer via Fortran
Harald, On Sat, 03 Apr 2021 23:24:52 +0200 Bernhard Reutner-Fischer wrote: > On 3 April 2021 20:55:39 CEST, Harald Anlauf via Fortran > wrote: > >Dear all, > > > >is there a reason that one should not be able to statically link a > >Fortran binary that has been compiled with -fopenmp? > > M

Re: gfortran, OpenMP and static linking

2021-04-03 Thread Bernhard Reutner-Fischer via Fortran
On 3 April 2021 20:55:39 CEST, Harald Anlauf via Fortran wrote: >Dear all, > >is there a reason that one should not be able to statically link a >Fortran binary that has been compiled with -fopenmp? Maybe Jakub knows more on this. Not sure if static linking with glibc is still discouraged (it w

gfortran, OpenMP and static linking

2021-04-03 Thread Harald Anlauf via Fortran
Dear all, is there a reason that one should not be able to statically link a Fortran binary that has been compiled with -fopenmp? A tiny example seems to fail for me with all gfortran versions: program p !$omp parallel !$omp end parallel end % gfortran -fopenmp foo.f90 -g -static % OMP_NUM_THRE