Thanks for confirming.
You should be able to remove git and add the following / similar in
src/CMakeLists.txt:
find_package(Git)
(just below find_package(Sanitizers) or FindPkgConfig)
and then change those test expressions to be like:
IF( EXISTS ${CMAKE_SOURCE_DIR}/../.git/HEAD AND GIT_FOUND )
so something like (but I'd rather you test this with a "machine" you
definitely don't have git installed on):
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d73c2557d..fe702ebca 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -125,6 +125,7 @@ EXECUTE_PROCESS( COMMAND hostname
find_package(Toolchain REQUIRED)
find_package(Sanitizers)
+find_package(Git)
# Add maintainer mode for (mainly) strict builds
include(${CMAKE_SOURCE_DIR}/cmake/maintainer_mode.cmake)
@@ -132,11 +133,12 @@
include(${CMAKE_SOURCE_DIR}/cmake/maintainer_mode.cmake)
# For libraries that provide pkg-config files
include(FindPkgConfig)
+
# For our option system
include(${CMAKE_SOURCE_DIR}/cmake/goption.cmake)
# If we are in a git tree, then this CMakeLists.txt is in "src/" and go
.git is in "src/.."
-IF( EXISTS ${CMAKE_SOURCE_DIR}/../.git/HEAD )
+IF( EXISTS ${CMAKE_SOURCE_DIR}/../.git/HEAD AND GIT_FOUND)
message( STATUS "Compilation from within a git repository. Using git
rev-parse HEAD")
EXECUTE_PROCESS( COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
@@ -149,7 +151,7 @@ IF( EXISTS ${CMAKE_SOURCE_DIR}/../.git/HEAD )
ERROR_QUIET
OUTPUT_VARIABLE _GIT_DESCRIBE)
-ELSE( EXISTS ${CMAKE_SOURCE_DIR}/../.git/HEAD )
+ELSE( EXISTS ${CMAKE_SOURCE_DIR}/../.git/HEAD AND GIT_FOUND )
message( STATUS "Outside a git repository, use saved data" )
EXEC_PROGRAM(${CMAKE_SOURCE_DIR}/cmake/githead_from_path.sh ARGS
${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE _GIT_HEAD_COMMIT)
@@ -157,7 +159,7 @@ ELSE( EXISTS ${CMAKE_SOURCE_DIR}/../.git/HEAD )
EXEC_PROGRAM(${CMAKE_SOURCE_DIR}/cmake/gitdesc_from_path.sh ARGS
${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE _GIT_DESCRIBE)
-ENDIF( EXISTS ${CMAKE_SOURCE_DIR}/../.git/HEAD )
+ENDIF( EXISTS ${CMAKE_SOURCE_DIR}/../.git/HEAD AND GIT_FOUND )
STRING(SUBSTRING ${_GIT_HEAD_COMMIT} 0 7 _GIT_HEAD_COMMIT_ABBREV )
On Fri, Jan 8, 2021 at 4:08 PM Becker, Jeffrey C. (ARC-TN)[InuTeq, LLC] <
jeffrey.c.becker(a)nasa.gov> wrote:
Yes – I checked out v3.4 from git and added our local patch. Thanks
-Jeff
*From: *Solomon Boulos <boulos(a)google.com>
*Date: *Friday, January 8, 2021 at 4:04 PM
*To: *Frank Filz <ffilzlnx(a)mindspring.com>
*Cc: *"Becker, Jeffrey C. (ARC-TN)[InuTeq, LLC]" <
jeffrey.c.becker(a)nasa.gov>, Ganesha-devel <devel(a)lists.nfs-ganesha.org>
*Subject: *Re: [NFS-Ganesha-Devel] Re: [EXTERNAL] RE: Pthread CMake error
It seems like it already tries to do that a bit:
# If we are in a git tree, then this CMakeLists.txt is in "src/" and go
.git is in "src/.."
IF( EXISTS ${CMAKE_SOURCE_DIR}/../.git/HEAD )
message( STATUS "Compilation from within a git repository. Using git
rev-parse HEAD")
EXECUTE_PROCESS( COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
OUTPUT_VARIABLE _GIT_HEAD_COMMIT)
EXECUTE_PROCESS( COMMAND git describe --long
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
OUTPUT_VARIABLE _GIT_DESCRIBE)
ELSE( EXISTS ${CMAKE_SOURCE_DIR}/../.git/HEAD )
message( STATUS "Outside a git repository, use saved data" )
EXEC_PROGRAM(${CMAKE_SOURCE_DIR}/cmake/githead_from_path.sh ARGS
${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE _GIT_HEAD_COMMIT)
EXEC_PROGRAM(${CMAKE_SOURCE_DIR}/cmake/gitdesc_from_path.sh ARGS
${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE _GIT_DESCRIBE)
ENDIF( EXISTS ${CMAKE_SOURCE_DIR}/../.git/HEAD )
--
Jeff, did you check this out with git and then try to build inside a
container? (Likely)
On Fri, Jan 8, 2021 at 4:00 PM Frank Filz <ffilzlnx(a)mindspring.com> wrote:
Oh, good. We should track down the dependency on git because people should
be able to build from a source tar without git.
For that though, I’ll have to leave it to our cmake experts.
At this point, would you mind opening a github issue?
Frank
*From:* Becker, Jeffrey C. (ARC-TN)[InuTeq, LLC] via Devel [mailto:
devel(a)lists.nfs-ganesha.org]
*Sent:* Friday, January 8, 2021 3:43 PM
*To:* Frank Filz <ffilzlnx(a)mindspring.com>
*Cc:* 'Ganesha-devel' <devel(a)lists.nfs-ganesha.org>
*Subject:* [NFS-Ganesha-Devel] Re: [EXTERNAL] RE: Pthread CMake error
Found the problem. My system was missing git, and for some reason this was
causing cmake to hit the error:
CMake Error at CMakeLists.txt:162 (STRING):
STRING sub-command SUBSTRING requires four arguments.
Installing git fixed it. Note that I’m doing the build in a container, and
I don’t really need to have git in there, but I don’t mind.
-Jeff
*From: *"Becker, Jeffrey C. (ARC-TN)[InuTeq, LLC] via Devel" <
devel(a)lists.nfs-ganesha.org>
*Reply-To: *"Becker, Jeffrey C. (ARC-TN)[InuTeq, LLC]" <
jeffrey.c.becker(a)nasa.gov>
*Date: *Friday, January 8, 2021 at 2:57 PM
*To: *Frank Filz <ffilzlnx(a)mindspring.com>
*Cc: *'Ganesha-devel' <devel(a)lists.nfs-ganesha.org>
*Subject: *[NFS-Ganesha-Devel] Re: [EXTERNAL] RE: Pthread CMake error
On a different system, I was able to get cmake to configure Ganesha, with
cmake version 3.5.2. The version on the system on which I get the error is
cmake version 3.17. Has this version been tested with Ganesha – maybe it’s
too new? I realize this isn’t likely, but as I haven’t been able to find
the source of my cmake error yet, I thought I should rule it out. Thanks.
-Jeff
*From: *Frank Filz <ffilzlnx(a)mindspring.com>
*Date: *Friday, January 8, 2021 at 12:52 PM
*To: *"Becker, Jeffrey C. (ARC-TN)[InuTeq, LLC]" <
jeffrey.c.becker(a)nasa.gov>
*Cc: *'Ganesha-devel' <devel(a)lists.nfs-ganesha.org>
*Subject: *RE: [NFS-Ganesha-Devel] Re: [EXTERNAL] RE: Pthread CMake error
That’s what I see in my cmake, so you should be ok for pthreads, something
else is causing cmake to fail.
Frank
*From:* Becker, Jeffrey C. (ARC-TN)[InuTeq, LLC] [
mailto:jeffrey.c.becker@nasa.gov <jeffrey.c.becker(a)nasa.gov>]
*Sent:* Friday, January 8, 2021 12:34 PM
*To:* Frank Filz <ffilzlnx(a)mindspring.com>
*Cc:* 'Ganesha-devel' <devel(a)lists.nfs-ganesha.org>
*Subject:* Re: [NFS-Ganesha-Devel] Re: [EXTERNAL] RE: Pthread CMake error
Yes:
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
*From: *Frank Filz <ffilzlnx(a)mindspring.com>
*Date: *Friday, January 8, 2021 at 12:03 PM
*To: *"Becker, Jeffrey C. (ARC-TN)[InuTeq, LLC]" <
jeffrey.c.becker(a)nasa.gov>
*Cc: *'Ganesha-devel' <devel(a)lists.nfs-ganesha.org>
*Subject: *RE: [NFS-Ganesha-Devel] Re: [EXTERNAL] RE: Pthread CMake error
Did it eventually say “Found Threads: TRUE” though? If so, look for what
other errors there are. I get the Failed message with my cmake, but also
get the Found Threads: TRUE, and everything works.
Frank
*From:* Becker, Jeffrey C. (ARC-TN)[InuTeq, LLC] via Devel [
mailto:devel@lists.nfs-ganesha.org <devel(a)lists.nfs-ganesha.org>]
*Sent:* Friday, January 8, 2021 11:27 AM
*To:* Frank Filz <ffilzlnx(a)mindspring.com>
*Cc:* 'Ganesha-devel' <devel(a)lists.nfs-ganesha.org>
*Subject:* [NFS-Ganesha-Devel] Re: [EXTERNAL] RE: Pthread CMake error
I’ve added several packages that the CMake output indicated were missing,
and the CMake still fails with the same CMakeError output. The only thing I
can see is:
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
Is that the issue? If so, how to fix? Thanks.
-Jeff
*From: *Frank Filz <ffilzlnx(a)mindspring.com>
*Date: *Thursday, January 7, 2021 at 4:47 PM
*To: *"Becker, Jeffrey C. (ARC-TN)[InuTeq, LLC]" <
jeffrey.c.becker(a)nasa.gov>
*Cc: *'Ganesha-devel' <devel(a)lists.nfs-ganesha.org>
*Subject: *RE: [EXTERNAL] RE: [NFS-Ganesha-Devel] Pthread CMake error
No, there must have been another error. Keep looking through the output
and error logs.
Frank
*From:* Becker, Jeffrey C. (ARC-TN)[InuTeq, LLC] [
mailto:jeffrey.c.becker@nasa.gov <jeffrey.c.becker(a)nasa.gov>]
*Sent:* Thursday, January 7, 2021 3:57 PM
*To:* Frank Filz <ffilzlnx(a)mindspring.com>
*Cc:* 'Ganesha-devel' <devel(a)lists.nfs-ganesha.org>
*Subject:* Re: [EXTERNAL] RE: [NFS-Ganesha-Devel] Pthread CMake error
I think it fails. The end of the output along with the cmake error code is:
-- Configuring incomplete, errors occurred!
See also "/u/jcbecker/ganesha.build/CMakeFiles/CMakeOutput.log".
See also "/u/jcbecker/ganesha.build/CMakeFiles/CMakeError.log".
-bash-4.4# echo $?
1
Did it actually work? Thanks.
-Jeff
*From: *Frank Filz <ffilzlnx(a)mindspring.com>
*Date: *Thursday, January 7, 2021 at 3:50 PM
*To: *"Becker, Jeffrey C. (ARC-TN)[InuTeq, LLC]" <
jeffrey.c.becker(a)nasa.gov>
*Cc: *'Ganesha-devel' <devel(a)lists.nfs-ganesha.org>
*Subject: *[EXTERNAL] RE: [NFS-Ganesha-Devel] Pthread CMake error
Does it actually fail? I see similar errors and everything works find.
Apparently the cmake magic checking for pthread functions looks for both
libpthread and libpthreads. Our respective systems have libpthread which if
you look below IS were it finds pthread_create, so all should be good.
Frank
*From:* Becker, Jeffrey C. (ARC-TN)[InuTeq, LLC] via Devel [
mailto:devel@lists.nfs-ganesha.org <devel(a)lists.nfs-ganesha.org>]
*Sent:* Thursday, January 7, 2021 2:02 PM
*To:* devel(a)lists.nfs-ganesha.org
*Subject:* [NFS-Ganesha-Devel] Pthread CMake error
Hi. I’m trying to build Ganesha 3.4 (latest stable), and CMake output
shows the following:
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
However CMake fails with the following in CMakeError.log. Not sure how to
proceed. Please advise. Thanks.
-Jeff
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the
following output:
Change Dir: /u/jcbecker/ganesha.build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake cmTC_52ec6/fast && /usr/bin/gmake -f
CMakeFiles/cmTC_52ec6.dir/build.make CMakeFiles/cmTC_52ec6.dir/build
gmake[1]: Entering directory
'/u/jcbecker/ganesha.build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_52ec6.dir/src.c.o
/usr/bin/cc -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-fno-strict-aliasing -DCMAKE_HAVE_LIBC_PTHREAD -o
CMakeFiles/cmTC_52ec6.dir/src.c.o -c
/u/jcbecker/ganesha.build/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_52ec6
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_52ec6.dir/link.txt
--verbose=1
/usr/bin/cc -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-fno-strict-aliasing -DCMAKE_HAVE_LIBC_PTHREAD -rdynamic
CMakeFiles/cmTC_52ec6.dir/src.c.o -o cmTC_52ec6
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld:
CMakeFiles/cmTC_52ec6.dir/src.c.o: in function `main':
src.c:(.text+0x2d): undefined reference to `pthread_create'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld:
src.c:(.text+0x39): undefined reference to `pthread_detach'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld:
src.c:(.text+0x45): undefined reference to `pthread_cancel'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld:
src.c:(.text+0x56): undefined reference to `pthread_join'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld:
src.c:(.text+0x6a): undefined reference to `pthread_atfork'
collect2: error: ld returned 1 exit status
gmake[1]: *** [CMakeFiles/cmTC_52ec6.dir/build.make:104: cmTC_52ec6] Error
1
gmake[1]: Leaving directory '/u/jcbecker/ganesha.build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:138: cmTC_52ec6/fast] Error 2
Source file was:
#include <pthread.h>
void* test_func(void* data)
{
return data;
}
int main(void)
{
pthread_t thread;
pthread_create(&thread, NULL, test_func, NULL);
pthread_detach(thread);
pthread_cancel(thread);
pthread_join(thread, NULL);
pthread_atfork(NULL, NULL, NULL);
pthread_exit(NULL);
return 0;
}
Determining if the function pthread_create exists in the pthreads failed
with the following output:
Change Dir: /u/jcbecker/ganesha.build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake cmTC_3a45d/fast && /usr/bin/gmake -f
CMakeFiles/cmTC_3a45d.dir/build.make CMakeFiles/cmTC_3a45d.dir/build
gmake[1]: Entering directory
'/u/jcbecker/ganesha.build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_3a45d.dir/CheckFunctionExists.c.o
/usr/bin/cc -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-fno-strict-aliasing -DCHECK_FUNCTION_EXISTS=pthread_create -o
CMakeFiles/cmTC_3a45d.dir/CheckFunctionExists.c.o -c
/usr/share/cmake/Modules/CheckFunctionExists.c
Linking C executable cmTC_3a45d
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3a45d.dir/link.txt
--verbose=1
/usr/bin/cc -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-fno-strict-aliasing -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic
CMakeFiles/cmTC_3a45d.dir/CheckFunctionExists.c.o -o cmTC_3a45d
-lpthreads
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld:
cannot find -lpthreads
collect2: error: ld returned 1 exit status
gmake[1]: *** [CMakeFiles/cmTC_3a45d.dir/build.make:104: cmTC_3a45d] Error
1
gmake[1]: Leaving directory '/u/jcbecker/ganesha.build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:138: cmTC_3a45d/fast] Error 2
_______________________________________________
Devel mailing list -- devel(a)lists.nfs-ganesha.org
To unsubscribe send an email to devel-leave(a)lists.nfs-ganesha.org