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

[WINDOWS][BUILD] Fix for Cygwin using USE_BINARYBUILDER_LIBGIT2=0 #48793

Merged
merged 1 commit into from
May 22, 2023

Conversation

stahta01
Copy link
Contributor

@stahta01 stahta01 commented Feb 26, 2023

Without change "fatal error: libssh2.h: No such file or directory" happens. It also tends to find the wrong libssh2 library as reported in the cmake cache file.

Tim S.

See also issue #45645

$ gcc --version | grep '(GCC)'
gcc (GCC) 11.3.0

$ x86_64-w64-mingw32-gcc --version | grep '(GCC)'
x86_64-w64-mingw32-gcc (GCC) 11.3.0

$ x86_64-w64-mingw32-g++ --version | grep '(GCC)'
x86_64-w64-mingw32-g++ (GCC) 11.3.0

$ ld --version | grep '(GNU Binutils)'
GNU ld (GNU Binutils) 2.40

$ make --version | grep 'GNU Make'
GNU Make 4.4.0.91

$ uname -srvmo
CYGWIN_NT-10.0-19045 3.4.6-1.x86_64 2023-02-14 13:23 UTC x86_64 Cygwin

Build command

cd "H:\devel\general_projects\repos\julia-master-cygwin" && \
[[ -d "./usr-staging" ]] && rm -rf "./usr-staging" ; \
[[ -d "./usr" ]] && rm -rf "./usr" ; \
echo 'XC_HOST = x86_64-w64-mingw32'   > Make.user && \
echo 'USE_BINARYBUILDER_LIBGIT2 = 0' >> Make.user && \
make clean VERBOSE=1 && \
make debug VERBOSE=1
./usr/bin/julia-debug.exe
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.0-DEV.662 (2023-02-26)
 _/ |\__'_|_|_|\__'_|  |  libgit_find_libssh2_fix/737368e63b* (fork: 1 commits, 0 days)
|__/                   |

cd "H:\devel\general_projects\repos\julia-master-cygwin/test" && \
  env PATH="../usr/bin:$PATH" \
    ../usr/bin/julia-debug --check-bounds=yes --startup-file=no ./runtests.jl \
      LibGit2 \
      2>&1 | tee ../../julia-cygwin-master-LibGit2-check.log && echo -ne '\007'
Running parallel tests with:
  nworkers() = 1
  nthreads() = 1
  Sys.CPU_THREADS = 4
  Sys.total_memory() = 7.902 GiB
  Sys.free_memory() = 3.234 GiB

Test        (Worker) | Time (s) | GC (s) | GC % | Alloc (MB) | RSS (MB)
LibGit2/libgit2  (1) |        started at 2023-02-26T06:48:30.349
LibGit2/libgit2  (1) |    86.86 |   3.01 |  3.5 |     814.26 |   679.14

Test Summary: | Pass  Total     Time
  Overall     |  593    593  1m30.5s
    SUCCESS

@inkydragon
Copy link
Sponsor Member

inkydragon commented Feb 26, 2023

Perhaps this patch is simpler and more consistent:

diff --git a/deps/libgit2.mk b/deps/libgit2.mk
index 30d94aeca7..3d9e265d37 100644
--- a/deps/libgit2.mk
+++ b/deps/libgit2.mk
@@ -26,6 +26,7 @@ LIBGIT2_OPTS += -G"MSYS Makefiles"
 else
 LIBGIT2_OPTS += -DBUILD_CLAR=OFF -DDLLTOOL=`which $(CROSS_COMPILE)dlltool`
 LIBGIT2_OPTS += -DCMAKE_FIND_ROOT_PATH=/usr/$(XC_HOST) -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
+LIBGIT2_OPTS += -Dssh2_RESOLVED=${build_shlibdir}/libssh2.dll
 endif
 endif

ref: https://github.com/JuliaPackaging/Yggdrasil/blob/e7e62e4a11f3fa1ef8b8a55fe9518a36631e5da0/L/LibGit2/build_tarballs.jl#L38-L39

@inkydragon inkydragon added building Build system, or building Julia or its dependencies system:windows Affects only Windows labels Feb 26, 2023
@stahta01
Copy link
Contributor Author

stahta01 commented Feb 26, 2023

Perhaps this patch is simpler and more consistent:

diff --git a/deps/libgit2.mk b/deps/libgit2.mk
index 30d94aeca7..3d9e265d37 100644
--- a/deps/libgit2.mk
+++ b/deps/libgit2.mk
@@ -26,6 +26,7 @@ LIBGIT2_OPTS += -G"MSYS Makefiles"
 else
 LIBGIT2_OPTS += -DBUILD_CLAR=OFF -DDLLTOOL=`which $(CROSS_COMPILE)dlltool`
 LIBGIT2_OPTS += -DCMAKE_FIND_ROOT_PATH=/usr/$(XC_HOST) -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
+LIBGIT2_OPTS += -Dssh2_RESOLVED=${build_shlibdir}/libssh2.dll
 endif
 endif

ref: https://github.com/JuliaPackaging/Yggdrasil/blob/e7e62e4a11f3fa1ef8b8a55fe9518a36631e5da0/L/LibGit2/build_tarballs.jl#L38-L39

I think the CMAKE people would be upset with it; because it likely violates their rules.

Edit: And, it would do nothing to help under MSys2 MINGW64.

Tim S.

@stahta01 stahta01 marked this pull request as ready for review February 26, 2023 14:28
@stahta01 stahta01 force-pushed the libgit_find_libssh2_fix branch 3 times, most recently from 6abd05f to 7e943aa Compare March 12, 2023 11:50
Copy link
Sponsor Member

@inkydragon inkydragon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

This pathc fix:

When building libgit2, sometimes libssh2 is not found

Originally posted by @inkydragon in #45645 (comment)

@stahta01
Copy link
Contributor Author

LGTM.

This pathc fix:

When building libgit2, sometimes libssh2 is not found
Originally posted by @inkydragon in #45645 (comment)

Correct, it fixes the problem of libgit2 failing to find libssh2; it also prevents the finding of the wrong libssh2 under MSys2 MINGW64 and likely fixes that issues under Cygwin. If MSys2 has an system installation of libssh2 it finds it before the Julia built version.

Tim S.

@staticfloat staticfloat merged commit 1c21cbb into JuliaLang:master May 22, 2023
@stahta01 stahta01 deleted the libgit_find_libssh2_fix branch May 22, 2023 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
building Build system, or building Julia or its dependencies system:windows Affects only Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants