yuhangwang / gyp

Automatically exported from code.google.com/p/gyp
0 stars 0 forks source link

LINK.target has wrong value if LD environment variable is set #350

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
./tools/gyp/pylib/gyp/generator/make.py contains the following statement:
  header_params.update({
    'CC.target':   GetEnvironFallback(('CC_target', 'CC'), '$(CC)'),
    'AR.target':   GetEnvironFallback(('AR_target', 'AR'), '$(AR)'),
    'CXX.target':  GetEnvironFallback(('CXX_target', 'CXX'), '$(CXX)'),
    'LINK.target': GetEnvironFallback(('LD_target', 'CXX'), '$(LINK)'),
    'CC.host':     GetEnvironFallback(('CC_host',), 'gcc'),
    'AR.host':     GetEnvironFallback(('AR_host',), 'ar'),
    'CXX.host':    GetEnvironFallback(('CXX_host',), 'g++'),
    'LINK.host':   GetEnvironFallback(('LD_host',), 'g++'),
  })

LINK.host is correctly set to g++ but LINK.target will become $LD if it is set.
Many embedded builders like buildroot set LD to arch-vendor-linux-ld.
Gyp will create in this case a broken Makefile which calls ld instead of g++.

I found this issue while cross compiling v8.

Thanks,
//richard

Original issue reported on code.google.com by richard....@gmail.com on 18 Jun 2013 at 4:14

GoogleCodeExporter commented 9 years ago
Damn, posted the wrong code snippet.

See LINK.target:

 header_params.update({
    'CC.target':   GetEnvironFallback(('CC_target', 'CC'), '$(CC)'),
    'AR.target':   GetEnvironFallback(('AR_target', 'AR'), '$(AR)'),
    'CXX.target':  GetEnvironFallback(('CXX_target', 'CXX'), '$(CXX)'),
    'LINK.target': GetEnvironFallback(('LD_target', 'LD'), '$(LINK)'),
    'CC.host':     GetEnvironFallback(('CC_host',), 'gcc'),
    'AR.host':     GetEnvironFallback(('AR_host',), 'ar'),
    'CXX.host':    GetEnvironFallback(('CXX_host',), 'g++'),
    'LINK.host':   GetEnvironFallback(('LD_host',), 'g++'),
  })

Original comment by richard....@gmail.com on 18 Jun 2013 at 5:16