Simple CPP file failed to compile with Clang - clang

#include "clang/AST/ASTConsumer.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetOptions.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Parse/ParseAST.h"
#include "clang/Rewrite/Rewriter.h"
#include "clang/Rewrite/Rewriters.h"
#include "llvm/Support/Host.h"
int main()
{
return 0;
}
I am compiling it as
clang++ -I/home/pc/llvm-3.3.src/tools/clang/include -I/home/pc/llvm-3.3-build/tools/clang/include -I/usr/local/include -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-uninitialized -Wnon-virtual-dtor -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti -c -o simple.o simple.cpp
I am getting error as 'clang/Rewrite/Rewriter.h' file not found

About a year ago (before the release of llvm 3.2), ClangRewrite was split into 2 libraries: ClangRewriteCore and ClangRewriteFrontend.
This means that:
clang/Rewrite/Rewriter.h is now clang/Rewrite/Core/Rewriter.h.
clang/Rewrite/Rewriters.h is now clang/Rewrite/Frontend/Rewriters.h.
libclangRewrite.a is now libclangRewriteCore.a and libclangRewriteFrontend.a.
You can see the change in the LLVM repository here.

Related

Homebrew- impossible to install postgresql

I am stuck in the installation process of pg, making circles with the same issues, and couldn't resolve them.
I brew install libpq, then brew install openssl#1.1 then pg, and the exit error goes back to ask me to reinstall OpenSSL.
I have several Rails projects where PG used to work fine. I updates homebrew a few days ago and my configuration is a total mess.
My system is Mac OS Mojave 10.14.6. What do you advise to clean and start again with a proper configuration? (I am far from being a command line expert..)
Thanks for all recommendations!
Here is the mkmf.log I get when the installation of pg fails:
find_executable: checking for pg_config... -------------------- no
--------------------
checking for libpq per pkg-config... -------------------- no
"pkg-config --exists libpq"
| pkg-config --libs libpq
=> "-lpq\n"
"clang -fdeclspec -o conftest -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/x86_64-darwin18 -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0 -I. -I/Users/rougnaux/.rbenv/versions/3.0.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -L. -L/Users/rougnaux/.rbenv/versions/3.0.0/lib -L. -L/Users/rougnaux/.rbenv/versions/3.0.0/lib -fstack-protector-strong -L/usr/local/lib -lruby.3.0 "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
"clang -fdeclspec -o conftest -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/x86_64-darwin18 -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0 -I. -I/Users/rougnaux/.rbenv/versions/3.0.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -L. -L/Users/rougnaux/.rbenv/versions/3.0.0/lib -L. -L/Users/rougnaux/.rbenv/versions/3.0.0/lib -fstack-protector-strong -L/usr/local/lib -lruby.3.0 -lpq "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
| pkg-config --cflags-only-I libpq
=> "-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr/local/include\n"
| pkg-config --cflags-only-other libpq
=> "\n"
| pkg-config --libs-only-l libpq
=> "-lpq\n"
package configuration for libpq
incflags: -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr/local/include
cflags:
ldflags:
libs: -lpq
--------------------
find_header: checking for libpq-fe.h... -------------------- no
"clang -E -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/x86_64-darwin18 -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0 -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr/local/include -I/Users/rougnaux/.rbenv/versions/3.0.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'libpq-fe.h' file not found
#include <libpq-fe.h>
^~~~~~~~~~~~
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
/* end */
have you tried using an installed instead? https://www.postgresql.org/download/

Rails postresql installation issue

Hi folks, I have a problem when I try to install the postgresql, it is about a project, first I install the postgresql, then I write: sudo bundle install and it gives me this error and I cannot run the project because of it:
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/pg-0.20.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/pg-0.20.0 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/pg-0.20.0/gem_make.out
Below is the code from the file: mkmf.log
nd_executable: checking for pg_config... -------------------- yes
/usr/lib/ruby/2.3.0/mkmf.rb:1547: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
--------------------
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby-2.3 -Wl,-rpath, -lpthread -lgmp -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
find_header: checking for libpq-fe.h... -------------------- no
"gcc -E -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -o conftest.i"
conftest.c:3:22: fatal error: libpq-fe.h: No such file or directory
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
/* end */
--------------------

Can't install ActiveSupport for Ruby on Windows

I'm trying to install ActiveSupport on my pc which runs Win 8, but it fails and it gives me a list of things that went wrong.
See screenshot: http://imgur.com/2EP46TT
I installed the DevKit beforehand, in case this matters.
I'm very new to Ruby so I'd really appreciate any help I can get.
This is what was in the mkmf.log
"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32 -IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward -IC:/Ruby200-x64/include/ruby-2.0.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64 -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -march=native conftest.c -L. -LC:/Ruby200-x64/lib -L. -lx64-msvcrt-ruby200 -lshell32 -lws2_32 -limagehlp -lshlwapi "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include
4: #include
5: int main(int argc, char **argv)
6: {
7: return 0;
8: }
/* end */

Unable to install linecache19 gem

When i do bundle install im getting the following error "An error occurred while installing linecache19 (0.5.11), and Bundler cannot continue". The complete trace is as follows :
Installing linecache19 (0.5.11) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/raza/.rvm/rubies/ruby-1.9.3-p362/bin/ruby extconf.rb
checking for vm_core.h... no
/home/raza/.rvm/gems/ruby-1.9.3-p362#holla/gems/ruby_core_source-0.1.4/lib/ruby_core_source.rb:39: Use RbConfig instead of obsolete and deprecated Config.
checking for vm_core.h... yes
checking for version.h... yes
checking for RUBY_VERSION_MAJOR in version.h... no
Requesting http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p362.tar.gz
Downloading http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p362.tar.gz
checking for vm_core.h... yes
checking for version.h... yes
checking for RUBY_VERSION_MAJOR in version.h... no
Makefile creation failed
*************************************************************
NOTE: For Ruby 1.9 installation instructions, please see:
http://wiki.github.com/mark-moseley/ruby-debug
*************************************************************
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/raza/.rvm/rubies/ruby-1.9.3-p362/bin/ruby
--with-ruby-dir
--without-ruby-dir
--with-ruby-include
--without-ruby-include=${ruby-dir}/include
--with-ruby-lib
--without-ruby-lib=${ruby-dir}/lib
Gem files will remain installed in /home/raza/.rvm/gems/ruby-1.9.3-p362#holla/gems/linecache19-0.5.11 for inspection.
Results logged to /home/raza/.rvm/gems/ruby-1.9.3-p362#holla/gems/linecache19-0.5.11/ext/trace_nums/gem_make.out
An error occurred while installing linecache19 (0.5.11), and Bundler cannot continue.
Make sure that `gem install linecache19 -v '0.5.11'` succeeds before bundling.
I then tried running gem install linecache19 -v '0.5.11' as well as gem install linecache19 -v '0.5.11' -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p362 but still facing same problem.
My mkmf.log located at ~/.rvm/gems/ruby-1.9.3-p362#holla/gems/linecache19-0.5.11/ext/trace_nums is as follows :
have_header: checking for vm_core.h... -------------------- no
"gcc -o conftest -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/x86_64-linux -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/ruby/backward -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1 -I. -I/home/raza/.rvm/usr/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/home/raza/.rvm/rubies/ruby-1.9.3-p362/lib -Wl,-R/home/raza/.rvm/rubies/ruby-1.9.3-p362/lib -L/home/raza/.rvm/usr/lib -Wl,-R/home/raza/.rvm/usr/lib -L. -rdynamic -Wl,-export-dynamic -L/home/raza/.rvm/usr/lib -Wl,-R/home/raza/.rvm/usr/lib -Wl,-R -Wl,/home/raza/.rvm/rubies/ruby-1.9.3-p362/lib -L/home/raza/.rvm/rubies/ruby-1.9.3-p362/lib -lruby -lpthread -lrt -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
"gcc -E -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/x86_64-linux -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/ruby/backward -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1 -I. -I/home/raza/.rvm/usr/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -o conftest.i"
conftest.c:3:21: fatal error: vm_core.h: No such file or directory
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <vm_core.h>
/* end */
--------------------
have_header: checking for vm_core.h... -------------------- yes
"gcc -E -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/x86_64-linux -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/ruby/backward -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1 -I. -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/ruby-1.9.3-p362 -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <vm_core.h>
/* end */
--------------------
have_header: checking for version.h... -------------------- yes
"gcc -E -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/x86_64-linux -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/ruby/backward -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1 -I. -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/ruby-1.9.3-p362 -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <version.h>
/* end */
--------------------
have_macro: checking for RUBY_VERSION_MAJOR in version.h... -------------------- no
"gcc -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/x86_64-linux -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/ruby/backward -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1 -I. -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/ruby-1.9.3-p362 -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC -c conftest.c"
conftest.c:6:3: error: #error
conftest.c:7:1: error: expected identifier or ‘(’ before ‘>>’ token
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <version.h>
4: /*top*/
5: #ifndef RUBY_VERSION_MAJOR
6: # error
7: >>>>>> RUBY_VERSION_MAJOR undefined <<<<<<
8: #endif
/* end */
--------------------
have_header: checking for vm_core.h... -------------------- yes
"gcc -E -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/x86_64-linux -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/ruby/backward -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1 -I. -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/ruby-1.9.3-p362 -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <vm_core.h>
/* end */
--------------------
have_header: checking for version.h... -------------------- yes
"gcc -E -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/x86_64-linux -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/ruby/backward -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1 -I. -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/ruby-1.9.3-p362 -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <version.h>
/* end */
--------------------
have_macro: checking for RUBY_VERSION_MAJOR in version.h... -------------------- no
"gcc -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/x86_64-linux -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/ruby/backward -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1 -I. -I/home/raza/.rvm/rubies/ruby-1.9.3-p362/include/ruby-1.9.1/ruby-1.9.3-p362 -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC -c conftest.c"
conftest.c:6:3: error: #error
conftest.c:7:1: error: expected identifier or ‘(’ before ‘>>’ token
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <version.h>
4: /*top*/
5: #ifndef RUBY_VERSION_MAJOR
6: # error
7: >>>>>> RUBY_VERSION_MAJOR undefined <<<<<<
8: #endif
/* end */
--------------------
Im on a machine running Ubuntu 12.10. How can i fix this problem ?
Thank You
You need to install ruby-debug first passing the include directory.
gem install ruby-debug19 --
--with-ruby-include=$rvm_path/src/ruby-1.9.3-p362

Error Compiling libc++ using Clang 3.0 on Ubuntu

When I try to compile libc++ (libcxx) on my Ubuntu 12.04 with LLVM 3.0 and Clang 3.0 i get the error
+ clang++ -c -g -Os -fPIC -std=c++0x -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion -Wnewline-eof -Wpadded -Wmissing-prototypes -Wstrict-aliasing=2 -Wstrict-overflow=4 -nostdinc++ -I../include ../src/stdexcept.cpp
../src/stdexcept.cpp:18:10: fatal error: 'cxxabi.h' file not found
#include <cxxabi.h>
^
1 error generated.
Where should I put cxxabi.h? It's currently in the following places
/usr/include/c++/4.4/cxxabi.h
/usr/include/c++/4.6/cxxabi.h
/usr/include/c++/4.7/cxxabi.h
My best guess is that any of these cxxabi.h will work. The only thing std except.cpp is looking for is if it is being used with libc++abi, which will be false for all 3 of your cxxabi.h.

Resources