Does not compile on gcc <4.3 (engineyard) #4186

Closed
fx opened this Issue Oct 23, 2012 · 4 comments

3 participants

@fx
fx commented Oct 23, 2012

d3fa0dc breaks compilation with GCC older than 4.3

See http://gcc.gnu.org/viewcvs?view=revision&revision=120347

(Via John Marshall on SO: http://facebook.stackoverflow.com/questions/13023239/compiling-node-gives-no-old-style-declaration-flag-error/13025257#13025257)

EngineYard's current stack uses gcc version 4.1.2 and while grepping out that line in a cookbook is rather easy if you know what's happening, it might be preferable to have some extra output instead of confusing people that might not be able to figure this out.

@bnoordhuis
Node.js Foundation member

gcc 4.1.2... maybe they should consider upgrading.

Can you try this patch? Re-run configure after applying it.

diff --git a/deps/openssl/openssl.gyp b/deps/openssl/openssl.gyp
index 3f4a7fa..297d3de 100644
--- a/deps/openssl/openssl.gyp
+++ b/deps/openssl/openssl.gyp
@@ -3,6 +3,11 @@
 # found in the LICENSE file.

 {
+  'variables': {
+    'is_clang': 0,
+    'gcc_version': 0,
+  },
+
   'targets': [
     {
       'target_name': 'openssl',
@@ -674,10 +679,10 @@
             'OPENSSLDIR="/etc/ssl"',
             'TERMIOS',
           ],
-          'cflags': [
-            '-Wno-missing-field-initializers',
-            '-Wno-old-style-declaration',
-          ],
+          'cflags': ['-Wno-missing-field-initializers'],
+        }],
+        ['is_clang==1 or gcc_version>=43', {
+          'cflags': ['-Wno-old-style-declaration'],
         }],
         ['OS=="solaris"', {
           'defines': ['__EXTENSIONS__'],
@koesper

I was experiencing the same problem (while installing Node on a Synology NAS), and this patch seems to work.
Now I am running into another (unrelated) error, but the 'MAKE' command now proceeds beyond the original error.

(And yes, gcc 4.1 is ancient, but it is not always an option to upgrade)

@fx
fx commented Oct 29, 2012

Oh, I stepped away there for a minute. I'll be working on some EY stuff tomorrow, I'll confirm if it works then.

@bnoordhuis bnoordhuis added a commit that closed this issue Dec 3, 2012
@bnoordhuis bnoordhuis build: avoid -Wno-old-style-declaration with gcc 4.2
Fixes the build on FreeBSD <= 9 with the default compiler.

Fixes #4186.
f8999da
@bnoordhuis bnoordhuis closed this in f8999da Dec 3, 2012
@bnoordhuis
Node.js Foundation member

Fixed in f8999da.

@knu knu pushed a commit to idaemons/freebsd-ports that referenced this issue Apr 13, 2014
jhale MFH r307220
- Fix build with base gcc

Reported by:	pointyhat via beat
Approved by:	portmgr (tabthorpe)
		makc, avilla (mentors, implicit)
Obtained from:	nodejs/node-v0.x-archive#4186
Feature safe:	yes
a63346d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment