On Sat, Apr 22, 2023 at 9:40 AM Joel Knight <[email protected]> wrote:
>
> On Sat, Apr 15, 2023 at 6:47 AM Stuart Henderson <[email protected]> wrote:
> >
> > > - if llvm is installed, the wrong ar is used by py-awscrt
> > >   -- CMAKE_AR found: /usr/local/bin/llvm-ar
> >
> > This is because it's not using standard ports build arguments for
> > cmake as would be used by the cmake module (there are a bunch of
> > CONFIGURE_ARGS lines to override various detected paths and other
> > settings).
> >
> > The cc command lines are hidden in the output but I bet they are not
> > using proper CFLAGS etc too.
> >
> > Not sure the best way to deal with this, but ideally it would use
> > things from cmake.port.mk directly somehow rather than having to
> > replicate and sync when things change..
>
> I tried a few things, but haven't been able to find the ideal solution for 
> this.
>
> What I've done for now is extract the relevant CONFIGURE_ARGS from
> cmake.port.mk and set the toolchain paths in py-awscrt's top level
> CMakeLists.txt. With this patch, I can build the port with or without
> llvm installed, and CMAKE_AR is set to /usr/bin/ar in both cases. This
> also holds true if I 'make configure' with llvm installed, uninstall
> llvm, and then 'make build'. Thoughts?

Updated the port to latest upstream versions.

Stu/Antoine, thoughts on how I've handled using the correct toolchain?
Ok to import?


> Index: crt/CMakeLists.txt
> --- crt/CMakeLists.txt.orig
> +++ crt/CMakeLists.txt
> @@ -26,6 +26,22 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "")
>  set(BUILD_TESTING OFF CACHE BOOL "")
>  include(CTest)
>
> +# Force use of toolchain in base. Otherwise, if the devel/llvm port is
> +# installed, cmake will prefer toolchain binaries in /usr/local.
> +# This is done here instead of relying on cmake.port.mk because the
> +# devel/py-awscrt port is built with py-setuptools, not make(1), which
> +# makes it a case that cmake.port.mk isn't suited for.
> +foreach(_LANG ASM C CXX)
> +    set(CMAKE_${_LANG}_COMPILER_AR "/usr/bin/ar" CACHE FILEPATH "" FORCE)
> +    set(CMAKE_${_LANG}_COMPILER_RANLIB "/usr/bin/ranlib" CACHE
> FILEPATH "" FORCE)
> +endforeach()
> +set(CMAKE_ADDR2LINE "/usr/bin/addr2line" CACHE FILEPATH "" FORCE)
> +set(CMAKE_AR "/usr/bin/ar" CACHE FILEPATH "" FORCE)
> +set(CMAKE_NM "/usr/bin/nm" CACHE FILEPATH "" FORCE)
> +set(CMAKE_RANLIB "/usr/bin/ranlib" CACHE FILEPATH "" FORCE)
> +set(CMAKE_READELF "/usr/bin/readelf" CACHE FILEPATH "" FORCE)
> +set(CMAKE_STRIP "/usr/bin/strip" CACHE FILEPATH "" FORCE)
> +
>  # On Unix we use S2N for TLS and AWS-LC crypto.
>  # (On Windows and Apple we use the default OS libraries)
>  if(UNIX AND NOT APPLE)
>
>
>
>
>
> .joel

Attachment: awscliv2-73-20230506.tgz
Description: application/compressed

Reply via email to