Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Msys2 MinGW64 compilation #34

Open
Lucarda opened this issue Nov 22, 2019 · 18 comments · May be fixed by #37
Open

Msys2 MinGW64 compilation #34

Lucarda opened this issue Nov 22, 2019 · 18 comments · May be fixed by #37

Comments

@Lucarda
Copy link

Lucarda commented Nov 22, 2019

Hi,

I'm trying to compile the Pd objects for windows 64 bit. No hurries :)

I do and get:

Lucarda@T410 MINGW64 /d/00-volatil/jsusfx/pd
$ cmake -G "MSYS Makefiles" -D CMAKE_C_COMPILER=D:/msys64/mingw64/bin/gcc.exe -D CMAKE_CXX_COMPILER=D:/msys64/mingw64/bin/g++.exe .
-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Check for working C compiler: D:/msys64/mingw64/bin/gcc.exe
-- Check for working C compiler: D:/msys64/mingw64/bin/gcc.exe -- 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: D:/msys64/mingw64/bin/g++.exe
-- Check for working CXX compiler: D:/msys64/mingw64/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: D:/00-volatil/jsusfx/pd

Lucarda@T410 MINGW64 /d/00-volatil/jsusfx/pd
$ make install
Scanning dependencies of target jsusfx
[  7%] Building CXX object D:/00-volatil/jsusfx/src/CMakeFiles/jsusfx.dir/jsusfx.cpp.obj
In file included from D:/00-volatil/jsusfx/src/jsusfx.cpp:19:
D:/00-volatil/jsusfx/src/jsusfx_file.h:128:19: warning: ignoring attributes on template argument 'EEL_F' {aka 'double'} [-Wignored-attributes]
  128 |  std::vector<EEL_F> vars;
      |                   ^
[ 14%] Building CXX object D:/00-volatil/jsusfx/src/CMakeFiles/jsusfx.dir/jsusfx_file.cpp.obj
In file included from D:/00-volatil/jsusfx/src/jsusfx_file.cpp:18:
D:/00-volatil/jsusfx/src/jsusfx_file.h:128:19: warning: ignoring attributes on template argument 'EEL_F' {aka 'double'} [-Wignored-attributes]
  128 |  std::vector<EEL_F> vars;
      |                   ^
[ 21%] Building CXX object D:/00-volatil/jsusfx/src/CMakeFiles/jsusfx.dir/jsusfx_gfx.cpp.obj
[ 28%] Building CXX object D:/00-volatil/jsusfx/src/CMakeFiles/jsusfx.dir/jsusfx_serialize.cpp.obj
[ 35%] Building CXX object D:/00-volatil/jsusfx/src/CMakeFiles/jsusfx.dir/riff.cpp.obj
[ 42%] Building C object D:/00-volatil/jsusfx/src/CMakeFiles/jsusfx.dir/WDL/eel2/nseel-compiler.c.obj
[ 50%] Building C object D:/00-volatil/jsusfx/src/CMakeFiles/jsusfx.dir/WDL/eel2/nseel-eval.c.obj
[ 57%] Building C object D:/00-volatil/jsusfx/src/CMakeFiles/jsusfx.dir/WDL/eel2/nseel-ram.c.obj
[ 64%] Building C object D:/00-volatil/jsusfx/src/CMakeFiles/jsusfx.dir/WDL/eel2/nseel-yylex.c.obj
[ 71%] Building C object D:/00-volatil/jsusfx/src/CMakeFiles/jsusfx.dir/WDL/eel2/nseel-cfunc.c.obj
D:\msys64\tmp\ccQYJwpg.s: Assembler messages:
D:\msys64\tmp\ccQYJwpg.s:263: Error: operand type mismatch for `call'
D:\msys64\tmp\ccQYJwpg.s:304: Error: operand type mismatch for `call'
D:\msys64\tmp\ccQYJwpg.s:344: Error: invalid instruction suffix for `push'
D:\msys64\tmp\ccQYJwpg.s:345: Error: invalid instruction suffix for `push'
D:\msys64\tmp\ccQYJwpg.s:346: Error: operand type mismatch for `call'
D:\msys64\tmp\ccQYJwpg.s:431: Error: operand type mismatch for `fmul'
D:\msys64\tmp\ccQYJwpg.s:438: Error: operand type mismatch for `fadd'
D:\msys64\tmp\ccQYJwpg.s:475: Warning: translating to `fstp %st(0)'
D:\msys64\tmp\ccQYJwpg.s:978: Warning: translating to `faddp'
D:\msys64\tmp\ccQYJwpg.s:1099: Warning: translating to `fsubrp'
D:\msys64\tmp\ccQYJwpg.s:1220: Warning: translating to `fmulp'
D:\msys64\tmp\ccQYJwpg.s:1341: Warning: translating to `fdivrp'
D:\msys64\tmp\ccQYJwpg.s:1378: Warning: translating to `fdivp'
D:\msys64\tmp\ccQYJwpg.s:1426: Warning: translating to `fdivp'
D:\msys64\tmp\ccQYJwpg.s:2105: Error: operand type mismatch for `call'
D:\msys64\tmp\ccQYJwpg.s:2146: Error: operand type mismatch for `call'
D:\msys64\tmp\ccQYJwpg.s:2188: Error: operand type mismatch for `call'
D:\msys64\tmp\ccQYJwpg.s:2226: Warning: translating to `fsubp'
D:\msys64\tmp\ccQYJwpg.s:2351: Warning: translating to `fsubp'
D:\msys64\tmp\ccQYJwpg.s:2763: Error: invalid instruction suffix for `push'
D:\msys64\tmp\ccQYJwpg.s:2764: Error: invalid instruction suffix for `push'
D:\msys64\tmp\ccQYJwpg.s:2766: Error: invalid instruction suffix for `push'
D:\msys64\tmp\ccQYJwpg.s:2767: Error: invalid instruction suffix for `push'
D:\msys64\tmp\ccQYJwpg.s:2768: Error: operand type mismatch for `call'
D:\msys64\tmp\ccQYJwpg.s:2812: Error: operand type mismatch for `call'
D:\msys64\tmp\ccQYJwpg.s:2852: Error: invalid instruction suffix for `push'
D:\msys64\tmp\ccQYJwpg.s:2853: Error: invalid instruction suffix for `push'
D:\msys64\tmp\ccQYJwpg.s:2854: Error: invalid instruction suffix for `push'
D:\msys64\tmp\ccQYJwpg.s:2855: Error: operand type mismatch for `call'
D:\msys64\tmp\ccQYJwpg.s:2898: Error: operand type mismatch for `call'
D:\msys64\tmp\ccQYJwpg.s:2938: Error: invalid instruction suffix for `push'
D:\msys64\tmp\ccQYJwpg.s:2939: Error: invalid instruction suffix for `push'
D:\msys64\tmp\ccQYJwpg.s:2940: Error: operand type mismatch for `call'
D:\msys64\tmp\ccQYJwpg.s:2982: Error: operand type mismatch for `call'
D:\msys64\tmp\ccQYJwpg.s:3033: Error: invalid instruction suffix for `push'
D:\msys64\tmp\ccQYJwpg.s:3034: Error: invalid instruction suffix for `push'
D:\msys64\tmp\ccQYJwpg.s:3035: Error: operand type mismatch for `call'
D:\msys64\tmp\ccQYJwpg.s:3082: Error: operand type mismatch for `call'
make[2]: *** [/D/00-volatil/jsusfx/src/CMakeFiles/jsusfx.dir/build.make:180: D:/00-volatil/jsusfx/src/CMakeFiles/jsusfx.dir/WDL/eel2/nseel-cfunc.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:127: D:/00-volatil/jsusfx/src/CMakeFiles/jsusfx.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

?

@jpcima jpcima linked a pull request Oct 7, 2021 that will close this issue
@jpcima
Copy link

jpcima commented Oct 7, 2021

@Lucarda it's been a long time since the request, but perhaps you can check if my PR #37 fixes this problem?

@Lucarda
Copy link
Author

Lucarda commented Oct 7, 2021

I did a quick test but now I got:

$ make install
[  6%] Generating WDL/eel2/asm-nseel-x64.obj
/bin/sh: php: command not found
make[2]: *** [/E/git-portable/jsusfx/src/CMakeFiles/jsusfx.dir/build.make:62: E:/git-portable/jsusfx/src/WDL/eel2/asm-nseel-x64.obj] Error 127
make[1]: *** [CMakeFiles/Makefile2:126: E:/git-portable/jsusfx/src/CMakeFiles/jsusfx.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

I don't have php. Never had it. Not sure how to install it.

@jpcima
Copy link

jpcima commented Oct 7, 2021

Hmm right msys doesn't have it. I did because I make a cross-compilation based on linux.
It'd be nice if jsusfx would allow to use the prebuilts, then it would require neither php nor nasm to build.

I'll make some work towards that in a branch. Another thing is that the upstream has received support of ARM64.
While at it, I consider adding this support, and also universal binary.

@Lucarda
Copy link
Author

Lucarda commented Oct 7, 2021

Let me know when ready for another test.
:)

@jpcima
Copy link

jpcima commented Oct 9, 2021

@Lucarda
You could give my current fork a try, it drops the php requirement.
https://github.com/jpcima/jsusfx

@Lucarda
Copy link
Author

Lucarda commented Oct 9, 2021

I'm getting this:

cmake -G "MSYS Makefiles" -D CMAKE_C_COMPILER=G:/msys64/mingw64/bin/gcc.exe -D CMAKE_CXX_COMPILER=G:/msys64/mingw64/bin/g++.exe .

make install

...
[ 85%] Linking CXX static library libjsusfx.a
[ 85%] Built target jsusfx
Scanning dependencies of target jsusfx_pd_project
[ 92%] Building CXX object CMakeFiles/jsusfx_pd_project.dir/jsusfx_pd.cpp.obj
g++.exe: error: G:/msys64/DPD_LONGINTTYPE=long long: No such file or directory
make[2]: *** [CMakeFiles/jsusfx_pd_project.dir/build.make:63: CMakeFiles/jsusfx_pd_project.dir/jsusfx_pd.cpp.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:77: CMakeFiles/jsusfx_pd_project.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

could g++.exe: error: G:/msys64/DPD_LONGINTTYPE=long long: No such file or directory

be replaced with:
-DPD_LONGINTTYPE=__int64
somewhere?

https://github.com/pure-data/pd-lib-builder/blob/master/Makefile.pdlibbuilder#L579

@Lucarda
Copy link
Author

Lucarda commented Oct 9, 2021

If i'm correct the pd.build part is not supposed to work under MINGW but on MSVC.

https://github.com/pierreguillot/pd.build/blob/674c969e39ad3e8fbd38f344488c8bac3667ce6e/pd.cmake#L53

@jpcima
Copy link

jpcima commented Oct 9, 2021

Perhaps it helps to replace "/D" with "-D" on that exact line.

@Lucarda
Copy link
Author

Lucarda commented Oct 9, 2021

I have done that and suppressed:

	# Generate the function to export for Windows
	#if(${WIN32})
	#	string(REPLACE "~" "_tilde" EXPORT_FUNCTION "${EXTERNAL_NAME}_setup")
	#	set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS #"/export:${EXPORT_FUNCTION}")
	#endif()

in pd.cmake.

Now I got undefined reference .. in the linking stage. On Windows we link to pd[.lib][.dll] and in this case had to link to libjsusfx~.dll.a ?

Dont know how to do that in Cmake.

ff1

@jpcima
Copy link

jpcima commented Oct 9, 2021

It will need a mingw alternative to that part your commented.
It's that one that lets the dll know that these missing symbols would be found inside pd.exe.

But that part of pd.build is msvc-only. Perhaps you can make something of my external builder which has mingw support. mingw's dlltool can serve to change a def file into an implib.
https://github.com/jpcima/pd-externals/blob/9fe8bbaaff32200e613b5cc6ee8c3a6823eac2ea/cmake/PdExternal.cmake#L13-L30

@Lucarda
Copy link
Author

Lucarda commented Oct 9, 2021

would be found inside pd.exe.

In the current build system Pd symbols are found in pd.build/x64/ in the pd.lib and for MSVC also on pd.def

MINGW is happy finding the symbols in pd.dll (this is how is done with pd-lib-builder.)

@Lucarda
Copy link
Author

Lucarda commented Oct 9, 2021

This is how the linking is done in pd-lib-builder

https://github.com/pure-data/pd-lib-builder/blob/master/Makefile.pdlibbuilder#L590

@Lucarda
Copy link
Author

Lucarda commented Oct 9, 2021

If i'm not mistaken MINGW can statically link to an .a file.

@jpcima
Copy link

jpcima commented Oct 9, 2021

Yes that's what the code would produce, a linkable .a file. You can make these by command-line too

x86_64-w64-mingw32-dlltool -l x64/libpd.dll.a x64/pd.def
i686-w64-mingw32-dlltool -l x86/libpd.dll.a x86/pd.def

@Lucarda
Copy link
Author

Lucarda commented Oct 9, 2021

I got the libjsusfx~.dll.a file. MINGW needs to link jsusfx~.dll with that and pd.lib.
Is the above correct?

@Lucarda
Copy link
Author

Lucarda commented Oct 9, 2021

I tried to build it with https://github.com/pure-data/pd-lib-builder and it went really good with this makefile:

# library name
lib.name = jsusfx~

CPPFLAGS += -DEEL_TARGET_PORTABLE=1 -DWDL_FFT_REALSIZE=8 -I./src -I./src/WDL -I./src/WDL/eel2 -I./pd

common.sources = \
src/jsusfx.cpp \
src/jsusfx_file.cpp \
src/jsusfx_gfx.cpp \
src/jsusfx_serialize.cpp \
src/riff.cpp \
src/WDL/eel2/nseel-compiler.c \
src/WDL/eel2/nseel-eval.c \
src/WDL/eel2/nseel-ram.c \
src/WDL/eel2/nseel-yylex.c \
src/WDL/eel2/nseel-cfunc.c \
src/WDL/fft.c \




jsusfx~.class.sources = \
pd/jsusfx_pd.cpp \

datafiles = \



# include Makefile.pdlibbuilder
# (for real-world projects see the "Project Management" section
# in tips-tricks.md)
PDLIBBUILDER_DIR=./pd-lib-builder
include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder

May be the -I includes are not necessary.

I can upload here the binary for Windows64. Seems to be working fine here.

@snobbiggie
Copy link

I can upload here the binary for Windows64. Seems to be working fine here.

Is that an ongoing offer, perchance?

@Lucarda
Copy link
Author

Lucarda commented Aug 13, 2023

Is that an ongoing offer, perchance?

no.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants