libsass icon indicating copy to clipboard operation
libsass copied to clipboard

[RFC] Add back gcc 4.4 compatibility

Open mgreter opened this issue 8 years ago • 19 comments

Since I get quite a few build fails from cpan test matrix for gcc 4.4, I tried how difficult it is to bring back gcc 4.4 compatibility based upon some previous work. It actually is not too hard to get libsass compiled with gcc 4.4 (and passing the spec tests). I want to put this PR into consideration, since I would like to apply the replace-range-for-loops.pl automatically when gcc 4.4 is detected by perl-libsass. Falls under "nice to have", but changes seem rather minimal.

The perl script produces this result: https://github.com/sass/libsass/tree/perl-libsass/gcc-4.4

Proof of concept:

mkdir libsass-gcc-4.4
cd libsass-gcc-4.4
wget -c http://strawberryperl.com/download/5.12.3.0/strawberry-perl-5.12.3.0-portable.zip
mkdir perl
cd perl
unzip ..\strawberry-perl-5.12.3.0-portable.zip
portableshell.bat

git clone https://github.com/sass/perl-libsass.git
cd perl-libsass
git submodule update --init
cd libsass
git remote add mgreter https://github.com/mgreter/libsass.git
git fetch mgreter
git checkout -b compat/gcc-4.4 mgreter/compat/gcc-4.4
perl script\replace-range-for-loops.pl
cd ..
perl -MCPAN -e "CPAN::Shell->notest('install', 'Filesys::Notify::Simple')"
perl -MCPAN -e "CPAN::Shell->notest('install', 'ExtUtils::CppGuess')"
perl -MCPAN -e "CPAN::Shell->notest('install', 'Test::Differences')"
perl -MCPAN -e "CPAN::Shell->notest('install', 'Encode::Locale')"
gcc -v
cpan .

Feedback welcome

mgreter avatar Oct 25 '15 05:10 mgreter

I have #995 and #996 to for this with autoconf. 4.4 has no issues with variadic templates?

saper avatar Oct 25 '15 08:10 saper

I was able to get it to compile with gcc 4.4.2, so it seems it had proper support for variadic templates. Tested it via various old strawberry perl portable installs for windows (which come with different gcc toolchains). Might be that I use different cflags on the perl-libsass install, because I think this posed a problem when I tried some time ago.

For documentation here how I compile in the perl portableshell:

git clone http://www.github.com/sass/perl-libsass --branch=latest
cd perl-libsass
cpan . # only needed once for deps
perl Makefile.PL
dmake -P9 test

mgreter avatar Oct 27 '15 00:10 mgreter

This is essential to use this module on Centos6 based hosts, in corporate environments

ArcticSnowman avatar Apr 29 '16 14:04 ArcticSnowman

How so? I routinely build LibSass on centos 5. Updating GCC is trivial enough. On 30 Apr 2016 12:53 AM, "Steven Arnott" [email protected] wrote:

This is essential to use this module on Centos6 based hosts, in corporate environments

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/sass/libsass/pull/1623#issuecomment-215743515

xzyfer avatar Apr 29 '16 14:04 xzyfer

IMHO we cannot do this without also running GCC 4.4 in CI as well

xzyfer avatar Apr 29 '16 15:04 xzyfer

In our corporate environment, we are required to stick to the officially supported Centos6 releases of GCC, which is stuck at 4.4.7. And while there are a whole host of work-around, that's not the route we want our developers to go down if we can help it.

ArcticSnowman avatar Apr 29 '16 15:04 ArcticSnowman

I have rebased this to latest master and fixed the remaining issue with mac clang. I pretty much would like to get this merged, as it would allow perl-libsass to autodetect this and apply the last "patch" in form of the script in the second commit to the source tree. To get the git tree 4.4 compatible, we would need to get rid of all for(auto el : container) loops, and I actually like that feature a lot. So for me an automated way to "unroll" these loops is good enough.

@ArcticSnowman would that be good enough to support your use case? It does add the dependency on the perl script, but perl should be widely available or you can always generate the gcc 4.4 compatible source tree somewhere else and transfer it (or generate a patch to apply).

Since the proof is in the pudding (libsass via strawberry perl and gcc 4.4.3 on windows):

mkdir libsass-gcc-4.4
cd libsass-gcc-4.4
wget -c http://strawberryperl.com/download/5.12.3.0/strawberry-perl-5.12.3.0-portable.zip
mkdir perl
cd perl
unzip ..\strawberry-perl-5.12.3.0-portable.zip
portableshell.bat

git clone https://github.com/sass/perl-libsass.git
cd perl-libsass
git submodule update --init
cd libsass
git remote add mgreter https://github.com/mgreter/libsass.git
git fetch mgreter
git checkout -b compat/gcc-4.4 mgreter/compat/gcc-4.4
perl script\replace-range-for-loops.pl
cd ..
perl -MCPAN -e "CPAN::Shell->notest('install', 'ExtUtils::CppGuess')"
perl -MCPAN -e "CPAN::Shell->notest('install', 'Test::Differences')"
perl -MCPAN -e "CPAN::Shell->notest('install', 'Encode::Locale')"
gcc -v
cpan .

mgreter avatar May 01 '16 21:05 mgreter

I also like the short for loops, but I think we should unroll them to avoid issues like somebody adding or changing some loop to the form that cannot be automatically unrolled with a script (like the ones patched above).

saper avatar May 01 '16 21:05 saper

IMO any code change may add something gcc 4.4 incompatible (I did so with ltrim/rtrim). I guess there are always chances we need to fix up these incompatibilites at a later stage, and I don't see the short for loops as an exclusion here. And as a developer I really would like to keep the convenience.

mgreter avatar May 01 '16 21:05 mgreter

Please a documentation page for compiling with gcc 4.4 which at the very least documents the Python dependency, the purpose of the Python script, and it's caveats i.e. naive parsing. On 2 May 2016 7:11 AM, "Marcel Greter" [email protected] wrote:

IMO any code change may add something gcc 4.4 incompatible (I did so with ltrim/rtrim). I guess there are always chances we need to fix up these incompatibilites at a later stage, and I don't see the short for loops as an exclusion here. And as a developer I really would like to keep the convenience.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/sass/libsass/pull/1623#issuecomment-216072995

xzyfer avatar May 01 '16 23:05 xzyfer

My shop only supports GCC 4.4.7 on our production machines. I'd love to see this get merged in, and libsass-python library updated when it's ready.

k-funk avatar May 03 '16 23:05 k-funk

+1 most production environments aren't going to support gcc5 for a while, it would be nice to keep Saas working without requiring crazy-bleeding-edge versions of things. Enterprise life-cycles are measured in years, not months...

Roguelazer avatar Jul 01 '16 21:07 Roguelazer

I'm open to a PR for cpplint style check in CI. With cinema level guarantees I don't feel comfortable attempting gcc 4.4 support. On 2 Jul 2016 7:21 AM, "James Brown" [email protected] wrote:

+1 most production environments aren't going to support gcc5 for a while, it would be nice to keep Saas working without requiring crazy-bleeding-edge versions of things. Enterprise life-cycles are measured in years, not months...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sass/libsass/pull/1623#issuecomment-230050116, or mute the thread https://github.com/notifications/unsubscribe/AAjZWHUHOUHRhcCZWDgIXueTHp2TQwNtks5qRYT1gaJpZM4GVJlz .

xzyfer avatar Jul 02 '16 01:07 xzyfer

Any progress on this, or is it decided to not have 4.4 support?

I don't feel comfortable attempting gcc 4.4 support

Still seems pretty unreasonable that libsass can't be used on CentOS 6 (LOTS of shared-hosting boxes).

k-funk avatar Mar 09 '17 21:03 k-funk

I'm regularly releasing perl-libsass with gcc 4.4 support. The archive contains gcc 4.4 compatible libsass sources (this branch with unrolled for loops). On compatible systems it should also automatically compile and install sassc plus libsass plugins. Unfortunately I wasn't able to convince other libsass maintainers to get this merged into master (see their comments/reasoning above), but you could try to apply the patches in this branch on any implementation (i.e. node-sass). Then you only need to execute perl script\replace-range-for-loops.pl (see example in one of my earlier comment) and compile/install the given implementation.

mgreter avatar Mar 09 '17 23:03 mgreter

Do we still want to deal with non C++ 11 compilers in 2019?

glebm avatar Apr 15 '19 06:04 glebm

I will and have updated this branch for perl-libsass and will do so in the future. As long as the changes needed are manageable of course ...

mgreter avatar Apr 15 '19 17:04 mgreter

I'm curious, why does Perl require such an old GCC version?

glebm avatar Apr 25 '19 20:04 glebm

I'm curious, why does Perl require such an old GCC version?

There are quite a few CPAN testers that still use 4.4, there are even some that are still on gcc 4.2. It might not be that many in real life, but it's still nice to have as many green as possible. Btw. the patches are included in perl-libsass itself and applied automatically if needed.

http://matrix.cpantesters.org/?dist=CSS-Sass

mgreter avatar Apr 26 '19 11:04 mgreter