vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
982 stars 118 forks source link

Building FORM failed by passing `Windows API` option #463

Closed TaiXeflar closed 6 months ago

TaiXeflar commented 7 months ago

I'm trying to make FORM by doing configure with this command in Cygwin environment:

./configure --prefix='/cygdrive/c/FORM' --with-api='windows'

The configuration was success but execute make command and returns make error:(No need to care about Traditional Chinese)

collect2: 錯誤:ld 回傳 1
make[1]: *** [Makefile:951: form.exe] 錯誤 1
make[1]: 離開目錄「/cygdrive/c/Users/TaiXeflar/Desktop/Form/form_x_cyg/sources」
make: *** [Makefile:405: check-recursive] 錯誤 1

Idk whether is somewhere link error or anything else wrong. Is --with-api=windows option not works? Also can I ask if I can select compilers like MSVC by passing some prefix?

Here's full command here:

autoreconf -i
./configure --prefix='/cygdrive/c/FORM' --with-api='windows'
make check

Thanks

tueda commented 7 months ago

The Windows API is not officially supported, and not well tested, in particular on the master branch. But at least it (partially) works on the 4.3 branch with Mingw-w64 tools (see also the Deploy Action). You can select the compilers by, for example, CC=/path/to/cc and CXX=/path/to/c++ in the configuration.

Though you have not shown the link error message, my first guess is that you need to follow the Cygwin FAQ: 6.12. How do I use Windows API calls?. Namely, you may need to explicitly link required libraries, which can be done by using LIBS=-lmissinglibrary etc. in the configuration.

TaiXeflar commented 6 months ago

I've folled windows API calls solution and have cross test on both Cygwin and MSYS2(UCRT, MINGW64). Then I use 4.2 version to make It.

Here's the command line:

autoreconf -i
./configure --prefix="C:/Developer/opt/form/4.2" --with-api="windows"
make

And it returns error like this:

diagrams.c: At top level:
diagrams.c:639:5: error: conflicting types for 'DoShattering'; have 'int(FORM_WORD *, FORM_WORD **, FORM_WORD *, FORM_WORD)' {aka 'int(int *, int **, int *, int)'}
  639 | int DoShattering(PHEAD WORD *connect, WORD *environ, WORD *partitions, WORD nvert)
      |     ^~~~~~~~~~~~
declare.h:534:15: note: previous declaration of 'DoShattering' with type 'int(FORM_WORD *, FORM_WORD *, FORM_WORD *, FORM_WORD)' {aka 'int(int *, int *, int *, int)'}
  534 | extern int    DoShattering(PHEAD WORD *,WORD *,WORD *,WORD);
      |               ^~~~~~~~~~~~
make[2]: *** [Makefile:1397: form-diagrams.o] Error 1
make[2]: Leaving directory '/c/Users/TaiXeflar/Desktop/MAKE/form-4.2.1/sources'
make[1]: *** [Makefile:404: all-recursive] Error 1
make[1]: Leaving directory '/c/Users/TaiXeflar/Desktop/MAKE/form-4.2.1'
make: *** [Makefile:345: all] Error 2
tueda commented 6 months ago

I am not sure why you are using the old 4.2 source, but please use >= 4.3.0 or pick up this patch: https://github.com/vermaseren/form/commit/07ea6e9609a6cfed011b15d5ecc99c08bb683ce5

TaiXeflar commented 6 months ago

Thanks. I re-used 4.3.1 version source code and run make successfully.