Skip to content

Commit

Permalink
fixes to v0.5.0 CRAN build errors and warnings (#13)
Browse files Browse the repository at this point in the history
* configure

* update build notes

* Modifications to allow OSQP to build correctly on CRAN
  • Loading branch information
goulart-paul authored Oct 28, 2019
1 parent 695e23c commit aeba730
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 45 deletions.
3 changes: 2 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
^.*tar.gz$
^.*travis\.yml$
osqp_sources/CMakeFiles$
osqp_sources/lin_sys/direct/CMakeFiles$
Expand All @@ -19,5 +20,5 @@ CMakeDirectoryInformation.cmake
^.*\\.gz$
libosqp.a
^appveyor\.yml$
^cran_comments\.md$
^cran-comments\.md$
^CRAN-RELEASE$
21 changes: 12 additions & 9 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
Package: osqp
Type: Package
Title: Quadratic Programming Solver using the 'OSQP' Library
Version: 0.6.0.1
Date: 2019-09-05
Authors@R: c(person("Bartolomeo", "Stellato", email = "bartolomeo.stellato@gmail.com", role = c("cre", "aut", "ctb", "cph")), person("Goran", "Banjac", role = c("aut", "ctb", "cph")), person("Paul", "Goulart", role = c("aut", "ctb", "cph")), person("Stephen", "Boyd", role = c("aut", "ctb", "cph")), person("Eric", "Anderson", role=c("ctb")))
Version: 0.6.0.2
Date: 2019-09-09
Authors@R: c(
person("Bartolomeo", "Stellato", role = c("cre", "aut", "ctb", "cph"),
email = "bartolomeo.stellato@gmail.com"),
person("Goran", "Banjac", role = c("aut", "ctb", "cph")),
person("Paul", "Goulart", role = c("aut", "ctb", "cph")),
person("Stephen", "Boyd", role = c("aut", "ctb", "cph")),
person("Eric", "Anderson", role=c("ctb")))
Copyright: file COPYRIGHT
Description: Provides bindings to the 'OSQP' solver. The 'OSQP' solver is a numerical optimization package or solving convex quadratic programs written in 'C' and based on the alternating direction method of multipliers, 'ADMM'. B. Stellato, G. Banjac, P. Goulart, A. Bemporad, S. Boyd (2018) <arXiv:1711.08013>.
Description: Provides bindings to the 'OSQP' solver. The 'OSQP' solver is a numerical optimization package or solving convex quadratic programs written in 'C' and based on the alternating direction method of multipliers. See <arXiv:1711.08013> for details.
License: Apache License 2.0 | file LICENSE
Imports: Rcpp (>= 0.12.14), methods, Matrix, R6
LinkingTo: Rcpp
RoxygenNote: 6.1.1
Collate: 'RcppExports.R' 'osqp-package.R' 'solve.R' 'osqp.R'
'params.R'
Collate: 'RcppExports.R' 'osqp-package.R' 'solve.R' 'osqp.R' 'params.R'
NeedsCompilation: yes
Packaged: 2019-09-05 00:00:00 UTC
Date/Publication: 2019-09-05 00:00:00 UTC
Suggests: testthat
URL: https://www.osqp.org
5 changes: 3 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Version 0.6.0.1 (5 September 2019) OSQP 0.6.0.1
* Reformat of Solaris makefiles
# Version 0.6.0.2 (9 September 2019) OSQP 0.6.0.2

* Patches to OSQP-R build for solaris and fedora

# Version 0.6.0 (2 September 2019) OSQP 0.6.0

Expand Down
7 changes: 3 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
set -e
set -x

if hash cmake 2>/dev/null; then
if [ -x "$(command -v cmake)" ]; then

echo "-- Trying to build libosqp.a via cmake ..."
cd src/osqp_sources

mkdir -p build
cd build
cmake -DR_LANG=TRUE -DCMAKE_INSTALL_PREFIX:PATH=../../osqp/ ..
cmake -DR_LANG=TRUE -DCMAKE_INSTALL_PREFIX:PATH=../../ ..
cmake --build . --target install
cd ..
rm -rf build/
Expand All @@ -26,5 +25,5 @@ if hash cmake 2>/dev/null; then
echo "-- Built libosqp.a"

else
echo "-- No cmake, so I will try to make libosqp.a via R Makevars instead"
echo "-- cmake is not installed on this system. OSQP library libosqp.a will be built via custom makefile."
fi
26 changes: 26 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Test environments

* Local:
* OS X 10.14: R 3.6.1
* Solaris 11.4 via VirtualBox: R 3.6.1
* Appveyor:
* Windows Server 2012: R-release, R-devel, R-oldrel
* Travis-CI:
* Ubuntu 16.04: R-release, R-devel
* OS X, with and without homebrew: R-release, R-devel
* Rhub:
* Windows Server 2008 R2 SP1, R-devel, 32/64 bit
* Ubuntu Linux 16.04 LTS, R-release, GCC
* Fedora Linux, R-devel, clang, gfortran
* Debian Linux, R-devel, GCC ASAN/UBSAN


## R CMD check results
There were no ERRORs or WARNINGs.

There was 1 NOTE:

Maintainer: ‘Bartolomeo Stellato <bartolomeo.stellato@gmail.com>’
Days since last update: 2

The maintainer information is correct.
9 changes: 0 additions & 9 deletions cran_comments.md

This file was deleted.

31 changes: 15 additions & 16 deletions src/Makevars
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
OSQP_DIR=./osqp
OSQP_LIB_DIR=$(OSQP_DIR)/lib
OSQP_INCLUDE_DIR=$(OSQP_DIR)/include/osqp
OSQP_STATIC_LIB=$(OSQP_LIB_DIR)/libosqp.a
OSQP_LIB_TARGET_DIR=./lib
OSQP_INCLUDE_TARGET_DIR=./include/osqp/
OSQP_STATIC_LIB=$(OSQP_LIB_TARGET_DIR)/libosqp.a

OSQP_FLAGS=-DR_LANG=TRUE

PKG_CXXFLAGS = $(OSQP_FLAGS) -I$(OSQP_INCLUDE_DIR)
PKG_CXXFLAGS=-I$(OSQP_INCLUDE_TARGET_DIR)
PKG_LIBS=-L$(OSQP_LIB_TARGET_DIR) -losqp

ROBJECTS = osqp_solve_interface.o RcppExports.o
OBJECTS = $(ROBJECTS) $(OSQP_STATIC_LIB)
ROBJECTS=osqp_solve_interface.o RcppExports.o
OBJECTS=$(ROBJECTS)

CXX_STD=CXX11

.PHONY: all
.PHONY: $(R_OBJECTS) all

all: $(SHLIBS)
all: $(SHLIB)

$(SHLIBS): $(OSQP_STATIC_LIB)
$(SHLIB): $(OSQP_STATIC_LIB)

$(ROBJECTS): $(OSQP_STATIC_LIB)

$(OSQP_STATIC_LIB):

# The OSQP static library should already exist and
# be in the correct place if we are building via cmake.
# If we find ourselves without cmake installed (e.g. because the
# package is being built in the CRAN servers), then we have
# a go at building the static library here.

(cd $(OSQP_DIR) && \
$(MAKE) CC="$(CC)" \
echo "No cmake? I will try via osqp/Makefile"
cd osqp; \
$(MAKE) all CC="$(CC)" \
OSQP_FLAGS="$(OSQP_FLAGS)" \
R_INCLUDE_DIR="$(R_INCLUDE_DIR)" CFLAGS="$(CFLAGS)" \
CPICFLAGS="$(CPICFLAGS)" ARFLAGS="$(ARFLAGS)" \
AR="$(AR)" RANLIB="$(RANLIB)" \
&& $(MAKE) clean)
AR="$(AR)" RANLIB="$(RANLIB)" ; \
$(MAKE) clean
6 changes: 3 additions & 3 deletions src/osqp/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OSQP_OUT_INCLUDE_DIR=./include/osqp/
OSQP_OUT_LIB_DIR=./lib/
OSQP_OUT_INCLUDE_DIR=../include/osqp/
OSQP_OUT_LIB_DIR=../lib/
OSQP_STATIC_LIB=$(OSQP_OUT_LIB_DIR)/libosqp.a

OSQP_RCONFIG_DEFAULT_INCLUDE=../osqp_configure_R.h
Expand Down Expand Up @@ -62,7 +62,7 @@ CXX_STD=CXX11
all: $(OSQP_STATIC_LIB) osqp_includes

$(OSQP_OBJECTS): $(OSQP_SRC_CONFIGURE_H) $(QDLDL_SRC_CONFIGURE_H)
$(CC) $(OSQP_SRC_INCLUDES_ALL) -I$(R_INCLUDE_DIR) $(CPICFLAGS) $(OSQP_FLAGS) $(CFLAGS) -c $(@:.o=.c) -o $@
$(CC) -c $(@:.o=.c) -o $@ $(OSQP_SRC_INCLUDES_ALL) -I$(R_INCLUDE_DIR) $(CPICFLAGS) $(OSQP_FLAGS) $(CFLAGS)


$(OSQP_STATIC_LIB): $(OSQP_OBJECTS)
Expand Down
2 changes: 1 addition & 1 deletion src/osqp_sources
Submodule osqp_sources updated from 0baddd to 911605

0 comments on commit aeba730

Please sign in to comment.