<div dir="ltr"><div>Hi,</div><div><br></div><div>This note is NOT a question. Its purpose is to help other novices who may have similar goals to mine. Some of the settings I used/learned of may be useful to others.</div><div><br></div><div>I thank Tony Kellman and Stefan Vigerske for advice that led to success, and Tony for relentlessly following up. </div><div><br></div><div>I am happy to provide further details if anyone wants. I am happy to edit/improve the explanation if more-experience users point out things that could be improved or where I am using terminology imprecisely.</div><div><br></div><div>Don</div><div><br></div><div><br></div><div><br></div><div><br></div><div>My goals were:</div><div><br></div><div> 1. Compile Ipopt library for Windows 10 64-bit, in a manner that will me to compile the R interface, Ipoptr, so that I can call Ipopt from R.</div><div> 2. Compile the HSL linear solvers (coinhsl-2014.01.10.zip, academic license) with Ipopt, in addition to Mumps. Ideally allow them to run in parallel.</div><div> 3. Compile using the same MinGW compilers that are used by R to compile Ipoptr. These are the Rtools compilers that were already installed on my system.</div><div> 4. Compile with the Blas and Lapack dll libraries included with R, to avoid any possible conflict among versions.</div><div> I am not SURE steps 3 and 4 were essential, but I wanted to avoid potential incompatibilities</div><div><br></div><div>MANY things went wrong, largely because I don't really understand configure and make well enough to tell gcc what tools to use and how, and where to find them. I was like a monkey randomly choosing path statements, configure options, compiler flags, linker flags, and other settings I didn't understand. Finally I asked for and received advice.</div><div><br></div><div>Here are the key steps that were critical to success:</div><div><br></div><div>1. Cleaning up my environment - getting rid of unnecessary compilers or path directories pointing to unneeded compilers. As a novice, I found the free Rapid Environment Editor (<a href="https://www.rapidee.com" target="_blank">https://www.rapidee.com</a>) less intimidating than Windows tools.</div><div><br></div><div>2. Getting rid of Msys1.0 and using Msys2.0 (<a href="http://www.msys2.org/" target="_blank">http://www.msys2.org/</a>).</div><div><br></div><div>Only thing I had to do in addition to the installation instructions, was install make.exe (pacman -S make).</div><div><br></div><div>After installation I put msys on the path (c:\msys64\usr)</div><div><br></div><div>I'm sure installation can be done with Msys1.0, also, but apparently it is buggy and Msys2.0 is nicer.</div><div><br></div><div>3. Putting an export PATH statement in my script telling the system where to find my Rtools MinGW compilers. Here is the one I used:</div><div><br></div><div>export PATH=/c/Rtools/mingw_64/bin:$<wbr>PATH</div><div><br></div><div>I also have the following in my Windows path:</div><div><br></div><div>C:\Rtools\mingw_64</div><div><br></div><div>Honestly, I don't know if both are needed.</div><div><br></div><div>4. Properly defining location and use of Blas and Lapack libraries:</div><div><br></div><div>a. I had to tell configure that I needed BOTH Blas and Lapack. (The HSL documentation speaks only of Blas, and perhaps that is all that is needed, but when I compiled with Ipopt rather than as dll, apparently I needed both.)</div><div><br></div><div>b. I needed to use linker flags rather than the --with-blas configure flag mentioned in the HSL documentation. (Again, may be a quirk of my setup and not a problem with HSL documentation.)</div><div><br></div><div>c. Ensuring that the Blas and Lapack libraries can be found during the make phase, by using "-Wl," (that's dash/upper-case-W/lower-case-<wbr>L/comma with absolutely no spaces -- because syntax is crucial). Here is the precise LDFLAGS element of my configure statement</div><div><br></div><div>LDFLAGS="-LC:/PROGRA~1/R/R-34~<wbr>1.0PA/bin/x64 -Wl,-lRblas -Wl,-lRlapack"</div><div><br></div><div>5. Using the -fopenmp flag so that the HSL solvers can run in parallel.</div><div><br></div><div>6. Here is the resulting configure line that I used:</div><div><br></div><div>../../configure --prefix="${BLD_DIR}/${R_ARCH}<wbr>" --enable-static --disable-shared LDFLAGS="-LC:/PROGRA~1/R/R-34~<wbr>1.0PA/bin/x64 -Wl,-lRblas -Wl,-lRlapack" ADD_CFLAGS=-fopenmp ADD_FFLAGS=-fopenmp ADD_CXXFLAGS=-fopenmp</div><div><br></div><div>where ${BLD_DIR}/${R_ARCH} is the name of the empty directory into which I was going to compile Ipopt and the configure file was two directories up (hence ../../configure).</div><div><br></div><div>7. So the full operation for me, after:</div><div><br></div><div>(a) getting Ipopt source code per instructions, and</div><div>(b) extracting the HSL source to a directory that I renamed to hslcoin and placed under the HSL directory in ThirdParty (resulting in <ipot>/3.12/ThirdParty/HSL/<wbr>coinhsl) per the HSL README </div><div><br></div><div>was to run:</div><div><br></div><div>export PATH=/c/Rtools/mingw_64/bin:$<wbr>PATH</div><div><define ${BLD_DIR}/${R_ARCH} -- the location for the build ></div><div>cd ${BLD_DIR}/${R_ARCH}</div><div>../../configure --prefix="${BLD_DIR}/${R_ARCH}<wbr>" --enable-static --disable-shared LDFLAGS="-LC:/PROGRA~1/R/R-34~<wbr>1.0PA/bin/x64 -Wl,-lRblas -Wl,-lRlapack" ADD_CFLAGS=-fopenmp ADD_FFLAGS=-fopenmp ADD_CXXFLAGS=-fopenmp</div><div>make</div><div>make test</div><div>make install</div><div><br></div><div>8. AFTER make install:</div><div><br></div><div>a. Copying files for the R interface Ipoptr, per Ipoptr instructions:</div><div><br></div><div>1) copy Makevars.win from</div><div>${BLD_DIR}/${R_ARCH}/Ipopt/<wbr>contrib/RInterface/src  (your build directory will be different)</div><div>to</div><div>${IPOPT_DIR}/Ipopt/contrib/<wbr>RInterface/src  (where $IPOPT_DIR is your "3.12" directory if you are using version 3.12)</div><div><br></div><div>2) OPTIONAL:  If you want a much faster version of the make.sparse function than what comes with Ipoptr, replace the version that is in</div><div>${IPOPT_DIR}/Ipopt/contrib/<wbr>RInterface/R/make.sparse.R</div><div>with the version below.</div><div><br></div><div>make.sparse <- function(A) {</div><div>  f <- function(x) which(x!=0, arr.ind=TRUE)</div><div>  rownames(A) <- NULL # just to be safe</div><div>  S <- apply(A, 1, f)</div><div>  S <- as.list(S)</div><div>  return(S)</div><div><br></div><div>b. Installing Ipoptr from within R -- I needed the --no-multiarch flag shown below. Not sure if others will need it:</div><div><br></div><div>ipoptdir <- "C:/Ipopt2017/3.12/Ipopt/<wbr>contrib/RInterface"</div><div>install.packages(ipoptdir, repos=NULL, type='source', INSTALL_opts=c("--no-<wbr>multiarch"))</div><div><br></div><div><br></div><div><br></div><div>That's it. After the installation from within R, I am able to call Ipopt and use any of the HSL linear solvers, or use mumps.</div><div><br></div><div><br></div><div id="m_-8170399122605157599DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br>
<table style="border-top:1px solid #d3d4de">
        <tbody><tr>
        <td style="width:55px;padding-top:13px"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width:46px;height:29px"></a></td>
                <td style="width:470px;padding-top:12px;color:#41424e;font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link" style="color:#4453ea" target="_blank">www.avast.com</a>
                </td>
        </tr>
</tbody></table><a href="#m_-8170399122605157599_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"></a></div></div>