Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28951 Discussions

Linking error in ifx compiler after update to 2024.1.2

VinothParamanandham
1,144 Views

I have updated my Intel OneAPI suite (ifx (IFX) 2024.1.2 20240508). After the update, my ifx/ifort is not linking the OpenMP programs properly and returns an error. 

 

The details of the compiler output is given here

ifx -o run main.o constant.o declaration.o grid.o boundary.o misc.o -O3 -warn all -fiopenmp -fp-model=precise

ld: main.o: in function `MAIN__.DIR.OMP.PARALLEL.LOOP.21813.split1817':
main.f90:(.text+0x2724): undefined reference to `__kmpc_for_static_init_2'
make: *** [Makefile:33: run] Error 1

 

I have tried many ways to avoid it but still end up with the same error. I have included the code snippet used for the compilation.

do nb = 1, nBlocks
    !$omp parallel do &
    !$omp shared(q, nx, ny, nb)
    do j = 1, ny(nb)
        do i = 1, nx(nb)
            q(1, i, j, nb) = zero
        end do
     end do
     !$end parallel do
end do

 

0 Kudos
1 Solution
Mark_Lewy
Valued Contributor I
1,059 Views

A small reproducer:

program x
implicit none

integer, parameter :: it = 2
integer(it) :: nb, i, j
integer(it), parameter :: nBlocks = 1, nx_ = 1, ny_ = 1
integer(it) :: nx(nBlocks), ny(nBlocks)

real :: q(1, nx_, ny_, nBlocks)
real, parameter :: zero = 0

nx = 1
ny = 1

do nb = 1, nBlocks
    !$omp parallel do &
    !$omp shared(q, nx, ny, nb)
    do j = 1, ny(nb)
        do i = 1, nx(nb)
            q(1, i, j, nb) = zero
        end do
     end do
     !$end parallel do
end do
end program

lewym@ADSKPW015RGM:~/intel/src$ ifx -o x x.f90 -O3 -warn all -fiopenmp -fp-model=precise
ld: /tmp/ifx003727979395vbMv/ifxFlW5gD.o: in function `MAIN__.DIR.OMP.PARALLEL.LOOP.265.split67':
x.f90:(.text+0xa7): undefined reference to `__kmpc_for_static_init_2'

Workaround: change the value of it to 4.

View solution in original post

0 Kudos
5 Replies
Mark_Lewy
Valued Contributor I
1,063 Views

Without a full reproducer, I can only speculate here, but I think the problem is that you may be using integer(2) variables in your program and __kmpc_for_static_init_2 has been deleted from the OpenMP RTLs (regression?).  There are symbols defined for __kmpc_for_static_init_4 and __kmpc_for_static_init_8 in the current library.  Try declaring any integer(2) variables as default integers and see if that helps.

0 Kudos
Mark_Lewy
Valued Contributor I
1,060 Views

A small reproducer:

program x
implicit none

integer, parameter :: it = 2
integer(it) :: nb, i, j
integer(it), parameter :: nBlocks = 1, nx_ = 1, ny_ = 1
integer(it) :: nx(nBlocks), ny(nBlocks)

real :: q(1, nx_, ny_, nBlocks)
real, parameter :: zero = 0

nx = 1
ny = 1

do nb = 1, nBlocks
    !$omp parallel do &
    !$omp shared(q, nx, ny, nb)
    do j = 1, ny(nb)
        do i = 1, nx(nb)
            q(1, i, j, nb) = zero
        end do
     end do
     !$end parallel do
end do
end program

lewym@ADSKPW015RGM:~/intel/src$ ifx -o x x.f90 -O3 -warn all -fiopenmp -fp-model=precise
ld: /tmp/ifx003727979395vbMv/ifxFlW5gD.o: in function `MAIN__.DIR.OMP.PARALLEL.LOOP.265.split67':
x.f90:(.text+0xa7): undefined reference to `__kmpc_for_static_init_2'

Workaround: change the value of it to 4.

0 Kudos
VinothParamanandham
1,017 Views

Dear Mark_Lewy,

 

Thanks for your reply, Your solution worked, and I'm not getting errors once I update the integer variable. Thanks once again. I have spent a lot of time checking the code instead of looking into the data types.

TobiasK
Moderator
867 Views

@VinothParamanandham


thanks for reporting this, I send a reproducer to our developers. CMPLRLLVM-59394


0 Kudos
TobiasK
Moderator
280 Views

@VinothParamanandham


the fix for this is included in the 2025.0 release, please test it


0 Kudos
Reply