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

Can not build outside of a git repo #387

Open
blezek opened this issue Dec 17, 2019 · 4 comments
Open

Can not build outside of a git repo #387

blezek opened this issue Dec 17, 2019 · 4 comments
Labels

Comments

@blezek
Copy link

blezek commented Dec 17, 2019

Trying to build v 1.2.1 inside Docker, but gailed in super build of v1.2.1 when .git directory not copied.

-- Found Git: /usr/bin/git (found version "2.17.1")
-- Found Git: /usr/bin/git
-- Checking if building a release
-- Checking if building a release - no (found 0 tags)
CMake Error at /root/dependencies/dcmqi/CMake/FindGit.cmake:94 (message):
  Command " rev-parse --verify -q --short=7 HEAD" in directory
  /root/dependencies/dcmqi failed with output:

  fatal: not a git repository (or any of the parent directories): .git
@fedorov
Copy link
Member

fedorov commented Dec 17, 2019

Interesting. Is this really critical? Can you just use the binaries for 1.2.1? Or check out that specific tag?

Off the top of my head, I don't know if this is fixable or not, some of those dependencies carry over from Slicer SEM.

If there is one person who knows the answer off the top of his head - it would be @jcfr!

@fedorov fedorov added the bug label Dec 17, 2019
@blezek
Copy link
Author

blezek commented Dec 17, 2019

@fedorov, it's not absolutely critical for our projects, but anyone checking out your source code would not be able to build dcmqi. I may swap to using the pre-built binaries, however, because we deploy to several different platforms it is always better to build from scratch.

@jcfr
Copy link
Contributor

jcfr commented Dec 17, 2019

short answer

To be specific, out of source builds are supported. After checking out sources using git, it is possible to build the project in the directory of your choice.

What is not supported is to build the project downloading the pre-generated source archives associated with Github Release.

long answer

but anyone checking out your source code would not be able to build dcmqi

Checking out the source using git is expected to work, the following test confirms this:

git clone [email protected]:QIICR/dcmqi.git -b v1.2.1
~/Software/cmake-3.15.2-Linux-x86_64/bin/cmake -S dcmqi/ -B dcmqi-build
cmake --build dcmqi-build/ -- -j8
[...]
-- Checking if building a release
-- Checking if building a release - yes (found tags v1.2.1)
-- Configuring DCMQI version [1.2.1]
--   DCMQI_WC_REVISION [1e82977]
--   DCMQI_WC_TAG [v1.2.1]
--   DCMQI_WC_URL [[email protected]:QIICR/dcmqi.git]
[...]
[100%] Completed 'DCMQI'
[100%] Built target DCMQI

In your Dockerfile, I suggest you use ninja (for automatic build parallelization) and do the following:

RUN \
  git clone [email protected]:QIICR/dcmqi.git -b v1.2.1 && \
  cmake -G Ninja \
    -DCMAKE_BUILD_TYPE:STRING=Release \
    -DCMAKE_INSTALL_PREFIX:PATH=/path/to/install \
    -S dcmqi/ \
    -B dcmqi-build \
  && \
  cmake --build dcmqi-build/ && \
  cmake --build dcmqi-build/dcmqi-build --target install && \
  rm -rf dcmqi dcmqi-build

What does not work is building using the pre-generated source archive associated with GitHub release.

proposed solution

Update CMake/dcmqiVersion.cmake to do the following:

  • assume a source tree without any .git folder is associated with a release
  • add support for setting DCMQI_VERSION_QUALIFIER, this would allow to explicitly override the previous assumption

@fedorov
Copy link
Member

fedorov commented Dec 18, 2019

Thank you for chiming in @jcfr!

but anyone checking out your source code would not be able to build dcmqi

@blezek my point is that you can currently build from a github checkout, and you have binaries for all platforms. So far no one raised a concern about not being able to build from a source package. Is it really critical to be able to build from those source packages?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants