error of addind the SCIP dll to a C# Google or-tools exmaple project

369 views
Skip to first unread message

usac...@gmail.com

unread,
Apr 24, 2015, 5:52:23 PM4/24/15
to or-tools...@googlegroups.com
Hi,

I need to call SCiP to solve MINLP models in C# in VS 2013 on win7.

I have downloaded and installed or-tools and also downloaded SCIP library ( Windows/PC, 64bit, msvc 12.0 ) from
http://scip.zib.de/#download

When I tried to add the dll to a C# project of or-tools exmaple, I got error:

   please make sure that the file is accessible and that it is valid assembly or component.

Any help would be appreciated.

Thanks

Laurent Perron

unread,
Apr 25, 2015, 3:02:10 AM4/25/15
to or-tools...@googlegroups.com

I cannot distribute or-tools with SCIP for licences reasons.
You will need go build it trop the sources.

The instructions are on the développer page.

Thanks


--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

usa usa

unread,
Apr 26, 2015, 12:35:02 AM4/26/15
to or-tools...@googlegroups.com
Hi,

I have added  SCIP ( downloaded from http://scip.zib.de/download.php?fname=scipoptsuite-3.1.1.tgz) to google or-tools
folder "or-tools-master\dependencies\archives".

I am trying to build or-tools source code on win 7 by following the instructions at:

https://developers.google.com/optimization/docs/installing#source_windows

When I ran "nmake third_party", i got error:

      makefile(23): fatal U1034 L syntax error: seperator missing

I do not have "make" in visual studio 12.0 /bin folder. I only have "nmake".

How to build or-tools for my visual studio on win 7 ?

Any help would be appreciated.

thanks

--
You received this message because you are subscribed to a topic in the Google Groups "or-tools-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/or-tools-discuss/0scNA2eQbjE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to or-tools-discu...@googlegroups.com.

Laurent Perron

unread,
Apr 26, 2015, 3:14:17 AM4/26/15
to or-tools-discuss

Run tools\make third_party.
It should be in the installation documentation.

Thanks

usa usa

unread,
Apr 26, 2015, 1:32:19 PM4/26/15
to or-tools...@googlegroups.com
Hi,

I have checked the install document and do not find a solution.

I have installed git (Git-1.9.5-preview20150319.exe) from http://git-scm.com/download/win

and when I built or-tools by running "make.exe third_party", got error:

  sh: C:\program: no such file or directory.
  fatal : not a git repository (or nay of the parent directories):  .git

I also tried to build it in cygwin and got error:

   $ tools/make.exe third_party
    fatal: Not a git repository (or any of the parent directories): .git
    fatal: Not a git repository (or any of the parent directories): .git

usa usa

unread,
Apr 26, 2015, 6:19:49 PM4/26/15
to or-tools...@googlegroups.com
Hi,

After adding or-tools source code to git master and commmiting, the fatal error is gone.
But, I got a new error:

makefiles/Makefile.cpp.mk:1573: warning: ignoring old commands for target `lib/libbop.'

cd dependencies/sources/gflags-2.1.1 && \
 -D BUILD_SHARED_LIBS=ON \
         -D BUILD_STATIC_LIBS=ON \
         -D CMAKE_INSTALL_PREFIX=../../install \
         -D CMAKE_CXX_FLAGS=-fPIC \
         .
C:\cygwin\install\tmp\make91243.sh: line 1: -D: command not found
E:\Google_or_tools\or-tools-master\tools\make.exe: *** [dependencies/install/bin/gflags_completions.sh] Error 127


I cannot find the file make91243.sh in C:\cygwin\install

Any help would be appreciated.

thanks

usa usa

unread,
Apr 28, 2015, 3:36:29 PM4/28/15
to or-tools...@googlegroups.com
Hi,

I found a problem of bullding the or-tools.

In cygwin, when I ran

      tools/make.exe third_party

in or-tools-master\makefiles , the makefile

     Makefile.third_party.unix

was run. Not Makefile.third_party.win


In VS2013 X64 Native tools command promot, when I ran

      tools/make.exe third_party

also the makefile that was run is

        Makefile.third_party.unix


Why ?

I need to call or-tools from VS 2013 C# on win7 not on unix.

Laurent Perron

unread,
Apr 28, 2015, 4:04:31 PM4/28/15
to or-tools-discuss

Use vs2013 cross compiler please.
Cygwin is not supported, and the native compiler does not work.

Thanks

usa usa

unread,
Apr 28, 2015, 5:30:08 PM4/28/15
to or-tools...@googlegroups.com
Hi,

I have switched to

    VS2013 x64 Cross Tools Command Prompt

Is this VS2013 cross-compiler ?

But, got the same error.

I have added git and cmake in PATH.


the csc compiler is

   C# compiler version 12.0.21005.1
   for C# 5

Any help would be appreciated.

best regards








usa usa

unread,
Apr 29, 2015, 10:18:55 AM4/29/15
to or-tools...@googlegroups.com
Hi,

I  used full path of cmake to replace CMAKE in Makefile.third_party.unix.

In VS2013 x64 cross tools command promot, I ran

      tools/make.exe third_party  

and it can build now and generate configure files in

     dependencies\sources\gflags-2.1.1

But, in the Makefile.third_party.unix

     https://github.com/google/or-tools/blob/master/makefiles/Makefile.third_party.unix

 I got new error:

    line 238:   make -j 4 && \
    lline 239 : make install

    C:\users\mypath\Temp\make112084.sh: line 1 : make command not found.

I replace make with tools/make.exe but got error:

    no targets specified and no makefile found. Stop.

Any help would be appreciated.

Thanks !




   







On Tue, Apr 28, 2015 at 4:04 PM, Laurent Perron <laurent...@gmail.com> wrote:

Laurent Perron

unread,
Apr 29, 2015, 12:04:44 PM4/29/15
to or-tools-discuss

You are on windows, using makefile.unix is an error. You are likely using cygwin which is not supported. You can type make printport. It should report windows.

Thanks

usa usa

unread,
Apr 29, 2015, 12:19:19 PM4/29/15
to or-tools...@googlegroups.com
Hi,

I am working in the

   VS2013 x64 Cross Tools Command Prompt

It should be VS cross compiler. 

I ran the command:

       tools\make.exe -printport | grep SYSTEM

This is the output :

       SYSTEM = unix


I am wondering why it is unix not windows.

Thanks !




usa usa

unread,
Apr 29, 2015, 4:39:47 PM4/29/15
to or-tools...@googlegroups.com
Hi,

How to make sure that I am working on windows ?

Any help would be appreciated.

thanks

Bruno De Backer

unread,
Apr 30, 2015, 11:50:44 AM4/30/15
to or-tools...@googlegroups.com
typing 'ver' on the command line should give you the version of Windows that you are using. 


BdB

usa usa

unread,
Apr 30, 2015, 11:56:51 AM4/30/15
to or-tools...@googlegroups.com
Hi,

The windows version is :

     Miocrosoft Windows [version 6.1.7601]

Why the

     Makefile.third_party.win

cannot be executed by

      tools\make.exe -third_party  ?

I am working in

    "Developer Command Prompt for VS2013".

Any help would be appreciated.

thanks

Bruno De Backer

unread,
Apr 30, 2015, 12:01:15 PM4/30/15
to or-tools...@googlegroups.com
The documentation at https://developers.google.com/optimization/docs/installing says that the command is: 
make third_party 
There is no dash. 

usa usa

unread,
Apr 30, 2015, 12:15:25 PM4/30/15
to or-tools...@googlegroups.com
in or-tools-master/ folder there is no make.exe.

in tools/ folder, there is make.exe.

   make.exe      working swig fix on windows

So, I used it to do the building.

Did I download a wrong zip file ?

Bruno De Backer

unread,
Apr 30, 2015, 12:23:58 PM4/30/15
to or-tools...@googlegroups.com
I meant:
 tools\make.exe third_party 
without a dash before third_party.

usa usa

unread,
Apr 30, 2015, 12:34:26 PM4/30/15
to or-tools...@googlegroups.com
Hi,

Sorry, It is a typo.

This is what I have ran:

E:\or-tools-master>tools\make.exe  third_party -p | grep SYSTEM

SYSTEM = unix
        @echo SYSTEM = $(SYSTEM)

C:\mypath\AppData\Local\Temp\make109764.sh: line 2: syntax error: unexpected end of file

make.exe: *** [dependencies/install/bin/gflags_completions.sh] Error 258

SYSTEM = unix
        @echo SYSTEM = $(SYSTEM)


Any help would be appreciated.

thanks


Laurent Perron

unread,
Apr 30, 2015, 1:34:41 PM4/30/15
to or-tools-discuss

This is not the correct environment.
Do you have a visual studio 2013 64 bit cross compiler in visual studio 2013/tools menu?

--Laurent

PS: I am far from a computer.

usa usa

unread,
Apr 30, 2015, 2:47:11 PM4/30/15
to or-tools...@googlegroups.com
Hi,

No, I do not have this in my VS 2103/tools menu.

May I set it up in "external tools" in the same menu ?

For example,

   %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat""  x64

Does this can give me a 64 bit cross compiler ?


Any help would be appreciated.

Thanks







usa usa

unread,
Apr 30, 2015, 2:58:57 PM4/30/15
to or-tools...@googlegroups.com
Also,

in C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts

I have  Developer Command Prompt for VS2013.

Is this the cross compiler ?

This can be launched by :

      start --> all programs --> visual studio 2013 --> visual studio tools
  
I have tried it before, but it does not work.

Any help would be appreciated.

Thanks

usa usa

unread,
Apr 30, 2015, 4:18:19 PM4/30/15
to or-tools...@googlegroups.com

Hi,

By using the
   %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat""  x64

Now, I got:
     \or-tools-master>tools\make.exe print-SYSTEM
     
SYSTEM = win

But, I cannot get zlib128.zip

E:\or-tools-master>tools\make.exe third_party

tools\wget -P dependencies\archives http://zlib.net/zlib128.zip
--2015-04-30 16:15:17--  http://zlib.net/zlib128.zip

Resolving zlib.net... 69.73.132.10
Connecting to zlib.net|69.73.132.10|:80... failed: Invalid argument.
Retrying.

--2015-04-30 16:15:17--  (try:20)  http://zlib.net/zlib128.zip
Connecting to zlib.net|69.73.132.10|:80... failed: Invalid argument.
Giving up.

tools\make.exe: *** [dependencies\archives\zlib128.zip] Error 1

I used ping

ping 69.73.132.10

Pinging 69.73.132.10 with 32 bytes of data:
Reply from 69.73.132.10: bytes=32 time=36ms TTL=49
Reply from 69.73.132.10: bytes=32 time=35ms TTL=49
Reply from 69.73.132.10: bytes=32 time=35ms TTL=49
Reply from 69.73.132.10: bytes=32 time=35ms TTL=49

Any help would be appreciated.

thanks

usa usa

unread,
May 1, 2015, 10:52:03 AM5/1/15
to or-tools...@googlegroups.com
Hi,

Now I can build it in VS2013 prompt of

     %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat""  x64

But, I got building error:


ValidateSolutionConfiguration:

  Building solution configuration "Release|X64".

  Project "E:\or-tools-master\dependencies\solutions\protobuf.sln" (1) is building "E
:\or-tools-master\dependencies\solutions\libprotobuf.vcxproj" (2) on node 1 (default targets).

   E:\or-tools-master\dependencies\solutions\libprotobuf.vcxproj(1,1): error MSB4025:
  
    The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.

    Done Building Project "E:\or-tools-master\dependencies\solutions\libprotobuf.vcxproj" (default targets) -- FAILED.


In "libprotobuf.vcxproj", line 1 ,  I found that

   ">
        <tr>
          <td class="memname">#define DISALLOW_COPY_AND_ASSIGN          </td>
          <td>(</td>
          <td class="paramtype">TypeName&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

Are there some lines missing at

    ">

here ?

Any help would be appreciated.

Thanks




usa usa

unread,
May 3, 2015, 5:09:06 PM5/3/15
to or-tools...@googlegroups.com
Hi,

Now, I can  run
     $ make third_party

without error.

And, I have also installed jdk at
     C:\\Program Files\\Java\\jdk1.7.0_79

I have updated makefile.local   

 
    WINDOWS_JDK_DIR = C:\\Program Files\\Java\\jdk1.7.0_79
    WINDOWS_PYTHON_VERSION = 27
    WINDOWS_PYTHON_PATH = C:\\Python27

Afterwards, to use python, I installed google-apputils:

  copy dependencies\install\bin\protoc.exe   dependencies\sources\protobuf\src
  cd dependencies/sources/google-apputils
  c:\python27\python.exe setup.py install
  cd dependencies/sources/protobuf/python
  c:\python27\python.exe setup.py build
  c:\python27\python.exe setup.py install
Now, I am trying to Compile libraries. I do not need java lib and examples. So, I changed :

    all: cc python csharp

Then I ran tools\make.exe all, I got error:

link /DLL /LTCG /debug /OUT:lib\\_pywrapcp.dll objs\\swig\\constraint_solver_python_wrap.obj lib\\ortools.lib psapi.lib ws2_32.lib shlwapi.lib C:\\Python27\\libs\\python27.lib

            Microsoft (R) Incremental Linker Version 12.00.21005.1

             Copyright (C) Microsoft Corporation.  All rights reserved.

             Creating library lib\_pywrapcp.lib and object lib\_pywrapcp.exp

             constraint_solver_python_wrap.obj : error LNK2001: unresolved external symbol __imp_PyType_IsSubtype

             constraint_solver_python_wrap.obj : error LNK2001: unresolved external symbol __imp_PyType_Ready

             constraint_solver_python_wrap.obj : error LNK2001: unresolved external symbol __imp_PyObject_GetAttrString

             constraint_solver_python_wrap.obj : error LNK2001: unresolved external symbol __imp_PyObject_HasAttrString

             constraint_solver_python_wrap.obj : error LNK2001: unresolved external symbol __imp_PyObject_GetAttr


             lib\_pywrapcp.dll : fatal error LNK1120: 89 unresolved externals

Laurent Perron

unread,
May 5, 2015, 4:38:56 AM5/5/15
to or-tools-discuss
Did you use the correct arch for the python archive (32 bit or 64 bit)?
Basically, you are not finding any python module, which is strange.

BTW, just run 'make python' instead of modifying the makefile :-)

--Laurent

Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00

usa usa

unread,
May 5, 2015, 1:24:43 PM5/5/15
to or-tools...@googlegroups.com
Hi,

this is my pythonpath:

    PYTHONPATH=C:\Pyton27;C:\Python27\Lib;C:\Python27\libs;C:\Python27\Tools;C:\Python27\include;C:\Python27\DLLs;

Python2.7 is 32 bits

    E:\or-tools-master>C:\Python27\python.exe

       Python 2.7.7 (default, Jun  1 2014, 14:17:13) [MSC v.1500 32 bit (Intel)] on win32
      
        >>> import platform as pl
        >>> pl.platform()
              'Windows-7-6.1'
        >>> pl.architecture()
              ('32bit', 'WindowsPE')


When I ran

    E:\or-tools-master>tools\make.exe python

I gor same error:

       link /DLL /LTCG /debug /OUT:lib\\_pywrapcp.dll objs\\swig\\constraint_solver_python_wrap.obj lib\\ortools.lib psapi.lib
ws2_32.lib shlwapi.lib C:\\Python27\\libs\\python27.lib

       Microsoft (R) Incremental Linker Version 12.00.21005.1

      Creating library lib\_pywrapcp.lib and object lib\_pywrapcp.exp
      constraint_solver_python_wrap.obj : error LNK2001: unresolved external symbol __imp_PyType_IsSubtype
      constraint_solver_python_wrap.obj : error LNK2001: unresolved external symbol __imp_PyType_Ready
      constraint_solver_python_wrap.obj : error LNK2001: unresolved external symbol __imp_PyObject_GetAttrString
      constraint_solver_python_wrap.obj : error LNK2001: unresolved external symbol __imp_PyObject_HasAttrString
      constraint_solver_python_wrap.obj : error LNK2001: unresolved external symbol __imp_PyObject_GetAttr
      constraint_solver_python_wrap.obj : error LNK2001: unresolved external symbol __imp__PyObject_GetDictPtr
      constraint_solver_python_wrap.obj : error LNK2001: unresolved external symbol __imp_PyObject_GenericGetAttr

usa usa

unread,
May 13, 2015, 11:06:22 AM5/13/15
to or-tools...@googlegroups.com
Hi,

I have set up python lib and include as follows:

PYTHONPATH=C:\Pyton27;C:\Python27\Lib;C:\Python27\libs;C:\Python27\Tools;C:\Python27\include;C:\Python27\DLLs;

PYTHON_INCLUDE_DIR=C:\Python27\include

PYTHON_LIBRARY=C:\Python27\libs\python27.lib;C:\Python27\libs


But, I still got the same error.

Any help would be appreciated.

thanks

On Tue, May 5, 2015 at 4:38 AM, 'Laurent Perron' via or-tools-discuss <or-tools...@googlegroups.com> wrote:

Jon Orwant

unread,
May 13, 2015, 11:56:22 AM5/13/15
to or-tools-discuss
FWIW, you have a typo in your PYTHONPATH: "Pyton" should be "Python". 

Jon

usa usa

unread,
May 13, 2015, 12:21:39 PM5/13/15
to or-tools...@googlegroups.com
Thanks,

I have corrected it but got the same error.

Any help would be appreciated.

thanks

usa usa

unread,
May 15, 2015, 11:57:54 AM5/15/15
to or-tools...@googlegroups.com
Hi,

After installing 64 bit python, the problem was gone.

But, when I ran  :

       tools\make.exe test

I got error:



I got a new problem:


from google.apputils import app




On Wed, May 13, 2015 at 11:56 AM, 'Jon Orwant' via or-tools-discuss <or-tools...@googlegroups.com> wrote:

usa usa

unread,
May 15, 2015, 12:10:05 PM5/15/15
to or-tools...@googlegroups.com
Hi,

After installing 64 bit python, the problem was gone.

But, when I ran  :

       tools\make.exe test

I got error:

    File "example\\python\\hidato_table.py", line 17 in <module>
        from google.apputils import app

    Importerror: No module named google.apputils

In E:\or-tools-master\dependencies\sources\google-apputils\google\apputils

I have :
    app.py

   
In E:\or-tools-master\dependencies\sources\google-apputils
I have:
    google_apputils.egg-info

Why app cannot be found in google.apputils  ?

Any help would be appreciated.

thanks
     

On Tue, May 5, 2015 at 4:38 AM, 'Laurent Perron' via or-tools-discuss <or-tools...@googlegroups.com> wrote:

usa usa

unread,
May 19, 2015, 12:12:48 AM5/19/15
to or-tools...@googlegroups.com
Hi,

I have bypassed test for python and only test csharp.
No errors.

Now, I need to add scip lib to a C# project om visual studio 2013.

I cannot find scip.dll and I only have scip.lib in E:\or-tools-master\dependencies\install\lib

In the same directory, I also have soplex.lib.

I have added google.ortools.dll.

Where and how I can find and add scip.dll into a c# peoject ?

Any help would be appreciated.



On Wed, May 13, 2015 at 11:56 AM, 'Jon Orwant' via or-tools-discuss <or-tools...@googlegroups.com> wrote:

Laurent Perron

unread,
May 20, 2015, 12:30:26 PM5/20/15
to or-tools-discuss
No, you don't need to.
Normally, if you run make third_party with the SCIP archive in dependencies/archives, then the library should be included.
The only thing that should be checked is if WINDOWS_SCIP_DIR is correctly set in Makefile.local.

If it is done, then make clean, make all should recompile everything with SCIP support.

Thanks


Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00


usa usa

unread,
May 20, 2015, 1:33:40 PM5/20/15
to or-tools...@googlegroups.com
Hi,

I have set  up

WINDOWS_SCIP_DIR = E:\\or-tools-master\\dependencies\\install

then I ran,

      tools\make.exe clean
      tools\make.exe all

I do not see any compile errors.

I have open the C# solution at

E:\or-tools-master\examples\csharp\solution\CSharp Examples.sln

Then I created a new C# project in the solution and I added Google.OrTools as a reference lib.

But, I cannot find the functions that should be available in SCIP.

Otherwise, how can I know that API functions that SCIP provide so that i can use them to solve models ?

   e.g.    scip.solve ( my_model) //  where is scip.solve or something like that ?

Any help would be appreciated.

thanks



Mark

unread,
May 20, 2015, 2:34:41 PM5/20/15
to or-tools...@googlegroups.com
You don't use SCIP directly, you use the ORTools linear programming API and choose SCIP as the backend solver.
For example, to use CBC as the solver I would use the line:
Solver solver__1 = new Solver("My Problem Name", Solver.CBC_MIXED_INTEGER_PROGRAMMING);

If you have SCIP installed correctly, there will be an equivalent value for SCIP.

If you want to pass specific arguments to the SCIP solver, there is a method that allows you to pass the argument name and its value (as strings I believe).  I think it was called solver_specific_params or something like that.
I'm just going off of memory.  I know I ran into issues trying to use that method from C# as well, but that was a few months ago and there may now be additional support for it.

usa usa

unread,
May 20, 2015, 3:03:24 PM5/20/15
to or-tools...@googlegroups.com, slash...@gmail.com
Hi,

Thanks for your reply.

I would like to run some C3 examples at first.

I have open the C# solution at

E:\or-tools-master\examples\csharp\solution\CSharp Examples.sln


No build error.

But, I gor run-time error when I tried to run :

 static void Main()
  {
    Console.WriteLine("---- Linear programming example with GLOP ----");
    RunLinearProgrammingExample("GLOP_LINEAR_PROGRAMMING");

}

An unhandled exception of type 'System.BadImageFormatException' occurred in LinearProgramming.exe

Additional information: Could not load file or assembly 'Google.OrTools, Version=2.0.1.22075, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Any help would be appreciated.

David

Reply all
Reply to author
Forward
0 new messages