coin-or-tools / ThirdParty-ASL

COIN-OR autotools harness to build AMPL Solver Library
Eclipse Public License 1.0
5 stars 6 forks source link

windows msys2 build: lt-arithchk.c:318:25: error: '_P_WAIT' undeclared (first use in this function) #3

Closed h-g-s closed 3 years ago

h-g-s commented 4 years ago

I am trying to build Cbc using msys2 on Windows, as detailed in the guide (https://coin-or.github.io/user_introduction.html#) .

After trying: ./coinbrew/coinbrew build Cbc@master --enable-debug --prefix=/home/danid/prog --no-prompt --enable-cbc-parallel --tests=none --build=x86_64-w64-mingw32

I got an error while building ASL: ##################################################

Building ThirdParty/ASL master

##################################################

./.libs/lt-arithchk.c: In function 'main': ./.libs/lt-arithchk.c:318:16: warning: implicit declaration of function '_spawnv' [-Wimplicit-function-declaration] 318 | rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char const ) newargz); | ^~~ ./.libs/lt-arithchk.c:318:25: error: '_P_WAIT' undeclared (first use in this function) 318 | rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char const ) newargz); | ^~~ ./.libs/lt-arithchk.c:318:25: note: each undeclared identifier is reported only once for each function it appears in strip: './arithchk.exe': No such file ./libtool: line 11068: ./arithchk.exe: No such file or directory /bin/sh: ./arithchk.exe: No such file or directory make: *** [Makefile:1351: arith.h] Error 127

I installed the dependencies cited in the guide and checked the ones listed in travis, could this be a GCC 10 problem ?

tkralphs commented 4 years ago

Appveyor would be the place to look for the successful MSys2 builds. I'm experimenting with MinGW builds on Travis, but so far, no dice. Did you Google around about this? Googling a little, I found some leads. It builds fine on my machine with the exact same command line as you. Are you sure you have GCC 10? That's not what you get if you just install gcc with pacman.

svigerske commented 4 years ago

That doesn't look like a compiler issue. Maybe there was a libc update that removed _spawnv. Given the leading underscore, I doubt that code was meant to actually call this function, so it was prone to break some day? Or it's just an include that is missing.

But I also don't have a line 318 in the arithchk.c of my version of asl. Did you (or did coinbrew for you) get the ASL source from www.coin-or.org or ampl.com ?

PS: May be good to figure out first where .libs/lt-arithchk.c comes from. How was that created (make V=1)?

h-g-s commented 4 years ago

That doesn't look like a compiler issue. Maybe there was a libc update that removed _spawnv. Given the leading underscore, I doubt that code was meant to actually call this function, so it was prone to break some day? Or it's just an include that is missing. But I also don't have a line 318 in the arithchk.c of my version of asl. Did you (or did coinbrew for you) get the ASL source from www.coin-or.org or ampl.com ?

Running coinbrew it seems that it downloads from www.coin-or.org, searched in the coinbrew script but this address does not appears there, maybe it is in the ASL scripts ? The log of coinbrew fetch:

##################################################

Fetching ThirdParty/ASL master

##################################################

Cloning into 'ThirdParty/ASL'... remote: Enumerating objects: 120, done. remote: Counting objects: 100% (120/120), done. remote: Compressing objects: 100% (82/82), done. remote: Total 1244 (delta 69), reused 79 (delta 38), pack-reused 1124 Receiving objects: 100% (1244/1244), 3.64 MiB | 772.00 KiB/s, done. Resolving deltas: 100% (808/808), done.

Running script for downloading the source code for the ASL

Downloading the source code from www.coin-or.org... --2020-06-04 13:34:42-- https://www.coin-or.org/BuildTools/ASL/solvers-64919f75f.tgz

Should it download from ASL ?

PS: May be good to figure out first where .libs/lt-arithchk.c comes from. How was that created (make V=1)?

h-g-s commented 4 years ago

Checked here, yes, it is gcc 9.3.

svigerske commented 4 years ago

Downloading from www.coin-or.org is good. That gives a version we know about. The download from ampl.com is a fallback and then you will get whatever they've put there.

tkralphs commented 4 years ago

We distribute ASL ourselves for reasons we can get into in another forum, but I am a little confused because it should be downloading from https://coin-or-tools.github.io/ThirdParty-ASL/. I thought I changed it to that.

tkralphs commented 4 years ago

In any case, it is still the same archive, so that is a red herring. If you Google a little, you find that _spawnv is a function in the Microsoft run-time. I think the answer to this could be found by following some threads related to that, but I would prefer not to get sucked into this.

By the way, I mis-spoke, the gcc version in my local Msys2 is actually 10 and ASL builds fine.

tkralphs commented 4 years ago

If you look at Makefile.am and .libs/lt-arithchk.c a bit, you should be able to tease out what's happening. Looks like there should be a work-around. It's a bit weird how things are being done.

tkralphs commented 4 years ago

Hmm, I guess we never actually switched to pointing to https://coin-or-tools.github.io/ThirdParty-ASL/. Any reason not to @svigerske?

svigerske commented 4 years ago

It doesn't really matter, since https://www.coin-or.org/BuildTools/ASL is just forwarded to https://coin-or-tools.github.io/ThirdParty-ASL/

A full log:

$ ./get.ASL 

Running script for downloading the source code for the ASL

Downloading the source code from www.coin-or.org...
--2020-06-04 16:28:32--  https://www.coin-or.org/BuildTools/ASL/solvers-64919f75f.tgz
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving www.coin-or.org (www.coin-or.org)... 130.127.206.21
Connecting to www.coin-or.org (www.coin-or.org)|130.127.206.21|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://coin-or-tools.github.io/ThirdParty-ASL/solvers-64919f75f.tgz [following]
--2020-06-04 16:28:32--  https://coin-or-tools.github.io/ThirdParty-ASL/solvers-64919f75f.tgz
Resolving coin-or-tools.github.io (coin-or-tools.github.io)... 185.199.111.153, 185.199.109.153, 185.199.110.153, ...
Connecting to coin-or-tools.github.io (coin-or-tools.github.io)|185.199.111.153|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 360043 (352K) [application/octet-stream]
Saving to: ‘solvers-64919f75f.tgz’

solvers-64919f75f.tgz                     100%[====================================================================================>] 351.60K  --.-KB/s    in 0.1s    

2020-06-04 16:28:33 (3.03 MB/s) - ‘solvers-64919f75f.tgz’ saved [360043/360043]

Download finished.
Unpacking the source code...
Applying patches
patching file solvers/fpinitmt.c
patching file solvers/dtoa1.c
Deleting the tar file...

Done downloading the source code for ASL.

So should be ok to "actually switch".

tkralphs commented 4 years ago

Ah, OK, didn't catch that.

svigerske commented 3 years ago

As we couldn't reproduce this and haven't heard back from the reporter after requested to "to tease out what's happening", I'm closing this.