Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Install from Code #335

Closed
Happylinzy opened this issue Aug 27, 2023 · 5 comments
Closed

How to Install from Code #335

Happylinzy opened this issue Aug 27, 2023 · 5 comments
Labels
bug Something isn't working good first issue Good for newcomers Priority:Critical Priority Label for Critical Issue

Comments

@Happylinzy
Copy link

Describe the bug
I tried to follow the guide saying sudo make install but it shows that
""make: *** No targets specified and no makefile found. Stop.""

To Reproduce
I run the following instructions. Did I miss something?

git clone git@github.com:ZigRazor/CXXGraph.git
cd CXXGraph
git clone https://github.com/google/googletest.git
cd googletest # Main directory of the cloned repository.
mkdir -p build # Create a directory to hold the build output.
cd build
cmake .. # Generate native build scripts for GoogleTest.
make # Compile
sudo make install # Install in /usr/local/ by default
cd ../..
mkdir -p build
cd build
cmake ..
make
sudo make install

Afther I type make in CXXGraph/build, there is no output. Then when I run sudo make install. It says no targets.

Expected behavior
Find a test_exe in this build directory to run unit test

Screenshots
(base) yinix@yinixplus:~/CXXGraph/build$ cmake ..
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Downloading CPM.cmake to /home/yinix/CXXGraph/build/cmake/CPM.cmake
-- Configuring done
-- Generating done
-- Build files have been written to: /home/yinix/CXXGraph/build

Desktop (please complete the following information):

  • OS: WSL2 in Windows
    cmake version 3.22.1
    gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
@ZigRazor ZigRazor added bug Something isn't working good first issue Good for newcomers labels Aug 28, 2023
@Happylinzy
Copy link
Author

Happylinzy commented Aug 30, 2023

I tried the following instructions on running benchmark and it seems to work.

  1. Follow benchmark instructions to download googletest in benchmark folder.
  2. Build the benchmark. Though when I tried the final step "sudo cmake --build "build" --config Release --target install", it says no target is found.
  3. Compile the benchmark following instruction.

This time the CPM detects the benchmark and google test.

Part of the output:

(base) yinix@yinixplus:~/CXXGraph/build$ cmake -DBENCHMARK=ON .. 
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Downloading CPM.cmake to /home/yinix/CXXGraph/build/cmake/CPM.cmake
-- CPM: Adding package googletest@ (origin/main)
-- Found Python3: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter 
-- CPM: Adding package googlebenchmark@ (origin/main)
-- Failed to find LLVM FileCheck
-- Found Git: /usr/bin/git (found version "2.34.1") 
-- git version: v1.8.2-35-gdb3e000c normalized to 1.8.2.35
-- Google Benchmark version: 1.8.2.35
-- Looking for shm_open in rt
-- Looking for shm_open in rt - found
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL - Success
-- Performing Test HAVE_CXX_FLAG_WOLD_STYLE_CAST
-- Performing Test HAVE_CXX_FLAG_WOLD_STYLE_CAST - Success
-- Performing Test HAVE_CXX_FLAG_WERROR
-- Performing Test HAVE_CXX_FLAG_WERROR - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC
-- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Failed
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED - Success
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Failed
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
-- Compiling and running to test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX -- success
-- Compiling and running to test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Compiling and running to test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- success
-- Compiling and running to test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Compiling and running to test HAVE_PTHREAD_AFFINITY
-- Performing Test HAVE_PTHREAD_AFFINITY -- success
-- Performing Test BENCHMARK_HAS_O3_FLAG
-- Performing Test BENCHMARK_HAS_O3_FLAG - Success
-- Performing Test BENCHMARK_HAS_DEPRECATED_DECLARATIONS_FLAG
-- Performing Test BENCHMARK_HAS_DEPRECATED_DECLARATIONS_FLAG - Success
-- Performing Test BENCHMARK_HAS_WNO_ODR
-- Performing Test BENCHMARK_HAS_WNO_ODR - Success
-- Performing Test BENCHMARK_HAS_WNO_LTO_TYPE_MISMATCH
-- Performing Test BENCHMARK_HAS_WNO_LTO_TYPE_MISMATCH - Success
-- CPM: Adding package zlib@1.2.13 (v1.2.13)
CMake Deprecation Warning at build/_deps/zlib-src/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Warning (dev) at build/_deps/zlib-src/CMakeLists.txt:4 (project):
  Policy CMP0048 is not set: project() command manages VERSION variables.
  Run "cmake --help-policy CMP0048" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The following variable(s) would be set to empty:

    PROJECT_VERSION
    PROJECT_VERSION_MAJOR
    PROJECT_VERSION_MINOR
    PROJECT_VERSION_PATCH
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Renaming
--     /home/yinix/CXXGraph/build/_deps/zlib-src/zconf.h
-- to 'zconf.h.included' because this file is included with zlib
-- but CMake generates it automatically in the build directory.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/yinix/CXXGraph/build

Next when I tried make, I find error as

/home/yinix/CXXGraph/build/_deps/zlib-src/test/example.c:8:10: fatal error: zlib.h: No such file or directory
    8 | #include "zlib.h"
      |          ^~~~~~~~
compilation terminated.
make[2]: *** [_deps/zlib-build/CMakeFiles/example.dir/build.make:76: _deps/zlib-build/CMakeFiles/example.dir/test/example.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1703: _deps/zlib-build/CMakeFiles/example.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

This is due to a missing package of ruby and zlib1g-dev in ubuntu. Then I install the library using

sudo apt-get install ruby zlib1g-dev

After this, I tried make again and it succeeds.

Then when one tries to build from source, it is better to directly build the benchmark.

The benchmark_exe shows in CXXGraph/build/benchmark/

@Happylinzy
Copy link
Author

However, the test_exe is still missing.

@nrkramer
Copy link
Collaborator

nrkramer commented Sep 4, 2023

@Happylinzy

However, the test_exe is still missing.

Use cmake -DTEST=ON ..

@kamari-a We should document this somewhere.

@AryanGitHub
Copy link
Contributor

can you please share the step-by-step procedure on how to build this project and install it from the source?
I tried

git clone git@github.com:ZigRazor/CXXGraph.git
cd CXXGraph/
mkdir build
cd build/
cmake ..
cmake --build .
sudo make install

CLI returned:
make: *** No rule to make target 'install'. Stop.
Also usr/include/ does not not have the header files.

AryanGitHub added a commit to AryanGitHub/CXXGraph that referenced this issue Sep 19, 2023
 used std::move() in Node<T> move constructor
@ZigRazor ZigRazor added the Priority:Critical Priority Label for Critical Issue label Sep 25, 2023
@AryanGitHub
Copy link
Contributor

AryanGitHub commented Sep 25, 2023

i am doing a fix for this, but then i have to move $(project_dir)/include folder to $(project_dir)/include/$(project_name).
It's kind inspired by https://github.com/google/googletest/tree/main/googletest/include. They dont have hpp files just after the include folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers Priority:Critical Priority Label for Critical Issue
Projects
None yet
Development

No branches or pull requests

4 participants