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

[vcpkg_configure_make] Misc fixes #31228

Merged
merged 58 commits into from
Jan 23, 2024

Conversation

dg0yt
Copy link
Contributor

@dg0yt dg0yt commented May 3, 2023

Changes numbered C<n> for further reference. Don't renumber.

C1: Includes #30381: Fix processing of CMAKE_<LANG>_STANDARD_LIBRARIES.

C2: Fixes #14389 SKIP_CONFIGURE option.

C3: Redirects man and doc dirs for the debug build.
- Establishes consistency between release and debug.
- Simplifying post-build cleanup for debug.
- Behavioral change may affect ports by debug/share now appearing. Fixed for liburing.
(Too disruptive, may break user ports.)

C4: Fixes passing of linker options for windows, #31228 (comment).

C5: Generally moves "ABI flags" from CFLAGS/CXXFLAGS to CC/CXX.

C6: Improves warnings about unsupported whitespace. There are three different cases:

  • vcpkg dirs (packages, install)
  • tools
  • flags

C7: Updates CCAS setup for gmp and nettle.

C8: On this occasion, adds a VSCLANG tool to vcpkg_find_acquire_program to improve behaviour when VS's clang isn't found. (No pointless LLVM download, no lengthy extraction, but clear messages. There were some issues were users struggled with that.) This addition is feasible/cheap since #30780.

C9: Fixes #32282, use GNU make on FreeBSD (credits: @SchaichAlonso)

C10: Fixes #30479, problems with special chars in paths due to use in regex.

...

@dg0yt dg0yt changed the title [vcpkg_configure_makeup] Misc fixes [vcpkg_configure_make] Misc fixes May 3, 2023
@Neumann-A
Copy link
Contributor

if (CMAKE_HOST_WIN32 AND VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES [[cl\.exe$]])
if(NOT vcm_paths_with_spaces)
string(APPEND LDFLAGS_${var_suffix} " -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib/manual-link")
endif()

Also needs fixing. -L flags only work if cl is used through USE_WRAPPERS

@dg0yt
Copy link
Contributor Author

dg0yt commented May 3, 2023

Also needs fixing. -L flags only work if cl is used through USE_WRAPPERS

What kind of fix do you expect?
The wrapper stopped caring about -L since this flag became prefixed with -Xlinker. That's what I see freqently in CI error logs. And this is from passing -Xlinker -Xlinker -Xlinker to libtool.

e.g.

/usr/bin/bash ../libtool  --tag=CC   --mode=link compile cl.exe  -Xcompiler -nologo -Xcompiler -W3 -Xcompiler -utf-8 -Xcompiler -MP -Xcompiler -MD -Xcompiler -O2 -Xcompiler -Oi -Xcompiler -Gy -Xcompiler -Z7  -no-undefined  -lws2_32    -lws2_32          -no-undefined -export-symbols libtextstyle.sym -version-info 1:2:1 -rpath /D/installed/x64-windows/lib -Xlinker -Xlinker -Xlinker -LD:/installed/x64-windows/lib -Xlinker -Xlinker -Xlinker -machine:x64 -Xlinker -Xlinker -Xlinker -nologo -Xlinker -Xlinker -Xlinker -DEBUG -Xlinker -Xlinker -Xlinker -INCREMENTAL:NO -Xlinker -Xlinker -Xlinker -OPT:REF -Xlinker -Xlinker -Xlinker -OPT:ICF -o libtextstyle.la -rpath /D/installed/x64-windows/lib gl_array_list.lo basename-lgpl.lo binary-io.lo c-ctype.lo c-strcasecmp.lo c-strncasecmp.lo cloexec.lo concat-filename.lo exitfail.lo fatal-signal.lo fd-hook.lo fd-ostream.lo file-ostream.lo full-write.lo get_ppid_of.lo get_progname_of.lo getprogname.lo html-ostream.lo html-styled-ostream.lo ialloc.lo iconv-ostream.lo gl_list.lo glthread/lock.lo malloca.lo math.lo mem-hash-map.lo memory-ostream.lo noop-styled-ostream.lo ostream.lo printf-frexp.lo printf-frexpl.lo safe-read.lo safe-write.lo sig-handler.lo sockets.lo stat-time.lo styled-ostream.lo sys_socket.lo term-ostream.lo term-style-control.lo term-styled-ostream.lo glthread/threadlib.lo unistd.lo unistr/u8-mbtouc.lo unistr/u8-mbtouc-aux.lo xmalloc.lo xalloc-die.lo xconcat-filename.lo xgethostname.lo gl_xlist.lo xsize.lo xvasprintf.lo xasprintf.lo color.lo misc.lo version.lo asnprintf.lo asprintf.lo calloc.lo close.lo dup2.lo error.lo fcntl.lo free.lo fstat.lo fsync.lo getdtablesize.lo gethostname.lo gettimeofday.lo isatty.lo isinf.lo isnand.lo isnanf.lo isnanl.lo malloc.lo msvc-inval.lo msvc-nothrow.lo obstack.lo open.lo printf-args.lo printf-parse.lo raise.lo read.lo realloc.lo reallocarray.lo sigaction.lo sigprocmask.lo snprintf.lo stat.lo stat-w32.lo stpcpy.lo strerror.lo strerror-override.lo tparm.lo tputs.lo vasnprintf.lo vasprintf.lo vsnprintf.lo windows-mutex.lo windows-once.lo windows-recmutex.lo windows-rwlock.lo write.lo libcroco_rpl.la libglib_rpl.la libxml_rpl.la libtextstyle.res.lo -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -lcomdlg32 -ladvapi32
...
libtool: link:  compile cl.exe -o .libs\\textstyle-0.dll  .libs/gl_array_list.obj .libs/basename-lgpl.obj .libs/binary-io.obj .libs/c-ctype.obj .libs/c-strcasecmp.obj .libs/c-strncasecmp.obj .libs/cloexec.obj .libs/concat-filename.obj .libs/exitfail.obj .libs/fatal-signal.obj .libs/fd-hook.obj .libs/fd-ostream.obj .libs/file-ostream.obj .libs/full-write.obj .libs/get_ppid_of.obj .libs/get_progname_of.obj .libs/getprogname.obj .libs/html-ostream.obj .libs/html-styled-ostream.obj .libs/ialloc.obj .libs/iconv-ostream.obj .libs/gl_list.obj glthread/.libs/lock.obj .libs/malloca.obj .libs/math.obj .libs/mem-hash-map.obj .libs/memory-ostream.obj .libs/noop-styled-ostream.obj .libs/ostream.obj .libs/printf-frexp.obj .libs/printf-frexpl.obj .libs/safe-read.obj .libs/safe-write.obj .libs/sig-handler.obj .libs/sockets.obj .libs/stat-time.obj .libs/styled-ostream.obj .libs/sys_socket.obj .libs/term-ostream.obj .libs/term-style-control.obj .libs/term-styled-ostream.obj glthread/.libs/threadlib.obj .libs/unistd.obj unistr/.libs/u8-mbtouc.obj unistr/.libs/u8-mbtouc-aux.obj .libs/xmalloc.obj .libs/xalloc-die.obj .libs/xconcat-filename.obj .libs/xgethostname.obj .libs/gl_xlist.obj .libs/xsize.obj .libs/xvasprintf.obj .libs/xasprintf.obj .libs/color.obj .libs/misc.obj .libs/version.obj .libs/asnprintf.obj .libs/asprintf.obj .libs/calloc.obj .libs/close.obj .libs/dup2.obj .libs/error.obj .libs/fcntl.obj .libs/free.obj .libs/fstat.obj .libs/fsync.obj .libs/getdtablesize.obj .libs/gethostname.obj .libs/gettimeofday.obj .libs/isatty.obj .libs/isinf.obj .libs/isnand.obj .libs/isnanf.obj .libs/isnanl.obj .libs/malloc.obj .libs/msvc-inval.obj .libs/msvc-nothrow.obj .libs/obstack.obj .libs/open.obj .libs/printf-args.obj .libs/printf-parse.obj .libs/raise.obj .libs/read.obj .libs/realloc.obj .libs/reallocarray.obj .libs/sigaction.obj .libs/sigprocmask.obj .libs/snprintf.obj .libs/stat.obj .libs/stat-w32.obj .libs/stpcpy.obj .libs/strerror.obj .libs/strerror-override.obj .libs/tparm.obj .libs/tputs.obj .libs/vasnprintf.obj .libs/vasprintf.obj .libs/vsnprintf.obj .libs/windows-mutex.obj .libs/windows-once.obj .libs/windows-recmutex.obj .libs/windows-rwlock.obj .libs/write.obj .libs/libtextstyle.res.obj   .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-additional-sel.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-attr-sel.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-cascade.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-declaration.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-doc-handler.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-enc-handler.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-fonts.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-input.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-num.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-om-parser.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-parser.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-parsing-location.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-prop-list.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-pseudo.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-rgb.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-sel-eng.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-selector.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-simple-sel.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-statement.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-string.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-style.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-stylesheet.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-term.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-tknzr.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-token.obj .libs/libtextstyle.lax/croco_rpl.lib/rpl_la-cr-utils.obj  .libs/libtextstyle.lax/glib_rpl.lib/libglib_rpl_la-ghash.obj .libs/libtextstyle.lax/glib_rpl.lib/libglib_rpl_la-glist.obj .libs/libtextstyle.lax/glib_rpl.lib/libglib_rpl_la-gmessages.obj .libs/libtextstyle.lax/glib_rpl.lib/libglib_rpl_la-gprimes.obj .libs/libtextstyle.lax/glib_rpl.lib/libglib_rpl_la-gstrfuncs.obj .libs/libtextstyle.lax/glib_rpl.lib/libglib_rpl_la-gstring.obj  .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-DOCBparser.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-HTMLparser.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-HTMLtree.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-SAX.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-SAX2.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-buf.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-c14n.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-catalog.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-chvalid.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-debugXML.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-dict.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-encoding.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-entities.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-error.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-globals.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-hash.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-legacy.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-list.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-nanoftp.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-nanohttp.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-parser.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-parserInternals.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-pattern.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-relaxng.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-schematron.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-threads.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-tree.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-trionan.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-uri.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-valid.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-xinclude.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-xlink.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-xmlIO.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-xmlmemory.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-xmlmodule.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-xmlreader.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-xmlregexp.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-xmlsave.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-xmlschemas.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-xmlschemastypes.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-xmlstring.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-xmlunicode.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-xmlwriter.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-xpath.obj .libs/libtextstyle.lax/xml_rpl.lib/rpl_la-xpointer.obj   -nologo -W3 -utf-8 -MP -MD -O2 -Oi -Gy -Z7 -Xlinker -LD:/installed/x64-windows/lib -Xlinker -machine:x64 -Xlinker -nologo -Xlinker -DEBUG -Xlinker -INCREMENTAL:NO -Xlinker -OPT:REF -Xlinker -OPT:ICF    -lws2_32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -lcomdlg32 -ladvapi32 "@.libs\\textstyle-0.dll.exp" -Wl,-DLL,-IMPLIB:".libs\\textstyle.lib"
LINK : warning LNK4044: unrecognized option '/LD:/installed/x64-windows/lib'; ignored

@Neumann-A
Copy link
Contributor

The wrapper stopped caring about -L since this flag became prefixed with -Xlinker

Maybe it should be corrected to -LIBPATH: then.

I would like to reduce the -Xlinker noise if the wrappers & libtool are not used.

@dg0yt
Copy link
Contributor Author

dg0yt commented May 3, 2023

Which toolchain is expected to match

if (CMAKE_HOST_WIN32 AND VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES [[cl\.exe$]]) 

What I see in CI for x64-windows is

set(VCPKG_DETECTED_CMAKE_C_COMPILER_ID "MSVC")

@Neumann-A
Copy link
Contributor

Probably VCPKG_DETECTED_CMAKE_C_COMPILER was meant to cover clang-cl/cl but probably also needs to covers icx somehow in the future. I would like to change that to use MSVC_FRONTEND_VARIANT however that only gets consistently set with a newer cmake version than vcpkg currently has.

@MonicaLiu0311 MonicaLiu0311 added the category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly label May 4, 2023
@dg0yt dg0yt marked this pull request as draft May 4, 2023 07:11
@dg0yt
Copy link
Contributor Author

dg0yt commented May 4, 2023

@Neumann-A To implement the lib path flags change it would be ideal to simply have CMAKE_LIBRARY_PATH_FLAG and maybe also MSVC, but both are not yet exported from script/get_cmake_vars.

  • Changing that script will increase the cone of destruction for this PR, making the PR more vulnerable for baseline regressions.
  • That script has cache variables to control which variables get exported, but there is no simple way to add variables.

For now I decided to not change that script, but just leave comments.

I don't have access to MSVC or clang-cl outside vcpkg CI, so I can't check any logs (or paths with spaces) for these triplets unless CI fails.

@dg0yt dg0yt marked this pull request as ready for review May 5, 2023 07:38
MonicaLiu0311
MonicaLiu0311 previously approved these changes May 10, 2023
@MonicaLiu0311 MonicaLiu0311 added the info:reviewed Pull Request changes follow basic guidelines label May 10, 2023
@dg0yt
Copy link
Contributor Author

dg0yt commented Dec 15, 2023

I do understand the concerns about breaking old versions.
I do not understand the general decision "to leave the bugs unfixed" which effectively forbids cherry-picking less problematic changes.

@dg0yt
Copy link
Contributor Author

dg0yt commented Dec 26, 2023

Requesting a new review @BillyONeal @JavierMatosD @dan-shaw @vicroms.

  • No port changes required, so there should be more confidence that it doesn't break customer ports and triplets.
    (Exception: uwp support in port icu is fairly new, and the change seems to be a real fix, dealing with the uwp appcontainer bits. I compared build logs with [invalid] Collect icu logs #35848.)
  • Tested with Android NDK r26 in Activate Android NDK r26d in vcpkg CI #35851.
    (More changes required to ports, mostly because new headers became available but the availability of functions still depends on API level. And clang seems to use C++17 by default, removing e.g. std::unary_function.)

Comment on lines -791 to -797
# https://www.gnu.org/software/libtool/manual/html_node/Link-mode.html
# -avoid-version is handled specially by libtool link mode, this flag is not forwarded to linker,
# and libtool tries to avoid versioning for shared libraries and no symbolic links are created.
if(VCPKG_TARGET_IS_ANDROID)
set(ENV{LDFLAGS} "-avoid-version $ENV{LDFLAGS}")
set(ENV{LDFLAGS_FOR_BUILD} "-avoid-version $ENV{LDFLAGS_FOR_BUILD}")
endif()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing -avoid-version is a key change to make NDK r26 work. Libtool doesn't need it any longer explicitly. And shared libs are already broken for Android. I will add another change which modifies the generated libtool scripts in the build directories, but I will put this behind a condition.

Comment on lines +87 to 93
if("libtool-link-pass-target" IN_LIST VCPKG_BUILD_MAKE_FIXUP)
# Pass --target to the linker, e.g. for Android
file(GLOB_RECURSE libtool_files "${working_directory}/libtool")
foreach(file IN LISTS libtool_files)
vcpkg_replace_string("${file}" [[-xtarget=*|]] [[-xtarget=*|--target=*|]])
endforeach()
endif()
Copy link
Contributor

Choose a reason for hiding this comment

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

--target belongs into CC/CXX. libtool doesn't invoke the linker it invokes the linker through the compiler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is your proposal? Any references?
The compiler which invokes the linker is clang here. --target already is in the LDFLAGS, and it is used this way during configure when libtool is not used. This change makes libtool` pass it through (as passed in). And this is needed to make clang select the right runtime artifacts for Android and the desired API level.

Copy link
Contributor Author

@dg0yt dg0yt Dec 28, 2023

Choose a reason for hiding this comment

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

# Before:
/bin/bash ../libtool  --tag=CC   --mode=link /android-ndk-r26/toolchains/llvm/prebuilt/linux-x86_64/bin/clang  -g -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mthumb -Wformat -Werror=format-security -fPIC -fno-limit-debug-info -fopenmp  -L/vcpkg/installed/arm-neon-android-dynamic/debug/lib --target=armv7-none-linux-androideabi28 -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--no-undefined-version -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments --sysroot=/android-ndk-r26/toolchains/llvm/prebuilt/linux-x86_64/sysroot -version-info 1:4:0 -o libb2.la -rpath /vcpkg/installed/arm-neon-android-dynamic/debug/lib libb2_la-blake2s-ref.lo libb2_la-blake2b-ref.lo libb2_la-blake2sp.lo libb2_la-blake2bp.lo  -latomic -lm
libtool: link: /android-ndk-r26/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -shared  -fPIC -DPIC  .libs/libb2_la-blake2s-ref.o .libs/libb2_la-blake2b-ref.o .libs/libb2_la-blake2sp.o .libs/libb2_la-blake2bp.o   -L/vcpkg/installed/arm-neon-android-dynamic/debug/lib -latomic -lm  -g -fstack-protector-strong -mthumb -fopenmp -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--no-undefined-version -Wl,--fatal-warnings -Wl,--no-undefined --sysroot=/android-ndk-r26/toolchains/llvm/prebuilt/linux-x86_64/sysroot   -fopenmp -Wl,-soname -Wl,libb2.so -o .libs/libb2.so
ld.lld: error: cannot open crti.o: No such file or directory
ld.lld: error: cannot open crtbeginS.o: No such file or directory
ld.lld: error: unable to find library -lm
ld.lld: error: unable to find library -lgcc
ld.lld: error: unable to find library -lgcc_s
ld.lld: error: unable to find library -lpthread
ld.lld: error: unable to find library -lc
ld.lld: error: unable to find library -lgcc
ld.lld: error: unable to find library -lgcc_s
ld.lld: error: cannot open crtendS.o: No such file or directory
ld.lld: error: cannot open crtn.o: No such file or directory
clang-17: error: linker command failed with exit code 1 (use -v to see invocation)

# After:
/bin/bash ../libtool  --tag=CC   --mode=link /android-ndk-r26/toolchains/llvm/prebuilt/linux-x86_64/bin/clang  -g -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mthumb -Wformat -Werror=format-security -fPIC -fno-limit-debug-info -fopenmp  -L/vcpkg/installed/arm-neon-android-dynamic/debug/lib --target=armv7-none-linux-androideabi28 -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--no-undefined-version -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments --sysroot=/android-ndk-r26/toolchains/llvm/prebuilt/linux-x86_64/sysroot -version-info 1:4:0 -o libb2.la -rpath /vcpkg/installed/arm-neon-android-dynamic/debug/lib libb2_la-blake2s-ref.lo libb2_la-blake2b-ref.lo libb2_la-blake2sp.lo libb2_la-blake2bp.lo  -latomic -lm
libtool: link: /android-ndk-r26/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -shared  -fPIC -DPIC  .libs/libb2_la-blake2s-ref.o .libs/libb2_la-blake2b-ref.o .libs/libb2_la-blake2sp.o .libs/libb2_la-blake2bp.o   -L/vcpkg/installed/arm-neon-android-dynamic/debug/lib -latomic -lm  -g -fstack-protector-strong -mthumb -fopenmp --target=armv7-none-linux-androideabi28 -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--no-undefined-version -Wl,--fatal-warnings -Wl,--no-undefined --sysroot=/android-ndk-r26/toolchains/llvm/prebuilt/linux-x86_64/sysroot   -fopenmp -Wl,-soname -Wl,libb2.so -o .libs/libb2.so

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm while searching for the issues i found: wolfSSL/wolfssl#4519

So you should probably use the wrapper script instead of invoking clang directly.
Is there an issue raised with libtool? Seems more like a generic problem with it.

Copy link
Contributor

Choose a reason for hiding this comment

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

There is also https://debbugs.gnu.org/db/25/25944.html from 2017. So probably just missing somebody who is willing to submit a patch.
I don't think vcpkg should currently correct this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To put things straight, these are the official NDK instructions for autotools:
https://developer.android.com/ndk/guides/other_build_systems#autoconf

So there are prefixed tools. But they are not the tools used in vcpkg's CMake toolchains and forwarded to autotools as implemented in vcpkg_configure_make.

Copy link
Contributor

Choose a reason for hiding this comment

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

So there are prefixed tools. But they are not the tools used in vcpkg's CMake toolchains

Then that should be changed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change vcpkg's cmake toolchain setup?
Or transform Android clang --target=x86_64-linux-android32 into x86_64-linux-android32-clang if it exists?
Or simply write a wrapper of that name ourself?

Copy link
Contributor

Choose a reason for hiding this comment

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

transform Android clang --target=x86_64-linux-android32 into x86_64-linux-android32-clang

Change the toolchain to use the wrapper since the wrapper probably needs to be used in more places?
Alternatively, change it to the wrapper in cmake_get_vars?

I don't see a need to generate a wrapper ourself if upstream provides one (but I also already thought about generating wrappers for windows to make sure flags a correctly passed.).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change the toolchain to use the wrapper since the wrapper probably needs to be used in more places?

I'm afraid this is not acceptable because it is not the recommended use of the NDK with CMake. And it would need to deal with different versions of the NDK.

Alternatively, change it to the wrapper in cmake_get_vars?

I'm afraid this is not acceptable because this affects more places, including user ports.

@JavierMatosD JavierMatosD added the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label Jan 13, 2024
@JavierMatosD
Copy link
Contributor

Ok, I like the changes here. I'm going to bring it up to the team during our next review meeting :) Thanks @dg0yt for your work and patience!

@JavierMatosD JavierMatosD added the info:reviewed Pull Request changes follow basic guidelines label Jan 17, 2024
@JavierMatosD
Copy link
Contributor

The team has reviewed the changes and agrees with the approach, as long as we can confirm that the command line to the compiler remains the same before and after, with the specific handling of the --target flag being the only exception.

@JavierMatosD JavierMatosD merged commit b2f8426 into microsoft:master Jan 23, 2024
15 checks passed
@dg0yt dg0yt deleted the configure-make-rollup branch January 24, 2024 06:37
TomKatom pushed a commit to TomKatom/vcpkg that referenced this pull request Feb 23, 2024
* Fix lib suffix matching

* Preserve flags when transforming standard libs

* Use separate_arguments

* Fix transform

* [vcpkg_configure_make] Fix SKIP_CONFIGURE

* Update linker flags

* Update linker flags

* Fix regex substitution

* Restore full CI

* Reuse configure's linker flags setup

* Handle ldflags separately from linker flags

* Factor out common definitions

* Control docdir and mandir for debug

* Use vcpkg_list APPEND

* Don't pass -avoid-version into configure

* Restore lost escaping

* Copy --target from LDFLAGS to CC/CXX

* Consolidate macros into one function

* Elaborate ABI flags

* Elaborate flag processing

* Update warnings for embedded space

* Update windows tool path fixup

* [libudns] No cross builds

* [vcpkg_find_acquire_program] Add VSCLANG

Find VS's clang without fallback to the giant LLVM download.

* [gmp] Update CCAS setup

* [nettle] Update CCAS setup

* Fix VSCLANG

* WIP

* Restore processing of isysroot

* [nettle] Fix assembler option

* [liburing] Adjust

* Variable name changes

* Remove redundant separate arguments

* Move -m32/-m64 to ABI flags

* Unify ABIFLAGS spelling

* CI

* Revert VSCLANG

* Use GNU Make to build autotools ports on FreeBSD (microsoft#32282)

* Fix flag removal

* Drop separation of ABI flags

* Handle '-arch=...'

* Revert "Control docdir and mandir for debug"

This reverts commit d8293a1.

* [icu] Pass uwp option to pkgdata

* Restore old osx flags hook

* Add triplet variable to make libtool pass --target to linker

---------

Co-authored-by: Schaich, Alonso <alonsoschaich@fastmail.fm>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly info:reviewed Pull Request changes follow basic guidelines requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look.
Projects
None yet