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

[CppAD] Add CppAD port #12560

Merged
merged 7 commits into from
Aug 7, 2020
Merged

Conversation

GiulioRomualdi
Copy link
Contributor

@traversaro @S-Dafarra

@NancyLi1013 NancyLi1013 added the category:new-port The issue is requesting a new library to be added; consider making a PR! label Jul 27, 2020
@NancyLi1013
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

GiulioRomualdi and others added 2 commits July 27, 2020 11:50
Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
ports/cppad/portfile.cmake Outdated Show resolved Hide resolved
@NancyLi1013
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@GiulioRomualdi
Copy link
Contributor Author

I tried to build cppad:x86-windows on a fresh windows installation and I got the following error. @NancyLi1013 could you please give me an explanation of why this happening?

Should I remove PREFER_NINJA from vcpkg_configure_cmake when the triplet x86-windows is used?

.\vcpkg.exe install cppad:x86-windows
Computing installation plan...
The following packages will be built and installed:
    cppad[core]:x86-windows
Detecting compiler hash for triplet x86-windows...
Starting package 1/1: cppad:x86-windows
Building package cppad[core]:x86-windows...
Could not locate cached archive: C:\Users\gromualdi\AppData\Local\vcpkg\archives\60\60acc7c8c365356ea3fa728f338186ea7a673064.zip
-- Using cached C:/Users/gromualdi/robot-code/vcpkg/downloads/coin-or-CppAD-20200000.3.tar.gz
-- Cleaning sources at C:/Users/gromualdi/robot-code/vcpkg/buildtrees/cppad/src/20200000.3-2149299b1e.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source C:/Users/gromualdi/robot-code/vcpkg/downloads/coin-or-CppAD-20200000.3.tar.gz
-- Applying patch windows-fix.patch
-- Using source at C:/Users/gromualdi/robot-code/vcpkg/buildtrees/cppad/src/20200000.3-2149299b1e.clean
-- Configuring x86-windows
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:72 (message):
    Command failed: ninja -v
    Working Directory: C:/Users/gromualdi/robot-code/vcpkg/buildtrees/cppad/x86-windows-rel/vcpkg-parallel-configure
    Error code: 1
    See logs for more information:
      C:\Users\gromualdi\robot-code\vcpkg\buildtrees\cppad\config-x86-windows-out.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_configure_cmake.cmake:300 (vcpkg_execute_required_process)
  ports/cppad/portfile.cmake:13 (vcpkg_configure_cmake)
  scripts/ports.cmake:79 (include)

@NancyLi1013
Copy link
Contributor

Could you please provide C:\Users\gromualdi\robot-code\vcpkg\buildtrees\cppad\config-x86-windows-out.log?

@GiulioRomualdi
Copy link
Contributor Author

Could you please provide C:\Users\gromualdi\robot-code\vcpkg\buildtrees\cppad\config-x86-windows-out.log?

This is the file: config-x86-windows-out.log

Here you can find additional files:

  1. CMakeError.log
  2. CMakeOutput.log

According to the fatal error in CMakeError.log:

CheckIncludeFile.c(1): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory
ninja: build stopped: subcommand failed.

There seems that the error is related to pthread

Thank you very much for your support.

@GiulioRomualdi
Copy link
Contributor Author

On the other hand, the error on x64_osx is caused by

vcpkg_fixup_pkgconfig()

Indeed the cppad.pc provided by the original library does not contain:

prefix=${pcfiledir}/../..
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib

This is an example of the file generated on my PC

 Name:         cppad
 Description:  Differentiation of C++ Algorithms
 Version:      20200000.3
 URL:          http://www.coin-or.org/CppAD
 # Entries set by pkgconfig/CMakeLists.txt file
 Cflags:       -I/home/gromualdi/robot-code/vcpkg/packages/cppad_x64-linux/include
 Libs:         -L/home/gromualdi/robot-code/vcpkg/packages/cppad_x64-linux/lib -lcppad_lib
 Requires:

when vcpkg_fixup_pkgconfig() is called /home/gromualdi/robot-code/vcpkg/packages/cppad_x64-linux/ is substituted with ${prefix}

 Name:         cppad
 Description:  Differentiation of C++ Algorithms
 Version:      20200000.3
 URL:          http://www.coin-or.org/CppAD
 # Entries set by pkgconfig/CMakeLists.txt file
 Cflags:       -I${prefix}/include
 Libs:         -L${prefix}/lib  -lcppad_lib
 Requires:

however, since prefix is not defined. The error is thrown.

Possible solutions are:

  1. remove vcpkg_fixup_pkgconfig()
  2. add a patch for fixing the issue

What do you prefer? @NancyLi1013

@traversaro
Copy link
Contributor

however, since prefix is not defined. The error is thrown.

I think that is a bug in vcpkg_fixup_pkgconfig, that fails in the fixup if the .pc did not contain ${prefix} since the beginning. Not sure if there is any PR that is currently tackling this problem. FYI @Neumann-A

@Neumann-A
Copy link
Contributor

Prefix must be defined. Patch the *.pc file if it is not defined in there. pkg-config does not work if the prefix is not defined (with a few exceptions).

@GiulioRomualdi
Copy link
Contributor Author

GiulioRomualdi commented Jul 30, 2020

Prefix must be defined. Patch the *.pc file if it is not defined in there. pkg-config does not work if the prefix is not defined (with a few exceptions).

34ce3a7 should fix the pkg-config issue

Associated issue: coin-or/CppAD#62
Associated PR: coin-or/CppAD#63

@NancyLi1013
Copy link
Contributor

Hi @GiulioRomualdi
For the issue on x86-windows, I cannot reproduce this on my local.
From config-x86-windows-out.log, I got this information, which seems nothing to do with pthread.h. Since pthread.h is only required on Unix platform.

CMake Error at include/cppad/CMakeLists.txt:289 (CONFIGURE_FILE):
  CONFIGURE_FILE Problem configuring file

You might need to check this again.

@GiulioRomualdi
Copy link
Contributor Author

GiulioRomualdi commented Aug 1, 2020

Here I would like to recap the failures in the CI:

  • x64_windows: failure due to qt5-serialbus:x64-windows

    2020-08-01T01:51:27.2140036Z Starting package 456/516: qt5-serialbus:x64-windows
    2020-08-01T01:51:27.2145699Z Building package qt5-serialbus[core]:x64-windows...
    2020-08-01T01:51:27.2149891Z Using cached binary package: 
    W:\2d\2d611a1610935060de78575f299b760d3a2608b2.zip
    2020-08-01T01:51:30.6113379Z Building package qt5-serialbus[core]:x64-windows... done
    2020-08-01T01:51:30.6119009Z Installing package qt5-serialbus[core]:x64-windows...
    2020-08-01T01:51:30.6123374Z The following files are already installed in D:/installed/x64- 
    windows and are in conflict with qt5-serialbus:x64-windows
    2020-08-01T01:51:30.6125801Z 
    2020-08-01T01:51:30.6130360Z Installed by qt5-declarative:x64-windows
    2020-08-01T01:51:30.6134706Z     tools/qt5/bin/Qt5Network.dll
    2020-08-01T01:51:30.6141040Z     tools/qt5/bin/plugins/bearer/qgenericbearer.dll
    2020-08-01T01:51:30.6143604Z 
    2020-08-01T01:51:30.6147571Z Elapsed time for package qt5-serialbus:x64-windows: 3.398 s
    

    I don't think it is related to this PR. This is the associated artifact

  • x64-uwp: fails while configuring ninja This is the associated artifact x64-uwp port build failure logs.zip

  • arm64-windows: fails while configure ninja

    CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:72 (message):
     Command failed: ninja -v
     Working Directory: D:/buildtrees/cppad/arm64-windows-rel/vcpkg-parallel-configure
     Error code: 1
     See logs for more information:
       D:\buildtrees\cppad\config-arm64-windows-out.log
    
    Call Stack (most recent call first):
    scripts/cmake/vcpkg_configure_cmake.cmake:300 (vcpkg_execute_required_process)
    ports/cppad/portfile.cmake:12 (vcpkg_configure_cmake)
    scripts/ports.cmake:79 (include)
    
    
    Error: Building package cppad:arm64-windows failed with: BUILD_FAILED
    

    This is the associated artifact arm64-windows port build failure logs.zip

  • arm_uwp: fails while configuring ninja. This is the associated artifact arm-uwp port build failure logs.zip

What do you suggest @NancyLi1013?

@NancyLi1013
Copy link
Contributor

Hi @GiulioRomualdi
Sorry for the late reply.

For the failures on arm64-windows, it is due to this:

-- cppad_tape_id_type_is_unsigned = 0
-- Warning: using a signed cppad_tape_id_type is for CppAD developers only !
-- Performing Test cppad_tape_addr_type_is_unsigned
-- Performing Test cppad_tape_addr_type_is_unsigned - Failed
-- cppad_tape_addr_type_is_unsigned = 0
-- Warning: using a signed cppad_tape_addr_type is for CppAD developers only !
-- Performing Test cppad_max_num_threads_is_integer_ge_4
-- Performing Test cppad_max_num_threads_is_integer_ge_4 - Failed
CMake Error at include/cppad/CMakeLists.txt:256 (MESSAGE):
  cppad_max_num_threads is not an integer greater than or equal 4

For x64-uwp and arm-uwp, it is due to this:

Make Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
   cppad_has_signed_long_long_EXITCODE (advanced)
   cppad_has_signed_long_long_EXITCODE__TRYRUN_OUTPUT (advanced)
For details see D:/buildtrees/cppad/x64-uwp-dbg/TryRunResults.cmake
-- Performing Test cppad_has_signed_long_long - Failed
-- cppad_has_signed_long_long = 1
-- Performing Test cppad_has_rvalue
CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
   cppad_has_rvalue_EXITCODE (advanced)
   cppad_has_rvalue_EXITCODE__TRYRUN_OUTPUT (advanced)
For details see D:/buildtrees/cppad/x64-uwp-dbg/TryRunResults.cmake
-- Performing Test cppad_has_rvalue - Failed
-- cppad_has_rvalue = 1
-- Performing Test cppad_has_nullptr
CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
   cppad_has_nullptr_EXITCODE (advanced)
   cppad_has_nullptr_EXITCODE__TRYRUN_OUTPUT (advanced)
For details see D:/buildtrees/cppad/x64-uwp-dbg/TryRunResults.cmake
-- Performing Test cppad_has_nullptr - Failed
-- cppad_has_nullptr = 1
-- Performing Test cppad_has_long_long
CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
   cppad_has_long_long_EXITCODE (advanced)
   cppad_has_long_long_EXITCODE__TRYRUN_OUTPUT (advanced)

These should be bug. You might post these issues to upstream. Or you can add unsupported messages for cppad until they are fixed.
Add Supports: !(arm|uwp) to CONTROL file.
Add vcpkg_fail_port_install(ON_TARGET "uwp" and "arm") to the top of portfile.cmake.

@NancyLi1013
Copy link
Contributor

For the regressions on x64-windows, I will try to reproduce it on my local to confirm if it is a bug.

@GiulioRomualdi
Copy link
Contributor Author

Thanks @NancyLi1013 for the support. I've just opened two issues on the original project to check track the problem:

In the meantime, I will

Add Supports: !(arm|uwp) to CONTROL file.
Add vcpkg_fail_port_install(ON_TARGET "uwp" and "arm") to the top of portfile.cmake.

@GiulioRomualdi
Copy link
Contributor Author

GiulioRomualdi commented Aug 4, 2020

That's strange. Now x64-osx is failing while building pbc (should I rebase this PR on top of master?)

CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:72 (message):
    Command failed: /Users/vagrant/Data/buildtrees/pbc/src/0.5.14-c79affd856.clean/configure --prefix=/Users/vagrant/Data/packages/pbc_x64-osx/debug --enable-static --disable-shared LEX=/usr/bin/flex "YACC=/usr/local/opt/bison/bin/bison -y" --with-sysroot=/Users/vagrant/Data/installed/x64-osx/debug
    Working Directory: /Users/vagrant/Data/buildtrees/pbc/x64-osx-dbg
    Error code: 255
    See logs for more information:
      /Users/vagrant/Data/buildtrees/pbc/configure-x64-osx-dbg-out.log
      /Users/vagrant/Data/buildtrees/pbc/configure-x64-osx-dbg-err.log

Call Stack (most recent call first):
  ports/pbc/portfile.cmake:41 (vcpkg_execute_required_process)
  scripts/ports.cmake:79 (include)


Error: Building package pbc:x64-osx failed with: BUILD_FAILED
Elapsed time for package pbc:x64-osx: 23.02 s

x64-windows fails with the following error

CMake Error: Could not open file for write in copy operation D:/buildtrees/cppad/src/20200000.3-5be66da317.clean/bin/test_one.sh.tmp
CMake Error: : System Error: Permission denied
CMake Error at CMakeLists.txt:350 (CONFIGURE_FILE):
  CONFIGURE_FILE Problem configuring file

Here the artifact generated: x64-windows port build failure logs.zip

@NancyLi1013
Copy link
Contributor

For the failure on x64-osx, you can ignore it, which is not related to this PR. We have fixed it in PR #12732.

For x64-windows, you can add DISABLE_PARALLEL_CONFIGURE to vcpkg_configure_cmake() and then rebuild.

@NancyLi1013
Copy link
Contributor

LGTM now. If the two patches in this PR can be accepted by upstream, it will be perfect.

The support for arm and uwp, if it will be fixed by upstream, we can update it later in vcpkg.

@GiulioRomualdi
Copy link
Contributor Author

LGTM now. If the two patches in this PR can be accepted by upstream, it will be perfect.

Since I'm not the maintainer of cppad I don't know what's the pipeline they use for accepting PR. If it's not a problem with you we can merge the PR and then I can take care of updating the port when the PR will be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:new-port The issue is requesting a new library to be added; consider making a PR! info:reviewed Pull Request changes follow basic guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[New Port Request] CppAD
5 participants