apc-llc / cernlib

CERN Program Library
Other
34 stars 8 forks source link

Installation failure on WSL2 Ubuntu 22.04 with gcc and gfortran 11.3 #2

Open taiyi10086 opened 1 year ago

taiyi10086 commented 1 year ago

I failed to install CERNLIB of this version on WSL2 Ubuntu 22.04 with gcc and gfortran 11.3. The compilation is aborted with these two kinds of messages:

(1) Error of sys_errlist /cernlib-master/2006/src/packlib/kernlib/kernbit/z268/systems.c:137:59: error: ‘sys_errlist’ undeclared (first use in this function) /cernlib-master/2006/src/packlib/cspack/sysreq/serror.c:180:32: error: ‘sys_errlist’ undeclared (first use in this function) /cernlib-master/2006/src/packlib/cspack/sysreq/socket.c:415:16: error: ‘sys_errlist’ undeclared (first use in this function)

(2) Error of sys_nerr /cernlib-master/2006/src/packlib/cspack/sysreq/serror.c:179:33: error: ‘sys_nerr’ undeclared (first use in this functions)

I have successfully installed this CERNLIB on Ubuntu 18.04 with gcc 7.5.

It seems that the installation failure on Ubuntu 22.04 is resulted from the changes in the update of GNU compiler.

In addition, although the flag -fallow-invalid-boz has been added, there are still some problems caused by using nonstandard X instead of Z for Hexadecimal constant. I have to change X to Z manually.

dmikushin commented 1 year ago

Hi @taiyi10086 thank you very much for your report. Could you please share a patch/diff showing how you have changed X to Z?

Yes, older gfortran compilers are usually more "permissive" wrt language dialects. But we should improve the code and keep it compatible.

taiyi10086 commented 1 year ago

Hey @dmikushin , I use ./build64 2006 to install CERNLIB, so that I had only changed the files in /2006/src. 7 files should be modified as showing below by diff:

diff -r cernlib-master/2006/src/packlib/cspack/xz/xzctof.F cernlib-master-modified/2006/src/packlib/cspack/xz/xzctof.F
40c40
       DATA         IPATT/X'0123CDEF'/
       DATA         IPATT/Z'0123CDEF'/
diff -r cernlib-master/2006/src/packlib/cspack/xz/xzftoc.F cernlib-master-modified/2006/src/packlib/cspack/xz/xzftoc.F
40c40
       DATA         IPATT/X'0123CDEF'/
       DATA         IPATT/Z'0123CDEF'/
diff -r cernlib-master/2006/src/packlib/cspack/xz/xzfzcp.F cernlib-master-modified/2006/src/packlib/cspack/xz/xzfzcp.F
53c53
       DATA         IPATT/X'0123CDEF'/
       DATA         IPATT/Z'0123CDEF'/
diff -r cernlib-master/2006/src/packlib/cspack/xz/xzputf.F cernlib-master-modified/2006/src/packlib/cspack/xz/xzputf.F
53c53
       DATA         IPATT/X'0123CDEF'/
       DATA         IPATT/Z'0123CDEF'/
diff -r cernlib-master/2006/src/packlib/cspack/xz/xzrfrf.F cernlib-master-modified/2006/src/packlib/cspack/xz/xzrfrf.F
58c58
       DATA         IPATT/X'0123CDEF'/
       DATA         IPATT/Z'0123CDEF'/
diff -r cernlib-master/2006/src/packlib/kernlib/kerngen/tcgens/lnxgs/ublow.F cernlib-master-modified/2006/src/packlib/kernlib/kerngen/tcgens/lnxgs/ublow.F
19,20c19,20
       data iblan1/x'20202000'/
       data mask1/x'000000ff'/
       data iblan1/Z'20202000'/
       data mask1/Z'000000ff'/
diff -r cernlib-master/2006/src/packlib/kernlib/kerngen/tcgens/lnxgs/ubunch.F cernlib-master-modified/2006/src/packlib/kernlib/kerngen/tcgens/lnxgs/ubunch.F
19,20c19,20
       data iblan1/x'20202020'/
       data mask1/x'000000ff'/
       data iblan1/Z'20202020'/
       data mask1/Z'000000ff'/

cernlib-master contains the original files and cernlib-master-modified contains the modified files.

Note: the symbols "<", ">" and "---" are removed from the above text as they leads to a strange display.

taiyi10086 commented 1 year ago

Finally, I installed WSL2 Ubuntu 20.04 and therefore the CERNLIB was correctly installed The gcc version is 9.4.0

I suggest that use /bin/bash rather than /bin/sh in build64. /bin/sh will result in some problems about PATH, while /bin/bash does not.

wuctlby commented 1 year ago

Hi, @taiyi10086 I tried the approach you mentioned earlier, but there were more errors later. I think this is due to not adding '-fno-allow-invalid-boz' to the correct MAKEFILE. In which MAKEFILE should I add '-fno-allow-invalid-boz'? My gcc version is also 9.4.0. The difference is that the Linux distribution I use is Debian.

taiyi10086 commented 1 year ago

@Libeiyu Could you please show the warning messages? I successfully install the cernlib with gcc 9.4.0 on Ubuntu without any adjustment Have you install the dependencies file? If the problem is only about X and Z for hexadecimal numbers, I suggest that you modify the source files manually as I have shown before

wuctlby commented 1 year ago

@taiyi10086 I have installed the dependencies file. If there is no other solution, I think it may be necessary to change all the problem about X and Z for hexadecimal numbers. There are two differences: I'm using Debian and I didn't add '-fno-allow-invalid-boz'.

/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2310:8:

 2310 |      +X'1969C7D6',X'217DC699',X'269E79A4',X'00FDF864',X'2185E716',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2321:8:

 2321 |      +X'19FD9655',X'279A58E0',X'208E59A7',X'00000FD9',X'1AFDA696',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2334:8:

 2334 |      +X'00000FE0',X'20FDB594',X'3F960FDB',X'0003F96A',X'27FE7656',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2345:8:

 2345 |      +X'0003F7A2',X'27FD9655',X'3F9D9FE7',X'19FD9655',X'279E6962',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2358:8:

 2358 |      +X'1D7A0862',X'228E4FDC',X'1B75E7E0',X'175965D9',X'0003F5D8',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2369:8:

 2369 |      +X'1C79F814',X'1961865B',X'20FE071A',X'279648A1',X'249A7A28',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2382:8:

 2382 |      +X'2095B81B',X'20FDD83F',X'3F7E0FE3',X'0003F860',X'206E581B',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2393:8:

 2393 |      +X'3F8DD8A3',X'2385F75B',X'2183F863',X'1D7E18E3',X'0000003F',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2406:8:

 2406 |      +X'3F99FFDB',X'00FE081C',X'15FD5551',X'207DD698',X'258E0FE0',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2417:8:

 2417 |      +X'3F65A6DC',X'269E7963',X'20FE08E5',X'24965922',X'1C75F863',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2430:8:

 2430 |      +X'259A6963',X'00FE08A4',X'23FDA795',X'17FE6964',X'00FE9719',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2441:8:

 2441 |      +X'21FE081E',X'21820FE1',X'0003F821',X'23FDE81B',X'3F91DFE1',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2454:8:

 2454 |      +X'3F86285F',X'20FE0818',X'3F860FDF',X'1F83F85F',X'1C7FF71E',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2465:8:

 2465 |      +X'1A761926',X'1A6175D8',X'299A485D',X'00FEBAEA',X'24967A16',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2477:8:

 2477 |      +X'1D61552A',X'29A68960',X'18760968',X'00FD4515',X'2951762A',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2488:8:

 2488 |      +X'1482952A',X'1C657554',X'29A26921',X'00000FE9',X'14829529',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2501:8:

 2501 |      +X'00000FE9',X'1482952C',X'20A54829',X'0003FA54',X'1482952A',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2512:8:

 2512 |      +X'0003F514',X'1482952B',X'3F514829',X'1482952A',X'1B616554',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2525:8:

 2525 |      +X'2CA1C615',X'1851282E',X'2FB6BA24',X'2DBAFC30',X'0003FBEE',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2536:8:

 2536 |      +X'165D972C',X'207595D6',X'1C82A962',X'175965D9',X'258A0759',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2549:8:

 2549 |      +X'1A8E36A5',X'1D822760',X'208A0822',X'0003F8A0',X'2675D9A5',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2560:8:

 2560 |      +X'3F92481E',X'1C6DB725',X'1F7E07DE',X'239248E0',X'0000003F',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2573:8:

 2573 |      +X'3FA61825',X'00FE9524',X'1F8296EF',X'1F71B6DC',X'1B71F829',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2584:8:

 2584 |      +X'20C2889E',X'1B656514',X'1D81D75C',X'2796281E',X'27A29A68',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2597:8:

 2597 |      +X'1D8239A8',X'00FDB6DC',X'1B8296EB',X'1E8299A1',X'00FDB6DC',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2608:8:

 2608 |      +X'1B8206E3',X'24923820',X'0003F8E3',X'1A8256A6',X'2079E825',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2621:8:

 2621 |      +X'3FA29AAA',X'218216E8',X'20AA182A',X'186E0AAA',X'15620556',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
/usr/local/Software/cernlib/cernlib/2006/src/graflib/higz/ig/igtext.F:2632:8:

 2632 |      +X'1D71C75E',X'238A17DE',X'1F8A3924',X'00FD869D',X'238E282A',
      |        1
Error: Hexadecimal constant at (1) uses nonstandard X instead of Z [see ‘-fno-allow-invalid-boz’]
make[3]: Leaving directory '/usr/local/Software/cernlib/cernlib/2006/build/graflib/higz/ig'
rebuild archive library libgrafX11.a in /graflib/higz
Sun 02 Apr 2023 08:19:36 PM CST
ar: ig/archive/igtext.o: No such file or directory
make[2]: *** [Makefile:442: libgrafX11.a] Error 123
make[2]: Leaving directory '/usr/local/Software/cernlib/cernlib/2006/build/graflib/higz'
make[1]: *** [Makefile:490: install.lib] Error 2
make[1]: Leaving directory '/usr/local/Software/cernlib/cernlib/2006/build/graflib'
make: *** [Makefile:335: install.lib] Error 2
taiyi10086 commented 1 year ago

@Libeiyu Yet, I guess it may be convenient to change X to Z manually

wuctlby commented 1 year ago

But there are too many Xs that need to be changed here. I am concerned that some problems may arise from such a change. I tried the same with Ubuntu 22.04 and still had the same problem. DATA (IX11(I),I=1,50)/ 2310 +X'1969C7D6',X'217DC699',X'269E79A4',X'00FDF864',X'2185E716', 2311 +X'0000003F',X'1C6DA696',X'2696489E',X'27663966',X'0000003F', 2312 +X'238266D6',X'269E79A5',X'1A6DE864',X'00000FD9',X'3FA198D6', 2313 +X'0003F8E3',X'1B69B956',X'279A485E',X'1E8649A7',X'00FD969B', 2314 +X'208A5996',X'1B69A6DD',X'2692181D',X'219269E7',X'3F69B760', 2315 +X'19FDD9D6',X'00000FE7',X'1A69B796',X'2692175B',X'229669E7', 2316 +X'1965A6DE',X'258DF71A',X'1E8A59A6',X'0000003F',X'208E5996', 2317 +X'1965A71F',X'2381F71A',X'239669A5',X'3F69B7A0',X'20FD8817', 2318 +X'3F95BFE8',X'19FD9655',X'279E6962',X'19FE2966',X'279E6962', 2319 +X'3F662966',X'23967A16',X'1969B75F',X'1F75B699',X'3FA27963'/

wuctlby commented 1 year ago

@taiyi10086 Just like Error: BOZ constant at (1) uses nonstandard postfix syntax [see ‘-fno-allow-invalid-boz’]. So I wonder if the key factor is to add '-fno-allow-invalid-boz' to the proper MAKEFILE

dmikushin commented 1 year ago

Hi @Libeiyu you should have find and sed tools in WSL2. In the project folder please do the following:

find . -name "*.f*" -exec sed -i "s/X'/Z'/g" {} \;

This will batch-replace all X with Z. Please do let us know how it works for you.

wuctlby commented 1 year ago

@taiyi10086 Finally, I solved this by adding -fallow-invalid-boz to the error reporting section @dmikushin Hey, thanks for the suggestion, the second time the error was reported in the same file, I was just able to do a direct replacement.

wuctlby commented 1 year ago

After changing X, the third error 'Error: BOZ constant at (1) uses nonstandard postfix syntax' gave me a hard time, as I am not a professional. I found the cause of this error and then enabled the extension via -fallow-invalid-boz to solve the problem. But I'm not quite sure if this is the right solution.

wuctlby commented 1 year ago

https://gcc.gnu.org/onlinedocs/gfortran/BOZ-literal-constants.html