Skip to content

Commit 95dd890

Browse files
mednsbnoordhuis
authored andcommitted
build: add "--partly-static" build options
A lot of machines don't upgrade libstdc++.so library for a long time, but the new version of node requires the latest GLIBCXX. Using "--fully-static" configurable options may resolve this problem, but the side effect is that the size of the executable file will be increased. Adding "--partly-static" configurable options it will only build libgcc and libstdc++ libraries into executable file, resolve the problem and control the size of file. PR-URL: #4152 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Minwoo Jung <[email protected]>
1 parent dde2012 commit 95dd890

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

configure

+19-6
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,13 @@ parser.add_option("--fully-static",
8484
action="store_true",
8585
dest="fully_static",
8686
help="Generate an executable without external dynamic libraries. This "
87-
"will not work on OSX when using default compilation environment")
87+
"will not work on OSX when using the default compilation environment")
88+
89+
parser.add_option("--partly-static",
90+
action="store_true",
91+
dest="partly_static",
92+
help="Generate an executable with libgcc and libstdc++ libraries. This "
93+
"will not work on OSX when using the default compilation environment")
8894

8995
parser.add_option("--enable-vtune-profiling",
9096
action="store_true",
@@ -816,12 +822,19 @@ def configure_openssl(o):
816822
configure_library('openssl', o)
817823

818824

819-
def configure_fullystatic(o):
820-
if options.fully_static:
821-
o['libraries'] += ['-static']
825+
def configure_static(o):
826+
if options.fully_static or options.partly_static:
822827
if flavor == 'mac':
823828
print("Generation of static executable will not work on OSX "
824-
"when using default compilation environment")
829+
"when using the default compilation environment")
830+
return
831+
832+
if options.fully_static:
833+
o['libraries'] += ['-static']
834+
elif options.partly_static:
835+
o['libraries'] += ['-static-libgcc', '-static-libstdc++']
836+
if options.enable_asan:
837+
o['libraries'] += ['-static-libasan']
825838

826839

827840
def configure_winsdk(o):
@@ -1119,7 +1132,7 @@ configure_v8(output)
11191132
configure_openssl(output)
11201133
configure_winsdk(output)
11211134
configure_intl(output)
1122-
configure_fullystatic(output)
1135+
configure_static(output)
11231136

11241137
# variables should be a root level element,
11251138
# move everything else to target_defaults

0 commit comments

Comments
 (0)