PetterS / quickjs

Thin Python wrapper of https://bellard.org/quickjs/
https://github.com/bellard/QuickJS
MIT License
177 stars 19 forks source link

install failed by gcc problem #50

Closed kanchi240 closed 3 years ago

kanchi240 commented 3 years ago

Hi,

Please see the image 1603957540690

System info is below OS: CentOS Linux release 7.8.2003 (Core) python: 3.7.1

Thanks a lot.

PetterS commented 3 years ago

What version of GCC are you using?

Looks like we should add the -std=c99 flag to the compiler. I guess that can't hurt, even though it always worked for me.

Also, your version of pip is quite old, so there may be other issues.

PetterS commented 3 years ago

Looks like even gcc 5 has a default of gnu11. https://gcc.gnu.org/onlinedocs/gcc-5.5.0/gcc/C-Dialect-Options.html#C-Dialect-Options How come your compiler is not even using C99? Is it some system-wide setting overriding the default?

kanchi240 commented 3 years ago

(test) [root@VM-0-240-centos ~]# gcc --version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

kanchi240 commented 3 years ago

Thank you, @PetterS

Success install after update gcc, see below about how to update gcc in centos: sudo yum install centos-release-scl devtoolset-7-gcc* scl enable devtoolset-7 bash

PetterS commented 3 years ago

Alright, that's great! I think we'll skip doing any changes to the setup file then and instead require gcc 5+.

qwenger commented 3 years ago

Hi,

I stumbled upon a similar issue trying to install quickjs on RHEL 7 (which uses gcc 4.8.x by default). It failed because of the missing flag -Wincompatible-pointer-types. I'm investigating whether I can update gcc.

If this requirement on gcc >= 5.x is strong, it would be nice to mention it more explicitly:

PetterS commented 3 years ago

gcc 4.8 was released more than eight years ago. I don't have the bandwith to make sure everything works with that old compilers.

But if there is a nice way of testing with gcc 4.8 in the CI, I am open to merging support.

qwenger commented 3 years ago

Understood, I am aware that the change should be made on my side.

What I am suggesting is to simply mention the dependency on gcc >= 5.x explicitly. That is, writing a note about it in the readme and aborting compilation if the version of gcc is lower than 5. Just for future users to understand more easily why the compilation is failing rather than having to dig in closed GitHub issues. Of course we can expect less and less people still on gcc 4, but I'm the proof that it still happens. :-)

PetterS commented 3 years ago

Compilation is handled implicitly by setuptools. It is not clear (to me) how to check if the compiler is gcc and to abort if it is below 5.

The readme can of course mention this.

qwenger commented 3 years ago

Yeah, that may not be a simple as I thought. I was thinking about a preprocessor check in module.c, but that's already too late for flag errors. Another way may be to add a dummy compiled extension just for checking, but that's probably overkill.

In a sense the -Wincompatible-pointer-types flag error is hard already and can now be used to find the present discussion. So it's probably fine to go for the note in the readme only.