-
-
Save springmeyer/4e89a4b24c35dcd1dcd8 to your computer and use it in GitHub Desktop.
download, build, and test program using libc++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir ~/projects/test-c11 | |
cd ~/projects/test-c11 | |
svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx | |
cd libcxx/lib | |
export CXX=/opt/llvm2/bin/clang++ | |
export CC=/opt/llvm2/bin/clang | |
export LD=/opt/llvm2/bin/clang | |
export TRIPLE=-apple- | |
./buildit | |
# fix install name id since it is wrongly hardcoded in the build script | |
install_name_tool -id `pwd`/libc++.1.dylib ./libc++.1.dylib | |
# create symlink without version to allow -stdlib=libc++ to work | |
ln -sf libc++.1.dylib libc++.dylib | |
cd ../../ | |
# create a test file | |
echo '#include <iostream>' > test.cpp | |
echo 'int main() { std::clog << "hello\n"; return 0; }' >> test.cpp | |
$CXX -std=c++11 -stdlib=libc++ -nostdinc++ -I./libcxx/include -L./libcxx/lib -lc++ -lSystem test.cpp -o test | |
# this also works for me which adds `-nostdlib` and removes `-stdlib=libc++` | |
$CXX -std=c++11 -nostdlib -nostdinc++ -I`pwd`/libcxx/include -L`pwd`/libcxx/lib test.cpp -o test -lc++ -lSystem /usr/lib/crt1.o | |
# and going further this also works which adds `-syslibroot` to point at our cust | |
# location and then requires manually linking to libSystem | |
$CXX -std=c++11 -stdlib=libc++ -nostdlib -nostdinc++ -I./libcxx/include -L./libcxx/lib test.cpp -o test -lc++ /usr/lib/crt1.o -Wl,-syslibroot,`pwd`/libcxx/lib -L/usr/lib -lSystem | |
# ensure it runs | |
$ ./test | |
hello | |
# ensure proper linking | |
$ otool -L test | |
test: | |
/Users/dane/projects/test-c11/libcxx/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0) | |
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0) |
building node.js 0.8.18 with libcxx:
export CC=clang
export RANLIB=clang
export CXX=clang++
export LD=clang
export CFLAGS=""
export LIBCXX=/Users/dane/src/libcxx
export CXXFLAGS="-std=c++11 -nostdinc++ -I${LIBCXX}/include"
export LDFLAGS="-nostdlib -stdlib=libc++ -L${LIBCXX}/lib -lc++ /usr/lib/crt1.o -lSystem"
./configure --prefix=/opt/node-c11
applied this patch:
--- src/node.cc 2013-01-22 13:22:00.000000000 -0800
+++ src/node.cc 2013-01-22 13:22:03.000000000 -0800
@@ -2983,7 +2983,7 @@
#ifndef NDEBUG
// Clean up. Not strictly necessary.
- V8::Dispose();
+ //V8::Dispose();
#endif // NDEBUG
// Clean up the copy:
then:
make -j8
make test
test results:
make -C out BUILDTYPE=Release V=1
make[1]: Nothing to be done for `all'.
ln -fs out/Release/node node
python tools/test.py --mode=release simple message
=== release test-child-process-customfd-bounded ===
Path: simple/test-child-process-customfd-bounded
child_process.js:794
throw errnoException(errno, 'spawn');
^
Error: spawn EMFILE
at errnoException (child_process.js:847:11)
at ChildProcess.spawn (child_process.js:794:11)
at exports.spawn (child_process.js:618:9)
at Object.exports.spawnPwd (/Users/dane/src/node-v0.8.18/test/common.js:72:12)
at Object.<anonymous> (/Users/dane/src/node-v0.8.18/test/simple/test-child-process-customfd-bounded.js:29:8)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
Command: out/Release/node /Users/dane/src/node-v0.8.18/test/simple/test-child-process-customfd-bounded.js
=== release test-memory-usage-emfile ===
Path: simple/test-memory-usage-emfile
fs.js:338
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: EMFILE, too many open files '/Users/dane/src/node-v0.8.18/test/simple/test-memory-usage-emfile.js'
at Object.fs.openSync (fs.js:338:18)
at Object.<anonymous> (/Users/dane/src/node-v0.8.18/test/simple/test-memory-usage-emfile.js:33:17)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
Command: out/Release/node /Users/dane/src/node-v0.8.18/test/simple/test-memory-usage-emfile.js
[02:19|% 100|+ 462|- 2]: Done
make: *** [test] Error 1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@springmeyer - great!