ampl / mp

An open-source library for mathematical programming
https://mp.ampl.com
Other
226 stars 43 forks source link

building from source on solaris #88

Closed gidden closed 8 years ago

gidden commented 8 years ago

From a fresh clone, I get the following:

t501:giddcmake .. -DCMAKE_PREFIX_PATH=$HOME/.local && make
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- System: SunOS-5.11
-- Build type: Release
-- Compiler version: 4.8.2
-- Performing Test HAVE_STD_CPP11_FLAG
-- Performing Test HAVE_STD_CPP11_FLAG - Success
-- Performing Test HAVE_UNIQUE_PTR
-- Performing Test HAVE_UNIQUE_PTR - Success
-- Performing Test HAVE_ATOMIC
-- Performing Test HAVE_ATOMIC - Success
-- Performing Test HAVE_HASH
-- Performing Test HAVE_HASH - Success
-- Performing Test MP_VARIADIC_TEMPLATES
-- Performing Test MP_VARIADIC_TEMPLATES - Success
-- Target doc disabled (requires doxygen)
-- Looking for mkstemps
-- Looking for mkstemps - found
-- Looking for strtoull
-- Looking for strtoull - found
-- Looking for dlopen in dl
-- Looking for dlopen in dl - found
-- Looking for getrusage
-- Looking for getrusage - found
-- Could NOT find MATLAB (missing:  MATLAB_MEX)
-- Performing Test supports_flag
-- Performing Test supports_flag - Success
-- Could NOT find ODBC (missing:  ODBC_INCLUDE_DIR)
-- Module cplex disabled
-- Module gecode disabled
-- Module ilogcp disabled
-- Module jacop disabled
-- Module localsolver disabled
-- Module path disabled
-- Module smpswriter disabled
-- Module sulum disabled
-- Module gsl disabled
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Performing Test MP_INITIALIZER_LISTS
-- Performing Test MP_INITIALIZER_LISTS - Success
-- Performing Test MP_THREAD
-- Performing Test MP_THREAD - Success
-- Could NOT find ODBC (missing:  ODBC_INCLUDE_DIR)
-- Configuring done
-- Generating done
-- Build files have been written to: /h/u045/gidden/software/mp/build
Scanning dependencies of target format
[  0%] Building CXX object CMakeFiles/format.dir/src/format.cc.o
[  1%] Building CXX object CMakeFiles/format.dir/src/posix.cc.o
[  1%] Built target format
Scanning dependencies of target gen-expr-info
[  2%] Building CXX object CMakeFiles/gen-expr-info.dir/src/gen-expr-info.cc.o
[  2%] Linking CXX executable bin/gen-expr-info
[  2%] Built target gen-expr-info
[  2%] Generating ../src/expr-info.cc
Scanning dependencies of target mp
[  3%] Building CXX object CMakeFiles/mp.dir/src/clock.cc.o
[  3%] Building CXX object CMakeFiles/mp.dir/src/expr.cc.o
[  4%] Building CXX object CMakeFiles/mp.dir/src/nl-reader.cc.o
In file included from /h/u045/gidden/software/mp/src/nl-reader.cc:23:0:
/h/u045/gidden/software/mp/include/mp/nl-reader.h:1074:29: error: expected type-specifier
 template <typename Locale = fmt::Locale>
                             ^
/h/u045/gidden/software/mp/include/mp/nl-reader.h:1074:29: error: expected ‘>’
/h/u045/gidden/software/mp/include/mp/nl-reader.h:2141:28: error: template argument 1 is invalid
 void ReadBinary(TextReader<> &reader, const NLHeader &header,
                            ^
/h/u045/gidden/software/mp/include/mp/nl-reader.h: In function ‘void mp::ReadNLString(mp::NLStringRef, Handler&, fmt::CStringRef, int)’:
/h/u045/gidden/software/mp/include/mp/nl-reader.h:2206:24: error: template argument 1 is invalid
   internal::TextReader<> reader(str, name);
                        ^
/h/u045/gidden/software/mp/include/mp/nl-reader.h:2206:32: error: invalid type in declaration before ‘(’ token
   internal::TextReader<> reader(str, name);
                                ^
/h/u045/gidden/software/mp/include/mp/nl-reader.h:2206:42: error: expression list treated as compound expression in initializer [-fpermissive]
   internal::TextReader<> reader(str, name);
                                          ^
/h/u045/gidden/software/mp/include/mp/nl-reader.h:2208:10: error: request for member ‘ReadHeader’ in ‘reader’, which is of non-class type ‘int’
   reader.ReadHeader(header);
          ^
/h/u045/gidden/software/mp/include/mp/nl-reader.h:2212:45: error: template argument 1 is invalid
     internal::NLReader<internal::TextReader<>, Handler>(
                                             ^
/h/u045/gidden/software/mp/include/mp/nl-reader.h:2212:55: error: template argument 1 is invalid
     internal::NLReader<internal::TextReader<>, Handler>(
                                                       ^
/h/u045/gidden/software/mp/src/nl-reader.cc: At global scope:
/h/u045/gidden/software/mp/src/nl-reader.cc:305:41: error: template argument 1 is invalid
 template class mp::internal::TextReader<>;
                                         ^
*** Error code 1
The following command caused the error:
/usr/bin/g++   -DMP_DATE=20141202 -DMP_SYSINFO="\"SunOS sparc\"" -DMP_USE_ATOMIC -DMP_USE_HASH -DMP_USE_UNIQUE_PTR -I/h/u045/gidden/software/mp/include -I/h/u045/gidden/software/mp/src -std=c++11 -Wall -Wextra -pedantic -O3 -DNDEBUG -fPIC -o CMakeFiles/mp.dir/src/nl-reader.cc.o -c /h/u045/gidden/software/mp/src/nl-reader.cc
make: Fatal error: Command failed for target `CMakeFiles/mp.dir/src/nl-reader.cc.o'
Current working directory /h/u045/gidden/software/mp/build
*** Error code 1
The following command caused the error:
make -f CMakeFiles/mp.dir/build.make CMakeFiles/mp.dir/build
make: Fatal error: Command failed for target `CMakeFiles/mp.dir/all'
Current working directory /h/u045/gidden/software/mp/build
*** Error code 1
The following command caused the error:
make -f CMakeFiles/Makefile2 all
make: Fatal error: Command failed for target `all'

The answer for this could be super simple, if you point me in a direction, I can keep searching.

vitaut commented 8 years ago

Does Solaris have newlocale and strtod_l?

vitaut commented 8 years ago

And which version of Solaris do you use?

gidden commented 8 years ago
> uname -a
SunOS t501 5.11 11.3 sun4v sparc sun4v

and not sure about newlocale and strtod_l.. I'll dig into it

vitaut commented 8 years ago

Nevermind about newlocale. I've implemented a workaround in https://github.com/ampl/mp/commit/e94d538d77e9c85e08f6b2a9558d146e12dc2d8f.

gidden commented 8 years ago

This can be closed once #89 is resolved. Your work around fixed the locale issue, thanks @vitaut!

vitaut commented 8 years ago

Hey, @gidden. Could you confirm that it works for you now?

gidden commented 8 years ago

Hi @vitaut, can confim a positive build and install. There are tests failures that I logged in #89.

vitaut commented 8 years ago

Looks like all the test failures have the same cause, unimplemented GetExecutablePath on Solaris. This should be fixed in https://github.com/ampl/mp/commit/beac4b29486fb1d5136e9402d5555fdfbc815e5c but I haven't tested it because I don't have a Solaris system readily available.

Also to make sure that the funcadd1.c fix is portable, could you please provide the following info:

  1. Compiler version
  2. The output of

    cpp -dM /dev/null

    (or the equivalent on your system: the point is to see what #defines are built into the C preprocessor)

  3. The funcadd1.i you get by invoking

    gcc -E funcadd1.c >funcadd1.i

    (I suggest posting the latter as an attachment because it can be quite big.)

Thanks!

vitaut commented 8 years ago

I'm closing this issue because it should be fixed now, but feel free to reopen if you get any compile/test errors on your system.

gidden commented 8 years ago

Just following up on your questions:

  1. gcc/g++ version
t501:gidden> gcc --version
gcc (GCC) 4.8.2
  1. macros
t501:gidden> cc -xdumpmacros -E /dev/null
#define __LINE__
#define __FILE__
#define __STDC__ 0
#define __STDC_VERSION__ 199409L
#define __DATE__ "Mar 17 2016"
#define __TIME__ "09:37:29"
#define __STDC_IEC_559__ 1
#define __STDC_IEC_559_COMPLEX__ 1
#define __STDC_HOSTED__ 1
#define __STDC_ANALYZABLE__ 1
#define __STDC_NO_ATOMICS__ 1
#define __STDC_NO_THREADS__ 1
#define __has_attribute (attr) ___has_attribute___ ( attr )
#define __SunOS_5_11 1
#define __SUNPRO_C 0x5130
#define __unix 1
#define __SVR4 1
#define __sun 1
#define __SunOS 1
#define __sparcv8 1
#define __sparc 1
#define __BUILTIN_VA_ARG_INCR 1
#define __C11FEATURES__ 1
#define __C99FEATURES__ 1
#define __PRAGMA_REDEFINE_EXTNAME 1
#define unix 1
#define sun 1
#define sparc 1
#define __RESTRICT 1
#define __FLT_EVAL_METHOD__ 0
#define __SUN_PREFETCH 1
#define __NOVECTORSIZE__ 1
# 1 "/dev/null"
#ident "acomp: Sun C 5.13 SunOS_sparc 2014/10/20"
  1. I get an error
t501:gidden> gcc -E funcadd1.c  > funcadd1.i
In file included from funcadd1.c:52:0:
funcadd.h:27:52: fatal error: stdio1.h: No such file or directory
 #include "stdio1.h" /* for ANSI and any printing */
                                                    ^
compilation terminated.
vitaut commented 8 years ago

Thanks!