Issue and Steps to Reproduce
[UPDATE] How to reproduce: #1454 (comment)
If user has CPPFLAGS & LDFLAGS environments as set and exported (these variables consist flags for gcc & linker) then your Makefile redefines its and configure libraries (external/*) gets incorrect LDFLAGS and CPPFLAGS variables.
Your Makefile:
https://github.com/ElementsProject/lightning/blob/master/Makefile#L163
https://github.com/ElementsProject/lightning/blob/master/Makefile#L171
For example: I cannot compile your c-lightning in CentOS 6.* from user bitcoin because i have my own gcc & autotools programs in $HOME. I have as defined these variables but your make's recipe commands get your ones not my ones. It's incorrect behaviour.
When make runs a recipe, variables defined in the makefile are placed into
the environment of each shell. This allows you to pass values to sub-make
invocations (see Recursive Use of make). By default, only variables that
came from the environment or the command line are passed to recursive
invocations. You can use the export directive to pass other variables. See
Communicating Variables to a Sub-make, for full details.
So if i have CPPFLAGS & LDFLAGS are defined in my environment all recipes in your Makefiles and sub-Makefiles will get your CPPFLAGS & LDFLAGS variables not my ones. And i cannot compile your c-lightning (because gcc and other tools should look in directories which i defined in these variables).
Correct behaviour:
I'm sure you should consider the value of these variables from outside. I checked Makefiles created by third-party programs (bitcoin core for example) which i compilied successfully. The configure script consides these variables and to add own options not replace.
Conclusion
May be to use += operation for these flags not =. I will try to make patch.
Issue and Steps to Reproduce
[UPDATE] How to reproduce: #1454 (comment)
If user has
CPPFLAGS&LDFLAGSenvironments as set and exported (these variables consist flags for gcc & linker) then your Makefile redefines its andconfigurelibraries (external/*) gets incorrectLDFLAGSandCPPFLAGSvariables.Your Makefile:
https://github.com/ElementsProject/lightning/blob/master/Makefile#L163
https://github.com/ElementsProject/lightning/blob/master/Makefile#L171
For example: I cannot compile your c-lightning in CentOS 6.* from user
bitcoinbecause i have my own gcc & autotools programs in $HOME. I have as defined these variables but your make's recipe commands get your ones not my ones. It's incorrect behaviour.The make docs:
So if i have
CPPFLAGS&LDFLAGSare defined in my environment all recipes in your Makefiles and sub-Makefiles will get your CPPFLAGS & LDFLAGS variables not my ones. And i cannot compile your c-lightning (becausegccand other tools should look in directories which i defined in these variables).Correct behaviour:
I'm sure you should consider the value of these variables from outside. I checked Makefiles created by third-party programs (bitcoin core for example) which i compilied successfully. The
configurescript consides these variables and to add own options not replace.Conclusion
May be to use
+=operation for these flags not=. I will try to make patch.