slycelote / caide-cpp-inliner

Transform a C++ program consisting of multiple source files and headers into a single self-contained source file without any external dependencies (except for standard system headers). Unused code is not included in the resulting file.
Other
32 stars 12 forks source link

Build issue #15

Closed WorldControl closed 5 years ago

WorldControl commented 5 years ago

Recently,I try to build this project,and I encountered a problem,and I don't know how to solve it.here is the problem: [ 70%] Building CXX object CMakeFiles/caideInliner.dir/util.cpp.o [ 76%] Linking CXX static library libcaideInliner.a [ 76%] Built target caideInliner Scanning dependencies of target cmd [ 82%] Building CXX object cmd/CMakeFiles/cmd.dir/cmd.cpp.o [ 88%] Linking CXX executable cmd ../libcaideInliner.a(inliner.cpp.o):(.rodata._ZTIN5caide8internal10TrackMacroE[_ZTIN5caide8internal10TrackMacroE]+0x10): undefined reference to typeinfo for clang::PPCallbacks' ../libcaideInliner.a(inliner.cpp.o):(.rodata._ZTIN5caide8internal21InlinerFrontendActionE[_ZTIN5caide8internal21InlinerFrontendActionE]+0x10): undefined reference totypeinfo for clang::ASTFrontendAction' ../libcaideInliner.a(inliner.cpp.o):(.rodata._ZTIN5caide8internal28InlinerFrontendActionFactoryE[_ZTIN5caide8internal28InlinerFrontendActionFactoryE]+0x10): undefined reference to typeinfo for clang::tooling::FrontendActionFactory' ../libcaideInliner.a(optimizer.cpp.o):(.rodata._ZTIN5caide8internal17OptimizerConsumerE[_ZTIN5caide8internal17OptimizerConsumerE]+0x10): undefined reference totypeinfo for clang::ASTConsumer' ../libcaideInliner.a(optimizer.cpp.o):(.rodata._ZTIN5caide8internal23OptimizerFrontendActionE[_ZTIN5caide8internal23OptimizerFrontendActionE]+0x10): undefined reference to typeinfo for clang::ASTFrontendAction' ../libcaideInliner.a(optimizer.cpp.o):(.rodata._ZTIN5caide8internal30OptimizerFrontendActionFactoryE[_ZTIN5caide8internal30OptimizerFrontendActionFactoryE]+0x10): undefined reference totypeinfo for clang::tooling::FrontendActionFactory' ../libcaideInliner.a(RemoveInactivePreprocessorBlocks.cpp.o):(.rodata._ZTIN5caide8internal32RemoveInactivePreprocessorBlocksE[_ZTIN5caide8internal32RemoveInactivePreprocessorBlocksE]+0x10): undefined reference to `typeinfo for clang::PPCallbacks' collect2: error: ld returned 1 exit status cmd/CMakeFiles/cmd.dir/build.make:116: recipe for target 'cmd/cmd' failed make[2]: [cmd/cmd] Error 1 CMakeFiles/Makefile2:154: recipe for target 'cmd/CMakeFiles/cmd.dir/all' failed make[1]: [cmd/CMakeFiles/cmd.dir/all] Error 2 Makefile:94: recipe for target 'all' failed make: *** [all] Error 2

slycelote commented 5 years ago
  1. What OS/distribution are you using?
  2. Could you provide full command lines (both cmake and make) that you're running?
WorldControl commented 5 years ago
1. What OS/distribution are you using?

2. Could you provide full command lines (both cmake and make) that you're running?

I build this on Ubuntu.and I have already built clang 6.0 and llvm on my computer. I downloaded this project from github,and I enter the folder 'caide-cpp-inliner-master',under this folder i created an folder named 'build'.under the folder 'build',I ran the command line cmake -G "Unix Makefiles" DCMAKE_BUILD_TYPE=Release -DCAIDE_USE_SYSTEM_CLANG=ON,after this I ran make,then it turned out the problem as I issued before.please give some advice,thank you

WorldControl commented 5 years ago
1. What OS/distribution are you using?

2. Could you provide full command lines (both cmake and make) that you're running?

I build this on Ubuntu.and I have already built clang 6.0 and llvm on my computer. I downloaded this project from github,and I enter the folder 'caide-cpp-inliner-master',under this folder i created an folder named 'build'.under the folder 'build',I ran the command line cmake -G "Unix Makefiles" DCMAKE_BUILD_TYPE=Release -DCAIDE_USE_SYSTEM_CLANG=ON,after this I ran make,then it turned out the problem as I issued before.please give some advice,thank you

sorry,the full command lines i used is cmake -G "Unix Makefiles" DCMAKE_BUILD_TYPE=Release -DCAIDE_USE_SYSTEM_CLANG=ON ../src

slycelote commented 5 years ago

The most reliable way is to remove the flag -DCAIDE_USE_SYSTEM_CLANG=ON. This way clang and llvm will be built from this repo (make sure to run git submodule update --init before).

If this doesn't suit you, we can continue investigating like this:

  1. Upload the entire build log (cmake and make) to https://paste.debian.net/
  2. Which Ubuntu version do you use?
  3. Did you build llvm and clang by yourself instead of using the system packages?
WorldControl commented 5 years ago

The most reliable way is to remove the flag -DCAIDE_USE_SYSTEM_CLANG=ON. This way clang and llvm will be built from this repo (make sure to run git submodule update --init before).

If this doesn't suit you, we can continue investigating like this:

1. Upload the entire build log (cmake and make) to https://paste.debian.net/

2. Which Ubuntu version do you use?

3. Did you build llvm and clang by yourself instead of using the system packages?

sorry,I am not very clear with your answers.I use Ubuntu 16.04.the packages I downloaded do not contain llvm and clang system packages.so I built clang by myself.after removing -DCAIDE_USE_SYSTEM_CLANG=ON,how can I build this project? can you tell me the complete build steps? I really interested in your project.thank you very much

slycelote commented 5 years ago

From the root of this repo, run:

git submodule update --init
mkdir build
cd build
cmake -G "Unix Makefiles" DCMAKE_BUILD_TYPE=Release ../src
make
Spotlightsrule commented 2 years ago

From the root of this repo, run:

git submodule update --init
mkdir build
cd build
cmake -G "Unix Makefiles" DCMAKE_BUILD_TYPE=Release ../src
make

Please add this clarification to the README to help people trying to build this tool. Faced the same issue when trying to build on my system. Much appreciated.