GeezerVison is showing github.com — libtool: unrecognized option `-static` when building · Issue #2341 · nodejs/node
libtool: unrecognized option -static when building #2341Labels buildIssues and PRs related to Node.js builds or CI infrastructure.macosIssues and PRs related to the macOS platform. DescriptionFresh clone and first attempt at building io.js, After running ./configure and make, I encounter this error:
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C out BUILDTYPE=Release V=1
rm -f /Users/bwkahle/git/io.js/out/Release/libgtest.a && ./gyp-mac-tool filter-libtool libtool -static -o /Users/bwkahle/git/io.js/out/Release/libgtest.a /Users/bwkahle/git/io.js/out/Release/obj.target/gtest/deps/gtest/src/gtest-death-test.o /Users/bwkahle/git/io.js/out/Release/obj.target/gtest/deps/gtest/src/gtest-filepath.o /Users/bwkahle/git/io.js/out/Release/obj.target/gtest/deps/gtest/src/gtest-port.o /Users/bwkahle/git/io.js/out/Release/obj.target/gtest/deps/gtest/src/gtest-printers.o /Users/bwkahle/git/io.js/out/Release/obj.target/gtest/deps/gtest/src/gtest-test-part.o /Users/bwkahle/git/io.js/out/Release/obj.target/gtest/deps/gtest/src/gtest-typed-test.o /Users/bwkahle/git/io.js/out/Release/obj.target/gtest/deps/gtest/src/gtest.o /Users/bwkahle/git/io.js/out/Release/obj.target/gtest/deps/gtest/src/gtest_main.o
libtool: unrecognized option `-static'
libtool: Try `libtool --help' for more information.
make[1]: *** [/Users/bwkahle/git/io.js/out/Release/libgtest.a] Error 1
make: *** [iojs] Error 2
Here is version information for my build environment:
gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix
make -v
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0
python --version
Python 2.7.10
Any help is much appreciated. Thanks! Activityadded buildIssues and PRs related to Node.js builds or CI infrastructure. macosIssues and PRs related to the macOS platform. on Aug 10, 2015bnoordhuis commented on Aug 10, 2015 I speculate that you have a libtool from e.g. homebrew on your path somewhere. which libtool should print /usr/bin/libtool and libtool --version should probably be 2.4.2. Reacted by Federico Zivolo, Aha, Oliver Wise, Sators and Vikas Joshi brycekahle commented on Aug 10, 2015 ContributorAuthor More actions Thanks for the reply! You are a correct, it was libtool from chefdk at /opt/chefdk/embedded/bin/libtool. jrgleason commented on Apr 25, 2018 What happens if you are at 2.4.6? Do we need to downgrade? Reacted by johneke-akamai, royee, wm-oci, Xiaoting Tang, Vincent Belaïche and Rijk van Zanten wm-oci commented on Jun 28, 2018 It seems odd that a libtool minor update (from 2.4.2 to 2.4.6) should be a breaking change. This is also causing nodejs to fail on install, specifically to install node-gyp during node-gyp's make step.
macOS High Sierra
libtool 2.4.6
GNU Make 3.81
node 10.5.0
node-gyp -v v3.6.2
Try 'libtool --help' for more information.
libtool: error: unrecognised option: '-static'
make: *** [Release/sass.a] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/you/project/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Darwin 17.4.0
gyp ERR! command "/usr/local/bin/node" "/Users/you/project/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/you/project/node_modules/node-sass
gyp ERR! node -v v10.5.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
zomglings commented on Sep 7, 2018 Any updates on this issue? I had to do some path gymnastics to get around this on my mac.
OS: macOS High Sierra
libtool 2.4.6 (installed with MacPorts)
node 9.11.2 Reacted by Thijs Triemstra zomglings commented on Sep 7, 2018 Wit MacPorts, this worked for me:
sudo port deactivate libtool
npm install
sudo port activate libtool
Reacted by Adam Zielinski (Anyline) and Stephan Grein Alphatone commented on Oct 12, 2018 Had this error with my local MAMP setup.
OS: macOS High Sierra 13.6
node: 10.12.0 / 6.11.14 (tried both)
Does not work:
PATH=/Applications/MAMP/Library/bin/:$PATH
Does work:
PATH=/usr/local/bin:$PATH
I switched back and forth between the MAMP path and the usr/local/bin, works now with the MAMP path as well. If anyone can tell me why, I would highly appreciate it. Reacted by Bosporos, John Kary and Mitul Golakiya zk4 commented on Jan 22, 2019 try this
brew unlink libtool
rm -rf /usr/local/bin/libtool
which libtool
point to /usr/bin/libtool Reacted by Pauli, Alexander Sutyagin, Leon Huang, John Domingo, chanduthedev, Kovean, Jean-Charles (jc), pito-svk, Metaeditor, Alexey Kovalev and 18 more Reacted by John Domingo and Yize Reacted by John Domingo, Yize and Sators Reacted by John Domingo and Yize Reacted by John Domingo and Yize Reacted by Khanh Ney wuliupo commented on Jan 26, 2019
try this
brew unlink libtool
rm -rf /usr/local/bin/libtool
which libtool
point to /usr/bin/libtool
Thanks @zk4 . it works for me Reacted by David Veksler, Chester A. Unal and Max Sysoev benchuk commented on Feb 24, 2019 Thanks @zk4 . it works for me as well! bosporos commented on Mar 1, 2019 Since I use neither macports or homebrew (I do my builds straight from source), I had to cook up something a little more homebrew; the end-product you see before you.
A pair of liners that worked for me (should be done in the same shell context, tho, because it relies on the variable $CHANGED_FILES to keep the information; you could rework it to save to a file, too):
- Renames all
libtools in $PATH to libtool_hidden (except for /usr/bin/libtool), and dumps the paths to the libtools (pre-change) to a variable named $CHANGED_FILES. Run before compiling node
CHANGED_FILES=''; while [[ `which libtool` != '/usr/bin/libtool' ]] ; do ORIGINAL=`which libtool`; CHANGED_FILES="$CHANGED_FILES $ORIGINAL"; mv `which libtool` `which libtool`_hidden ; done
- Moves the
libtool_hidden files back to where they were originally:
for file in $CHANGED_FILES ; do mv "$(dirname $file)/libtool_hidden" $file ; done Reacted by Hugh Guiney, JasonTolliver and Kipras Melnikovas Reacted by JasonTolliver, badger200 and Kipras Melnikovas matthewbauer commented on May 3, 2019 @brycekahle Can this be reopened? This is still a valid issue from what I can tell. node-gyp should provide a fallback in the case where GNU libtool is in your PATH. In some cases GNU libtool needs to be in your PATH based on requirements from other packages. matthewbauer commented on May 3, 2019 Actually this looks like it's more of a problem in chromium gyp. Unfortunately they don't have an issue tracker ☹️ bnoordhuis commented on May 5, 2019 There's no need to reopen, it's working as expected. If you override the system libtool with something else, you had better make sure it's compatible. Ditto cc, ar, ld, etc. Reacted by Jared Flatow and Ulysses Zhan Reacted by badger200 matthewbauer commented on May 5, 2019 The problem is other tools expect libtool to be the GNU one. I guess you could say it’s an issue with those tools but it is much more common for the GNU libtool to be used and not the very obscure NeXTSTEP one. This kind of thing probably wouldn’t come up much in chromium’s use case, but is very very common when building multi language projects that include node bindings.
I think this can be fixed very easily by falling back to ar rcs when libtool is the GNU version. I’m willing to make a patch for this but would like the issue to be accepted as valid first. Reacted by Bosporos, purejgleason and badger200 Reacted by badger200 bnoordhuis commented on May 6, 2019
very obscure
It's the platform libtool. That's the opposite of obscure, it's the default.
GYP does quite a bit of processing around libtool so I'm not inclined to accept patches that try to go on when it's not the expected version, that probably creates more issues down the road than it fixes, probably more subtle ones too.
A patch that hard-codes the path to /usr/bin/libtool might be acceptable. chanduthedev commented on May 7, 2019
try this
brew unlink libtool
rm -rf /usr/local/bin/libtool
which libtool
point to /usr/bin/libtool
Thanks. It worked for me. yuangu commented on Jan 30, 2020 Thanks @zk4 . it works for me as well! purejgleason commented on Aug 21, 2021 So wait it is 2021 and this is still an issue? I just tried today with 2.4.6 and got the same
Can I regenerate the configure or something to get it to work with the GNU version? grasmash commented on Oct 18, 2021 I had MAMP installed and MAMP binaries in my $PATH, including libtool:
$ which libtool
/Applications/MAMP/Library/bin/libtool
Removing that fixed the issue. Reacted by Sators, David Muhanguzi and Pavel Ciorici stephanmg commented on Aug 23, 2022
It seems odd that a libtool minor update (from 2.4.2 to 2.4.6) should be a breaking change. This is also causing nodejs to fail on install, specifically to install node-gyp during node-gyp's make step.
macOS High Sierra libtool 2.4.6 GNU Make 3.81 node 10.5.0 node-gyp -v v3.6.2
Try 'libtool --help' for more information.
libtool: error: unrecognised option: '-static'
make: *** [Release/sass.a] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/you/project/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Darwin 17.4.0
gyp ERR! command "/usr/local/bin/node" "/Users/you/project/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/you/project/node_modules/node-sass
gyp ERR! node -v v10.5.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
seems to be the case for me from 2.4.6_13 to 2.4.7_0 as well, deactivating libtool with macports works. Reacted by Alexandre Marangoni Costa linonetwo commented on Jun 7, 2023 which libtool
/usr/bin/libtool
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `-' in: --version
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]
libtool --help
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `-' in: --help
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]
Preparing native dependencies: 0 / 1
› node-gyp failed to rebuild '/Users/linonetwo/Desktop/repo/TiddlyGit-Desktop/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3'
◼ Running generateAssets hook
› TOUCH ba23eeee118cd63e16015df367567cb043fed872.intermediate
ACTION deps_sqlite3_gyp_locate_sqlite3_target_copy_builtin_sqlite3 ba23eeee118cd63e16015df367567cb043fed872.intermediate
TOUCH Release/obj.target/deps/locate_sqlite3.stamp
CC(target) Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
LIBTOOL-STATIC Release/sqlite3.a
Usage: /opt/anaconda3/bin/libtool [OPTION]... [MODE-ARG]...
Try 'libtool --help' for more information.
libtool: error: unrecognised option: '-static'
make: *** [Release/sqlite3.a] Error 1
rm ba23eeee118cd63e16015df367567cb043fed872.intermediate
Error: `make` failed with exit code: 2
at ChildProcess.onExit (/Users/linonetwo/Desktop/repo/TiddlyGit-Desktop/node_modules/.pnpm/[email protected][email protected]/node_modules/node-gyp/lib/build.js:203:23)
at ChildProcess.emit (node:events:511:28)
at ChildProcess._handle.onexit (node:internal/child_process:293:12)
An unhandled rejection has occurred inside Forge:
Error: node-gyp failed to rebuild '/Users/linonetwo/Desktop/repo/TiddlyGit-Desktop/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3'
at ChildProcess.<anonymous> (/Users/linonetwo/Desktop/repo/TiddlyGit-Desktop/node_modules/.pnpm/@[email protected][email protected]/node_modules/@electron/rebuild/lib/module-type/node-gyp/node-gyp.js:118:24)
at ChildProcess.emit (node:events:511:28)
at ChildProcess._handle.onexit (node:internal/child_process:293:12)
ELIFECYCLE Command failed with exit code 1.
#2341 (comment) is not working
After uninstall anaconda3 and restart Mac, it still output the something, and try to use /opt/anaconda3/bin/libtool
manually run node_modules/.bin/electron-rebuild -f -w better-sqlite3 works.
OpenSC2K/OpenSC2K#33 (comment) BWStearns commented on Apr 2, 2024 For me uninstalling libtool via brew worked. which libtool should return /usr/bin/libtool (if you're having the same issue as me)
MetadataMetadatabuildIssues and PRs related to Node.js builds or CI infrastructure.macosIssues and PRs related to the macOS platform. DevelopmentNo branches or pull requestsIssue actions
|