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

incompatibilty between libifcore.a between ifort 15.0.0 and 15.0.2

Lawrence_M_
Beginner
641 Views

The following affects one of our Library builds, built using ifort 15.0.0 when compiling and linking a main program against

the shared library using ifort.15.0.2 .......

Using ifort 15.0.0 compile up the following in file nag_test_io.f90  and turn into archive 

  Subroutine nag_test_io(string)
      Character (*) string
      Write(6,*) string
    End Subroutine nag_test_io

ifort -O3 -w -auto -fPIC -axAVX,SSE2 -threads -fexceptions -fp-model precise -c  nag_test_io.f90 -o nag_test_io.o

ar rvf libnag_test.a nag_test_io.o

and make shared

icc -w -fPIC -m64 -axAVX,SSE2 -DPOINTER64 -fp-model precise -DLONG_CHARLEN -fexceptions -shared -Wl,-rpath=\$ORIGIN,-z,origin -Wl,-soname,libnag_test.so -o libnag_test.so -Wl,--whole-archive libnag_test.a -Wl,--no-whole-archive -Wl,--no-undefined /opt/intel/composer_xe_2015.0.090/compiler/lib/intel64/libifcoremt_pic.a /opt/intel/composer_xe_2015.0.090/compiler/lib/intel64/libsvml.a /opt/intel/composer_xe_2015.0.090/compiler/lib/intel64/libimf.a /opt/intel/composer_xe_2015.0.090/compiler/lib/intel64/libirc.a -lpthread -lpthread -lm -L/opt/intel/composer_xe_2015.0.090/compiler/lib/intel64 -liomp5

Compile the follwing in file test_ifort.f90 

    Program test_ifort_io_compat

     Call nag_test_io('testing ifort io compatibility')

    End Program test_ifort_io_compat

ifort -O3 -w -auto -fPIC -axAVX,SSE2 -threads -fexceptions -fp-model precise -c -I/home/nag/linthouse/lawrence/BUILD_linux_ifort_64/modules test_ifort.f90 -o test_ifort.o

Using ifort.15.0.2 link using 15.0.2 libifcore.a explicitly 

ifort -fPIC -threads test_ifort.o /opt/intel/composer_xe_2015.0.2/lib/intel64/libifcore.a libnag_test.so -o test_ifort.exe

/test_ifort.exe                                                              forrtl: severe (257): formatted I/O to unit open for unformatted transfers, unit 6, file /dev/pts/16
Image              PC                Routine            Line        Source             
test_ifort.exe     000000000041E7B4  Unknown               Unknown  Unknown
libnag_test.so     00007F5868D794A6  Unknown               Unknown  Unknown
libnag_test.so     00007F5868D786AB  Unknown               Unknown  Unknown
test_ifort.exe     0000000000406280  Unknown               Unknown  Unknown
test_ifort.exe     000000000040623E  Unknown               Unknown  Unknown
libc.so.6          00000038A341FFE0  Unknown               Unknown  Unknown
test_ifort.exe     0000000000406139  Unknown               Unknown  Unknown
*** Error in `./test_ifort.exe': free(): invalid pointer: 0x00000000006887c0 ***
======= Backtrace: =========
/lib64/libc.so.6[0x38a347850e]
/lib64/libc.so.6(cfree+0x5b5)[0x38a3484165]
./test_ifort.exe(for__free_vm+0x2a)[0x40adca]
./test_ifort.exe[0x42479b]
./test_ifort.exe(for__deallocate_lub+0x105)[0x423f95]
./test_ifort.exe(for__exit_handler+0x1d4)[0x422ae4]
./test_ifort.exe(for__issue_diagnostic+0x75e)[0x41f16e]
./test_ifort.exe(for__io_return+0x9a4)[0x41e7b4]
/home/nag/linthouse/lawrence/libnag_test.so(for_write_seq_lis+0xdf6)[0x7f5868d794a6]
/home/nag/linthouse/lawrence/libnag_test.so(nag_test_io_+0x3b)[0x7f5868d786ab]
./test_ifort.exe[0x406280]
./test_ifort.exe[0x40623e]
/lib64/libc.so.6(__libc_start_main+0xf0)[0x38a341ffe0]
./test_ifort.exe[0x406139]
======= Memory map: ========
00400000-00485000 r-xp 00000000 fd:02 11534875                           /home/nag/linthouse/lawrence/test_ifort.exe
00684000-00685000 r--p 00084000 fd:02 11534875                           /home/nag/linthouse/lawrence/test_ifort.exe
00685000-00688000 rw-p 00085000 fd:02 11534875                           /home/nag/linthouse/lawrence/test_ifort.exe
00688000-0068f000 rw-p 00000000 00:00 0 
019dc000-019fd000 rw-p 00000000 00:00 0                                  [heap]
38a3000000-38a3021000 r-xp 00000000 fd:00 394510                         /usr/lib64/ld-2.20.so
38a3221000-38a3222000 r--p 00021000 fd:00 394510                         /usr/lib64/ld-2.20.so
38a3222000-38a3223000 rw-p 00022000 fd:00 394510                         /usr/lib64/ld-2.20.so
38a3223000-38a3224000 rw-p 00000000 00:00 0 
38a3400000-38a35b4000 r-xp 00000000 fd:00 394521                         /usr/lib64/libc-2.20.so
38a35b4000-38a37b3000 ---p 001b4000 fd:00 394521                         /usr/lib64/libc-2.20.so
38a37b3000-38a37b7000 r--p 001b3000 fd:00 394521                         /usr/lib64/libc-2.20.so
38a37b7000-38a37b9000 rw-p 001b7000 fd:00 394521                         /usr/lib64/libc-2.20.so
38a37b9000-38a37bd000 rw-p 00000000 00:00 0 
38a3800000-38a3803000 r-xp 00000000 fd:00 420714                         /usr/lib64/libdl-2.20.so
38a3803000-38a3a02000 ---p 00003000 fd:00 420714                         /usr/lib64/libdl-2.20.so
38a3a02000-38a3a03000 r--p 00002000 fd:00 420714                         /usr/lib64/libdl-2.20.so
38a3a03000-38a3a04000 rw-p 00003000 fd:00 420714                         /usr/lib64/libdl-2.20.so
38a3c00000-38a3c17000 r-xp 00000000 fd:00 399707                         /usr/lib64/libpthread-2.20.so
38a3c17000-38a3e16000 ---p 00017000 fd:00 399707                         /usr/lib64/libpthread-2.20.so
38a3e16000-38a3e17000 r--p 00016000 fd:00 399707                         /usr/lib64/libpthread-2.20.so
38a3e17000-38a3e18000 rw-p 00017000 fd:00 399707                         /usr/lib64/libpthread-2.20.so
38a3e18000-38a3e1c000 rw-p 00000000 00:00 0 
38a4400000-38a4507000 r-xp 00000000 fd:00 407855                         /usr/lib64/libm-2.20.so
38a4507000-38a4706000 ---p 00107000 fd:00 407855                         /usr/lib64/libm-2.20.so
38a4706000-38a4707000 r--p 00106000 fd:00 407855                         /usr/lib64/libm-2.20.so
38a4707000-38a4708000 rw-p 00107000 fd:00 407855                         /usr/lib64/libm-2.20.so
38a5800000-38a5816000 r-xp 00000000 fd:00 414832                         /usr/lib64/libgcc_s-4.9.2-20141101.so.1
38a5816000-38a5a15000 ---p 00016000 fd:00 414832                         /usr/lib64/libgcc_s-4.9.2-20141101.so.1
38a5a15000-38a5a16000 r--p 00015000 fd:00 414832                         /usr/lib64/libgcc_s-4.9.2-20141101.so.1
38a5a16000-38a5a17000 rw-p 00016000 fd:00 414832                         /usr/lib64/libgcc_s-4.9.2-20141101.so.1
7f5867499000-7f586749c000 rw-p 00000000 00:00 0 
7f586749c000-7f58674f5000 r-xp 00000000 00:28 20967365                   /fserver/intel/opt/intel/composer_xe_2015.2.164/compiler/lib/intel64/libintlc.so.5
7f58674f5000-7f58676f4000 ---p 00059000 00:28 20967365                   /fserver/intel/opt/intel/composer_xe_2015.2.164/compiler/lib/intel64/libintlc.so.5
7f58676f4000-7f58676f6000 rw-p 00058000 00:28 20967365                   /fserver/intel/opt/intel/composer_xe_2015.2.164/compiler/lib/intel64/libintlc.so.5
7f58676f6000-7f58676f7000 rw-p 00000000 00:00 0 
7f58676f7000-7f58676fc000 r-xp 00000000 fd:00 3163927                    /opt/NAG/fll6i25dc/rtl/intel64/libirng.so
7f58676fc000-7f58678fc000 ---p 00005000 fd:00 3163927                    /opt/NAG/fll6i25dc/rtl/intel64/libirng.so
7f58678fc000-7f58678fe000 rw-p 00005000 fd:00 3163927                    /opt/NAG/fll6i25dc/rtl/intel64/libirng.so
7f58678fe000-7f58678ff000 rw-p 00000000 00:00 0 
7f58678ff000-7f5868317000 r-xp 00000000 fd:00 3163929                    /opt/NAG/fll6i25dc/rtl/intel64/libsvml.so
7f5868317000-7f5868517000 ---p 00a18000 fd:00 3163929                    /opt/NAG/fll6i25dc/rtl/intel64/libsvml.so
7f5868517000-7f586854e000 rw-p 00a18000 fd:00 3163929                    /opt/NAG/fll6i25dc/rtl/intel64/libsvml.so
7f586854e000-7f58687c7000 r-xp 00000000 fd:00 3163923                    /opt/NAG/fll6i25dc/rtl/intel64/libimf.so
7f58687c7000-7f58689c6000 ---p 00279000 fd:00 3163923                    /opt/NAG/fll6i25dc/rtl/intel64/libimf.so
7f58689c6000-7f5868a08000 rw-p 00278000 fd:00 3163923                    /opt/NAG/fll6i25dc/rtl/intel64/libimf.so
7f5868a08000-7f5868afc000 r-xp 00000000 fd:00 3163924                    /opt/NAG/fll6i25dc/rtl/intel64/libiomp5.so
7f5868afc000-7f5868cfc000 ---p 000f4000 fd:00 3163924                    /opt/NAG/fll6i25dc/rtl/intel64/libiomp5.so
7f5868cfc000-7f5868d07000 rw-p 000f4000 fd:00 3163924                    /opt/NAG/fll6i25dc/rtl/intel64/libiomp5.so
7f5868d07000-7f5868d35000 rw-p 00000000 00:00 0 
7f5868d6a000-7f5868d6b000 rw-p 00000000 00:00 0 
7f5868d6b000-7f5868e00000 r-xp 00000000 fd:02 11534883                   /home/nag/linthouse/lawrence/libnag_test.so
7f5868e00000-7f5869000000 ---p 00095000 fd:02 11534883                   /home/nag/linthouse/lawrence/libnag_test.so
7f5869000000-7f5869003000 r--p 00095000 fd:02 11534883                   /home/nag/linthouse/lawrence/libnag_test.so
7f5869003000-7f5869007000 rw-p 00098000 fd:02 11534883                   /home/nag/linthouse/lawrence/libnag_test.so
7f5869007000-7f5869010000 rw-p 00000000 00:00 0 
7fff38af6000-7fff38b19000 rw-p 00000000 00:00 0                          [stack]
7fff38bb5000-7fff38bb7000 r--p 00000000 00:00 0                          [vvar]
7fff38bb7000-7fff38bb9000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Abort (core dumped)

 

 

0 Kudos
2 Replies
Steven_L_Intel1
Employee
641 Views

Thanks - I'm looking into this now.

0 Kudos
Steven_L_Intel1
Employee
641 Views

I can reproduce this, but I am pretty sure that this is due to the incorrect way you are building the .so and the executable so that you end up with two different copies of the ifort library in the application. We fixed bugs related to I/O unit handling between these updates and it's very likely that this creates the problem you observe.

When you build libnag_test.so, you explicitly link in the 15.0.0 static library libifcoremt_pic.a. Then you build the main program linking in the 15.0.2 libifcore.a. This means two different copies of the libifcore library are in memory and they don't share data structures.

The correct way is to always build your shared objects against the shared ifort libraries and require that executables built against your .so are also built against the shared ifort libraries. We have seen similar situations on Windows.

0 Kudos
Reply