Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pgplot compilation : a workaround #110

Open
jcldc opened this issue Nov 27, 2022 · 18 comments
Open

Pgplot compilation : a workaround #110

jcldc opened this issue Nov 27, 2022 · 18 comments

Comments

@jcldc
Copy link
Collaborator

jcldc commented Nov 27, 2022

Since gcc 10.x Pgplot does not compile.
The workaround is just to add compilation flag -fallow-argument-mismatch to the pgplot makefile and the it compiles flawlessly.
It would be necessary to patch pgplot makefile during nemo configuration/installation

@teuben
Copy link
Owner

teuben commented Nov 27, 2022 via email

@jcldc
Copy link
Collaborator Author

jcldc commented Nov 27, 2022

well... I am confused.... I was working on a old branch and pgplot was not compiling without this flag..... should not work on sunday...

@teuben
Copy link
Owner

teuben commented Nov 27, 2022

I do remember I needed this flag in a few fortran codes, sellwood maybe, and also the io_nemo Makefile now has:

  FFLAGS = -O -fno-second-underscore -fallow-argument-mismatch

working on Sunday, as long as it's in moderation, can be entertaining

@jcldc
Copy link
Collaborator Author

jcldc commented Nov 28, 2022

Ok, on monday my brain works better :)

Well, I confirm that this flag -fallow-argument-mismatch is actually mandatory, since gcc 10.x, IF gif driver is requested.

The following pgplot installation :

$NEMO/src/scripts/pgplot.install png=0 gif=1

fails without this flag added into $NEMO/lib/makefile

And by default, https://teuben.github.io/nemo/install_nemo script has by default set gif =1 , then pgplot fails to compile. It should be necessary to set gif=0 in this script or/and to add -fallow-argument-mismatch to the pgplot makefile (for gcc >= 10.x)

@teuben
Copy link
Owner

teuben commented Nov 28, 2022

I always use PNG now, but I guess for making animated GIF's there might be a reason to keep this. I will add this to the configure procedure

But I should note that this particular install_nemo script is deprecated in favor of the install_nemo.sh counter part. More cleanly written. The old csh version is - shall we say - organically grown and is messy to look at.

@jcldc
Copy link
Collaborator Author

jcldc commented Nov 28, 2022

The pb with PNG is that the libpng-devel package needs to be installed on the server. Then if it's not installed what happens with pgplot installation/compilation ?

@teuben
Copy link
Owner

teuben commented Nov 28, 2022

it should fail. Somehow I seem to have it by default in ubuntu, I didn't put it in my default "packages to install" in
$NEMO/src/scripts/linux/ubuntu20.04.
If you have own favorite OS, you should add your packages to a list in that directory, it will be useful for me too.

@jcldc
Copy link
Collaborator Author

jcldc commented Nov 28, 2022

I am encountering all these issues because I am building nemo inside manylinux_2xxx docker images which are centos base distributions. (the purpose is too build python-unsio and python-unsiotools and upload to pypi.org)

@jcldc
Copy link
Collaborator Author

jcldc commented Nov 28, 2022

it should fail. Somehow I seem to have it by default in ubuntu, I didn't put it in my default "packages to install" in $NEMO/src/scripts/linux/ubuntu20.04. If you have own favorite OS, you should add your packages to a list in that directory, it will be useful for me too.

it should be good to check if png package is present

@teuben
Copy link
Owner

teuben commented Nov 28, 2022

btw, are you are we need to add it to makedefs, and not to the pgplot install script. They have their own peculiar method to set compiler specific flags.

@jcldc
Copy link
Collaborator Author

jcldc commented Nov 28, 2022

Do you mean compilation flag for pgplot ?
Well, it might be a good idea to put it in $NEMOLIB/makedefs but during pgplot installation, the file $NEMOLIB/makefile is created and the pgplot's compilation is based on it... Entry FFLAGC=-u -Wall -fPIC -O should be modified with something like FFLAGC=-u -Wall -fPIC -O ${NEMOFORTFLAGS} and an include of makefedfs (with NEMOFORTFLAGS set) should be present in $NEMOLIB/makefile

@teuben
Copy link
Owner

teuben commented Nov 29, 2022

Looking at the code in $NEMO/local/pgplot (where "mknemo pgplot" dumps the code) I see that in

   $NEMO/local/pgplot/sys_linux/gfortran_gcc.conf

one needs to modify

   FFLAGC="-u -Wall -fPIC -O -fallow-argument-mismatch"

but my programs then coredump'd when using the /gif driver. I forgot to add the int8=1 fix to the pgplot build script. After this i got good gif files.

The int8=1 changes

  -      INTEGER*4 PIXMAP, WORK
  +      INTEGER*8 PIXMAP, WORK

in gidriv, ppdriv and wddriv

@teuben
Copy link
Owner

teuben commented Nov 29, 2022

I'm also willing to make gif=0 the default, but that csh script has been deprecated. The new install_nemo.sh script already had gif=0 by default, if you use the yapp=pglocal (which uses our source code). But that new one also has png=1 as default, so you need the png development library.
So what's better for your docker usage?

\

@jcldc
Copy link
Collaborator Author

jcldc commented Nov 29, 2022

The better would be to have no png and no gif.
So far, I install nemo like this (from Dockerfile),
see : https://gitlab.lam.fr/infrastructure/unsio/-/blob/master/CI/docker/manylinux2014/Dockerfile

wget https://teuben.github.io/nemo/install_nemo &&\
chmod +x install_nemo                 &&\
export NO_ARCH_NATIVE=1         &&\
./install_nemo png=0 gif=0

@teuben
Copy link
Owner

teuben commented Nov 29, 2022

thanks, it's good to see such a dockerfile so I can see how you do this.

If you don't really care about the drivers in pgplot and just want a compilation, you should use the yapp=ps driver. Much easier and doesn't need another library. Even yapp=null should work. I can also "advertise" the install_nemo.sh script, try

 docs/install_nemo.sh -h

to see the options. I would like to argue you can now do it in two steps. Or does dockerfile not support the prefix?

  wget   https://teuben.github.io/nemo/install_nemo.sh   &&\
  NO_ARCH_NATIVE=1   bash   ./install_nemo.sh   yapp=ps

some of the options in install_nemo haven't been ported to install_nemo.sh, but I'll add some if you argue in their favor :-)

@jcldc
Copy link
Collaborator Author

jcldc commented Nov 29, 2022

OK I will try yapp=ps

@teuben
Copy link
Owner

teuben commented Nov 29, 2022

I think we can close this issue, barring hearing from you if you're happy with using the bash script instead (and with yapp=ps)

@jcldc
Copy link
Collaborator Author

jcldc commented Nov 29, 2022

Sure, yes you can close it. THANKS for your help !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants