Code Monkey home page Code Monkey logo

Comments (23)

jvillard avatar jvillard commented on July 18, 2024

Hi @proninyaroslav,

What command are you using to build the plugins? On linux you need a bunch of extra compiler flags. Since you're compiling the plugins to use with infer you should consider using ./compile-fcp.sh from inside the infer repo instead. This sets the relevant flags for you, in particular:

CC="clang" CXX="clang++" CFLAGS="-std=c++11 -fPIC" LDFLAGS="-shared"

If you don't have clang installed, you can use the one provided by facebook-clang-plugins to compile the plugins ;)

from facebook-clang-plugins.

proninyaroslav avatar proninyaroslav commented on July 18, 2024

I used /facebook-clang-plugin/clang/setup.sh, as recommended in Infer.
(./update-fcp.sh
../facebook-clang-plugin/clang/setup.sh
./compile-fcp.sh)

from facebook-clang-plugins.

jvillard avatar jvillard commented on July 18, 2024

I've installed a stock Arch linux virtual machine to try and reproduce your issue, but clang and the plugin compiled without error for me (gcc 5.2.0).

There have been a few changes to the plugin's Makefiles since you posted your issue however, this may have fixed your issue. Could you please try again with the latest infer?

from facebook-clang-plugins.

proninyaroslav avatar proninyaroslav commented on July 18, 2024

Ok, in the next few days I will try again.

P.S: Sorry, accidentally :)

from facebook-clang-plugins.

proninyaroslav avatar proninyaroslav commented on July 18, 2024

In file included from /usr/lib64/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../include/c++/5.2.0/type_traits:35:
/usr/lib64/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../include/c++/5.2.0/bits/c++0x_warning.h:32:2: error: This file requires compiler and library
support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler
options.
#error This file requires compiler and library support for the
^
In file included from PluginMain.cpp:11:
In file included from /home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/clang/StaticAnalyzer/Core/Checker.h:17:
In file included from /home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/clang/Analysis/ProgramPoint.h:18:
In file included from /home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/clang/Analysis/AnalysisContext.h:18:
In file included from /home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/clang/AST/Decl.h:17:
In file included from /home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/clang/AST/APValue.h:17:
In file included from /home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/clang/Basic/LLVM.h:22:
In file included from /home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/Casting.h:19:
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:55:25: error: no type named 'remove_reference' in
namespace 'std'
typedef typename std::remove_reference::type UnderlyingT;
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:55:41: error: expected member name or ';' after
declaration specifiers
typedef typename std::remove_reference::type UnderlyingT;

/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:59:13: error: no member named 'is_class' in namespace
      'std'
      !std::is_class<UnderlyingT>::value && // Filter conversion operators.
       ~~~~~^
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:59:22: error: use of undeclared identifier
      'UnderlyingT'
      !std::is_class<UnderlyingT>::value && // Filter conversion operators.
                     ^
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:59:34: error: no member named 'value' in the global
      namespace; did you mean simply 'value'?
      !std::is_class<UnderlyingT>::value && // Filter conversion operators.
                                 ^~~~~~~
                                 value                                                                                                                
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:58:21: note: 'value' declared here
  static const bool value =
                    ^
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:60:13: error: no member named 'is_pointer' in namespace
      'std'
      !std::is_pointer<UnderlyingT>::value &&
       ~~~~~^
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:60:24: error: use of undeclared identifier
      'UnderlyingT'
      !std::is_pointer<UnderlyingT>::value &&
                       ^
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:60:36: error: no member named 'value' in the global
      namespace; did you mean simply 'value'?
      !std::is_pointer<UnderlyingT>::value &&
                                   ^~~~~~~
                                   value                                                                                                              
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:58:21: note: 'value' declared here
  static const bool value =
                    ^
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:61:13: error: no member named 'is_floating_point' in
      namespace 'std'
      !std::is_floating_point<UnderlyingT>::value &&
       ~~~~~^
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:61:31: error: use of undeclared identifier
      'UnderlyingT'
      !std::is_floating_point<UnderlyingT>::value &&
                              ^
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:61:43: error: no member named 'value' in the global
      namespace; did you mean simply 'value'?
      !std::is_floating_point<UnderlyingT>::value &&
                                          ^~~~~~~
                                          value
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:58:21: note: 'value' declared here
  static const bool value =
                    ^
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:62:12: error: no member named 'is_convertible' in
      namespace 'std'
      std::is_convertible<UnderlyingT, unsigned long long>::value;
      ~~~~~^
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:62:27: error: use of undeclared identifier
      'UnderlyingT'
      std::is_convertible<UnderlyingT, unsigned long long>::value;
                          ^
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:62:40: error: expected member name or ';' after
      declaration specifiers
      std::is_convertible<UnderlyingT, unsigned long long>::value;
                                       ^
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:62:39: error: expected ';' at end of declaration list
      std::is_convertible<UnderlyingT, unsigned long long>::value;
                                      ^
                                      ;
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:71:22: error: no type named 'enable_if' in namespace
      'std'
    T, typename std::enable_if<std::is_pointer<T>::value>::type> {
       ~~~~~~~~~~~~~~^~~~~~~~~
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/type_traits.h:82:22: error: no type named 'enable_if' in namespace
      'std'
    T, typename std::enable_if<std::is_pointer<T>::value>::type> {
       ~~~~~~~~~~~~~~^~~~~~~~~
In file included from PluginMain.cpp:11:
In file included from /home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/clang/StaticAnalyzer/Core/Checker.h:17:
In file included from /home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/clang/Analysis/ProgramPoint.h:18:
In file included from /home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/clang/Analysis/AnalysisContext.h:18:
In file included from /home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/clang/AST/Decl.h:17:
In file included from /home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/clang/AST/APValue.h:17:
In file included from /home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/clang/Basic/LLVM.h:22:
/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/include/llvm/Support/Casting.h:63:29: error: no type named 'enable_if' in namespace 'std'
    To, From, typename std::enable_if<std::is_base_of<To, From>::value>::type> {
              ~~~~~~~~~~~~~~^~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
../Makefile.rules:9: ошибка выполнения рецепта для цели «build/PluginMain.o»
make[1]: *** [build/PluginMain.o] Ошибка 1
make[1]: выход из каталога «/home/yaroslav/infer/src/infer/facebook-clang-plugins/analyzer»
Makefile:24: ошибка выполнения рецепта для цели «all»
make: *** [all] Ошибка 2

from facebook-clang-plugins.

jvillard avatar jvillard commented on July 18, 2024

Could you paste the command you ran and the full output somewhere, please? eg https://bpaste.net/

If you weren't running "./compile-fcp.sh", could you run it and provide its full output as well please?

Thanks!

from facebook-clang-plugins.

proninyaroslav avatar proninyaroslav commented on July 18, 2024

Pay no attention to Russian word in the log, I create package for Archlinux AUR http://pastebin.com/PUZvXbQy

from facebook-clang-plugins.

jvillard avatar jvillard commented on July 18, 2024

Ah! I think I found the problem. Your CFLAGS environment variable is set to -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4. You should do either one of these two things before compiling the plugin:

  1. unset CFLAGS
  2. or, export CFLAGS="$CFLAGS -std=c++11 -fPIC"

from facebook-clang-plugins.

proninyaroslav avatar proninyaroslav commented on July 18, 2024

Method 1)

+ /home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/bin/clang -o /dev/null -x c -Xclang -load -Xclang /home/yaroslav/infer/src/infer/facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib -Xclang -plugin -Xclang BiniouASTExporter -c -
error: unable to find plugin 'BiniouASTExporter'

  • echo '/home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/bin/clang and the facebook-clang-plugins are not working.'
    /home/yaroslav/infer/src/infer/facebook-clang-plugins/clang/bin/clang and the facebook-clang-plugins are not working.
  • echo 'Check you'''re using the right revision of clang, then retry'
    Check you're using the right revision of clang, then retry
  • exit 1

Method 2)

patching file utils/TableGen/ClangAttrEmitter.cpp
Hunk #1 succeeded at 2674 (offset -5 lines).
/tmp/clang-setup.51g2zd ~/infer/src/infer
checking for clang... clang
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.

File config.log not found.

from facebook-clang-plugins.

jvillard avatar jvillard commented on July 18, 2024

Let's go with method 1 then. The plugin wasn't built. Either there was an error above or you have to do git submodule update from the infer repo.

from facebook-clang-plugins.

proninyaroslav avatar proninyaroslav commented on July 18, 2024

Did not help even removing source and a new download - unable to find plugin 'BiniouASTExporter'.

from facebook-clang-plugins.

jvillard avatar jvillard commented on July 18, 2024

A full paste would be helpful again. Can you also paste the steps you are running?

Btw, for both methods, CFLAGS should be modified just for the ./compile-fcp.sh step, not ./facebook-clang-plugins/clang/setup.sh. Also, once ./facebook-clang-plugins/clang/setup.sh succeeds you don't need to do it again.

from facebook-clang-plugins.

jvillard avatar jvillard commented on July 18, 2024

I managed to repro by chance when doing something else. Looking into it now.

from facebook-clang-plugins.

proninyaroslav avatar proninyaroslav commented on July 18, 2024

Did not help:

opam init -y --comp=4.01.0
eval opam config env
opam install -y extlib.1.5.4 atdgen.1.6.0 javalib.2.3.1 sawja.1.5.1

git submodule update --init --recursive
facebook-clang-plugins/clang/setup.sh
unset CFLAGS
./compile-fcp.sh
make -C infer

P.S: Why not return to ready package in github as before?

from facebook-clang-plugins.

jvillard avatar jvillard commented on July 18, 2024

There is currently an issue in infer: the version of the facebook-clang-plugins submodule has not been properly updated by our sync script, which is why you get this error. While we fix it, you can try replacing

git submodule update --init --recursive

with

git submodule update --init --recursive
cd facebook-clang-plugins
git checkout 1bd0b7fbd2bd940418936be480efc26c6356cc3c

to check out the right version of the plugin manually. Stay tuned for a proper fix and thanks for reporting this issue!

Re: your PS: We encountered an issue with the dependencies which prevents us from doing binary releases at the moment.

from facebook-clang-plugins.

proninyaroslav avatar proninyaroslav commented on July 18, 2024

Thank you very much, after all these manipulations worked.

if needed, that's the beginning of outhput:
Submodule on way «facebook-clang-plugins»: withdrawn condition
«20c83cdcc59b6e7b96c144b4eadea60790792ecd»
Previous position HEAD it was 20c83cd... [libtooling] add comment tuple size info
HEAD now 1bd0b7f... [libtooling][biniou] fix integers too large for ocaml

from facebook-clang-plugins.

proninyaroslav avatar proninyaroslav commented on July 18, 2024

Hello. Again faced with problem compiling infer.

python ../libtooling/atdlib/extract_atd_from_cpp.py ../libtooling/build/ASTExporter.h.p | python ../libtooling/atdlib/normalize_names_in_atd.py > build/ast_inline.atd.p
clang -cc1 -E -traditional-cpp -w -P -main-file-name - -o - build/ast_inline.atd.p > build/ast_inline.atd
atdcat -i build/ast_inline.atd > build/clang_ast.atd
atdgen -t -o build/clang_ast build/clang_ast.atd
atdgen -j -o build/clang_ast build/clang_ast.atd
atdgen -v -o build/clang_ast build/clang_ast.atd
ocamldep -I build utils_test.ml clang_ast_main_test.ml clang_ast_yojson_validator.ml clang_ast_visit.ml yojson_utils.ml process.ml clang_ast_converter.ml clang_ast_named_decl_printer.ml process_test.ml clang_ast_proj_test.ml utils.ml yojson_utils_test.ml clang_ast_main.ml utils.mli yojson_utils.mli process.mli build/clang_ast_t.mli build/clang_ast_t.ml build/clang_ast_j.mli build/clang_ast_j.ml build/clang_ast_v.mli build/clang_ast_v.ml | sed -e 's/([a-zA-Z0-9_].cm.)/build/\1/g' | sed -e 's/build/build//build//g' > .depend
/home/yaroslav/.opam/4.01.0/bin/ocamlrun: error while loading shared libraries: libncursesw.so.5: cannot open shared object file: No such file or directory
ocamlfind ocamlopt -package unix,atdgen,camlzip -I build -o build/clang_ast_t.cmx -c build/clang_ast_t.ml
File "build/clang_ast_t.ml", line 1:
Error: Could not find the .cmi file for interface build/clang_ast_t.mli.
Makefile:48: error make «build/clang_ast_t.cmx»
make: *
* [build/clang_ast_t.cmx] Error 2

from facebook-clang-plugins.

jvillard avatar jvillard commented on July 18, 2024

@proninyaroslav can you tell me which version of infer you are trying to compile?

This error in your logs seems to indicate that your ocaml toolchain is currently broken:

/home/yaroslav/.opam/4.01.0/bin/ocamlrun: error while loading shared libraries: libncursesw.so.5: cannot open shared object file: No such file or directory

Try installing the missing library from your distribution.

from facebook-clang-plugins.

proninyaroslav avatar proninyaroslav commented on July 18, 2024

Yes, in my distribution (Arch Linux) ncurses library is version 6.0 and 5.0 is required for assembly. I can roll back the version of the library, but you plan to transfer the plugin to libncursesw.so.6?

from facebook-clang-plugins.

jvillard avatar jvillard commented on July 18, 2024

@proninyaroslav I think the only think that requires libncurses-5 is the ocaml toolchain installed by opam. You may want to try and reinstall it to compile against your new version of libncurses.

from facebook-clang-plugins.

proninyaroslav avatar proninyaroslav commented on July 18, 2024

The latest release opam is dated May 5th.

from facebook-clang-plugins.

jvillard avatar jvillard commented on July 18, 2024

Have you tried reinstalling ocaml from opam? I don't know if it works with this version of libncurses but it's worth a try:

rm -rf $(opam config var root)
opam init --comp=4.01.0
opam install -y \
  atdgen.1.6.0 \
  extlib.1.5.4 \
  javalib.2.3.1 \
  sawja.1.5.1

from facebook-clang-plugins.

jvillard avatar jvillard commented on July 18, 2024

closing optimistically. Please re-open if there's still a problem.

from facebook-clang-plugins.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.