skjelten / emusc

A software synthesizer emulating the Sound Canvas SC-55 lineup
GNU General Public License v3.0
195 stars 15 forks source link

Unable to compile the library with makefiles or msys2 #15

Closed ThatRetroGuy closed 1 year ago

ThatRetroGuy commented 1 year ago

How would someone need to be compiling the emulator in this new form?, have tried on getting this recent build compiled, neither of these two seem to work, any idea?

skjelten commented 1 year ago

In which build environment and operating system are you trying to build [lib]emusc? If you are on windows I would try msys2 (I have not tried this myself, but it seems like a viable option). On Linux & macOS it should be pretty straight forward.

That said, if you managed to compile the old emusc code, the new code base should not be any harder (except from the QT dependencies for emusc). If the configure script or compiler gives you any error messages please paste them here and I'll try to help you.

Edit: I see in the title after I posted my response that you already use msys2 (and therefore windows). Please post any error messages and we'll so how to fix you problem

Kappa971 commented 1 year ago

This problem https://github.com/skjelten/emusc/issues/5 has been solved?

trevor0402 commented 1 year ago

I'm trying to compile this new version but keep getting this error. configure: error: libEmuSC library is required but not found!

I'm using msys2, and I made sure to compile the library first. Do I need to put the compiled files into a specific directory so I can compile the other half?

ts-korhonen commented 1 year ago

I'm trying to compile this new version but keep getting this error. configure: error: libEmuSC library is required but not found!

I'm using msys2, and I made sure to compile the library first. Do I need to put the compiled files into a specific directory so I can compile the other half?

You need to make install the library. But it doesn't install headers so they need to be copied manually after that. I finally got to building the program part and the linker can't find Qt libraries. It might be because it's searching Qt5Widgets (etc.) while they are QtWidgets (etc.) on msys2. edit: double checked, they actually are Qt5Widgets etc. No idea why it can't find them.

skjelten commented 1 year ago

I'm trying to compile this new version but keep getting this error. configure: error: libEmuSC library is required but not found!

I'm using msys2, and I made sure to compile the library first. Do I need to put the compiled files into a specific directory so I can compile the other half?

Yes, that is right. You basically have two different ways to achieve this:

There are several ways you can achieve the latter option. If you are comfortable with gcc and linker options you can modify the Makefile (remember that it gets overwritten every time you run ./configure!), or you can modify the configure.ac file (quite hard if you are not familiar with configure scripts), or the easiest way: just copy the files to the emusc/src directory. If you copy the header files from /libemusc/src/ to /emusc/src/emusc - the compiler will for instance find them. Or you could change the source files from #include "emusc/synth.h" to #include "../../libemusc/src/synth.h" (and for control_rom.h and pcm_rom.h). The .dll-file can be found in the libemusc/src/.libs directory. There are many ways to Rome, some less elegant than others :slightly_smiling_face:

I'll try to install msys2 on a machine later and update the README-files with better instructions. I guess most people are running on windows, so this will probably be a recurring issue.

skjelten commented 1 year ago

I'm trying to compile this new version but keep getting this error. configure: error: libEmuSC library is required but not found! I'm using msys2, and I made sure to compile the library first. Do I need to put the compiled files into a specific directory so I can compile the other half?

You need to make install the library. But it doesn't install headers so they need to be copied manually after that. I finally got to building the program part and the linker can't find Qt libraries. ~It might be because it's searching Qt5Widgets (etc.) while they are QtWidgets (etc.) on msys2.~ edit: double checked, they actually are Qt5Widgets etc. No idea why it can't find them.

Could you post the linker command that fails, including the error message, and the directory locations for QT5? I might be able to spot the issue.

skjelten commented 1 year ago

This problem #5 has been solved?

Ouch! The configure script was fixed for libemusc, but the issue still remains in emusc's configure script. I will fix this asap.

ts-korhonen commented 1 year ago

Could you post the linker command that fails, including the error message, and the directory locations for QT5? I might be able to spot the issue.

g++ -std=c++11  -g -O2 -IC:/msys64/mingw32/include/QtCore -IC:/msys64/mingw32/include/QtGui -DQT_WIDGETS_LIB -IC:/msys64/mingw32/include/QtWidgets -DQT_GUI_LIB -DQT_CORE_LIB  -fPIC -DQT_MULTIMEDIA_LIB -IC:/msys64/mingw32/include/QtMultimedia -IC:/msys64/mingw32/include/QtCore -DQT_NETWORK_LIB -IC:/msys64/mingw32/include/QtNetwork -DQT_GUI_LIB -IC:/msys64/mingw32/include/QtGui -DQT_CORE_LIB  -D__WIN32_AUDIO__ -D__WIN32_MIDI__  -static-libstdc++ -static -o emusc.exe audio_config_dialog.o audio_output.o audio_output_alsa.o audio_output_core.o audio_output_null.o audio_output_pulse.o audio_output_qt.o audio_output_win32.o emulator.o emusc.o control_rom_info_dialog.o main_window.o midi_config_dialog.o midi_input.o midi_input_alsa.o midi_input_core.o midi_input_keyboard.o midi_input_win32.o rom_config_dialog.o scene.o qrc_emusc.o  -lwinmm  -lemusc -lQt5Widgets -lQt5Gui -lQt5Core  -lQt5Multimedia -lQt5Network -lQt5Gui -lQt5Core
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Widgets: No such file or directory
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Gui: No such file or directory
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Core: No such file or directory
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Multimedia: No such file or directory
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Network: No such file or directory
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Gui: No such file or directory
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Core: No such file or directory
collect2.exe: error: ld returned 1 exit status

And the path where they are is C:\msys64\mingw32\lib\libQt5Widgets.dll.a etc.

trevor0402 commented 1 year ago

I'm trying to compile this new version but keep getting this error. configure: error: libEmuSC library is required but not found! I'm using msys2, and I made sure to compile the library first. Do I need to put the compiled files into a specific directory so I can compile the other half?

Yes, that is right. You basically have two different ways to achieve this:

  • Run make install as suggested by @ts-korhonen (I will have a look at the install script to see why the headers does not get installed). This is the intended way to do it.
  • Make the library (.dll in windows) and header files available directly from libemusc's build directory. So instead of installing the library and header files, you alter the build environment to emusc (the program) so that it finds the files from libemusc's build directory. This is typically what I do during development.

There are several ways you can achieve the latter option. If you are comfortable with gcc and linker options you can modify the Makefile (remember that it gets overwritten every time you run ./configure!), or you can modify the configure.ac file (quite hard if you are not familiar with configure scripts), or the easiest way: just copy the files to the emusc/src directory. If you copy the header files from /libemusc/src/ to /emusc/src/emusc - the compiler will for instance find them. Or you could change the source files from #include "emusc/synth.h" to #include "../../libemusc/src/synth.h" (and for control_rom.h and pcm_rom.h). The .dll-file can be found in the libemusc/src/.libs directory. There are many ways to Rome, some less elegant than others 🙂

I'll try to install msys2 on a machine later and update the README-files with better instructions. I guess most people are running on windows, so this will probably be a recurring issue.

Still getting the same error after trying all of these suggestions. I've pasted the compiled files and header files into /emusc/src and still nothing.

skjelten commented 1 year ago

Could you post the linker command that fails, including the error message, and the directory locations for QT5? I might be able to spot the issue.

g++ -std=c++11  -g -O2 -IC:/msys64/mingw32/include/QtCore -IC:/msys64/mingw32/include/QtGui -DQT_WIDGETS_LIB -IC:/msys64/mingw32/include/QtWidgets -DQT_GUI_LIB -DQT_CORE_LIB  -fPIC -DQT_MULTIMEDIA_LIB -IC:/msys64/mingw32/include/QtMultimedia -IC:/msys64/mingw32/include/QtCore -DQT_NETWORK_LIB -IC:/msys64/mingw32/include/QtNetwork -DQT_GUI_LIB -IC:/msys64/mingw32/include/QtGui -DQT_CORE_LIB  -D__WIN32_AUDIO__ -D__WIN32_MIDI__  -static-libstdc++ -static -o emusc.exe audio_config_dialog.o audio_output.o audio_output_alsa.o audio_output_core.o audio_output_null.o audio_output_pulse.o audio_output_qt.o audio_output_win32.o emulator.o emusc.o control_rom_info_dialog.o main_window.o midi_config_dialog.o midi_input.o midi_input_alsa.o midi_input_core.o midi_input_keyboard.o midi_input_win32.o rom_config_dialog.o scene.o qrc_emusc.o  -lwinmm  -lemusc -lQt5Widgets -lQt5Gui -lQt5Core  -lQt5Multimedia -lQt5Network -lQt5Gui -lQt5Core
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Widgets: No such file or directory
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Gui: No such file or directory
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Core: No such file or directory
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Multimedia: No such file or directory
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Network: No such file or directory
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Gui: No such file or directory
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Core: No such file or directory
collect2.exe: error: ld returned 1 exit status

And the path where they are is C:\msys64\mingw32\lib\libQt5Widgets.dll.a etc.

Try to remove the "-static" from the linker command. It looks like the linker is trying to link static the QT libraries, but only the dynamic library files (DLLs) are available.

skjelten commented 1 year ago

In the last commit (https://github.com/skjelten/emusc/commit/57704698222646b34a4cc0cfe746a17635a24a2b) I added two short tutorials for compiling [lib]emusc on Windows. I also fixed the missing libemusc header files so that make install actually installs the header files (thanks @ts-korhonen ) and removed the erroneous linker flags to emusc so that the linker will not fail anymore (thanks for the #5 tip @Kappa971).

Please try to compile again with the new instructions and fixes and report back if you still have problems.

ThatRetroGuy commented 1 year ago

Hello! ive managed to compile the exe some what successfull, emusc is telling on a few files are missing.. how do i get those?

Screenshot (25) Screenshot (26) Screenshot (27) Screenshot (28)

ts-korhonen commented 1 year ago

Try to remove the "-static" from the linker command.

This worked. I added LDFLAGS = -shared to Makefile.am.

emusc is telling on a few files are missing.. how do i get those?

Since it's using shared libraries they are in msys2 path, you need either run it from msys2/mingw shell or find those files in msys2 installation folder and copy them to the same folder.

Also command windeployqt.exe emusc.exe will copy/generate necessary dll's and folders for Qt.

Im not too familiar with autotools, but it might be possible to tweak the build so it's static and dll's is not needed. Now if it's all static then it won't find Qt even if qt5-static is installed.

skjelten commented 1 year ago

Hello! ive managed to compile the exe some what successfull, emusc is telling on a few files are missing.. how do i get those?

As @ts-korhonen mentioned you can run emusc from the msys console:

cd src
./emusc.exe

Another alternative is to copy the emusc.exe file to another location together with all necessary DLL-files. The issue here is that due to the dynamic linking of QT-libraries you get an awful long list of DDLs that you would need to copy over together with the emusc.exe. The good part is that most of the DLLs are located in c:\msys64\ucrt64\bin (or wherever you installed MSYS2). The exception is libemusc-0.dll which is located in the build directory for libemusc/src/.libs/. You might also run into an issue of missing QT plugin. In that case you will have to either create a qt.conf-file where emusc.exe is located or specify the QT_QPA_PLATFORM_PLUGIN_PATH environmental variable (see next alternative).

A third alternative, and probably the easiest if you only want to run it locally, is to run a command (e.g. create a shortcut) like this:

C:\Windows\System32\cmd.exe /c "SET PATH=C:\MSYS64\UCRT64\bin;%PATH% && SET QT_QPA_PLATFORM_PLUGIN_PATH=c:\msys64\UCRT64\share\qt5\plugins\platforms && START /D ^"c:\emusc^" emusc.exe"

Make sure to alter the command according to your directory structure. This will add the directory with all the DLLs to your path before starting emusc.exe. Note that this requires that you copy libemusc-0.dll together with emusc.exe (or you could extend the PATH variable above to include the directory where this DLL is found).

An old, but still relevant blog post can be found here: https://lemirep.wordpress.com/2013/06/01/deploying-qt-applications-on-linux-and-windows-3/

We will have to figure out a way to either build statically in windows (hence the reason why I had the -static flag earlier) or we need some kind of installer. Dynamic linking against static QT-libraries could perhaps also be an option. I guess VLC and munt, both free software projects using QT, can give some inspiration.

kode54 commented 1 year ago

I get a different error trying to build it with automake and autoconf.

configure:16798: checking whether g++ supports C++11 features with -std=c++11
configure:17101: g++ -std=c++11 -c -g -O2  conftest.cpp >&5
conftest.cpp: In function 'void cxx11::test_lambdas::test1()':
conftest.cpp:221:23: error: expected primary-expression before ')' token
  221 |       auto lambda1 = (){};
      |                       ^
conftest.cpp: In function 'int cxx11::test_lambdas::test2()':
conftest.cpp:230:17: error: expected primary-expression before 'int'
  230 |       auto a = (int i, int j){ return i + j; }(1, 2);
      |                 ^~~
conftest.cpp:230:17: error: expected ')' before 'int'
  230 |       auto a = (int i, int j){ return i + j; }(1, 2);
      |                ~^~~
      |                 )
conftest.cpp:231:17: error: expected primary-expression before ')' token
  231 |       auto b = () -> int { return '0'; }();
      |                 ^
conftest.cpp:231:22: error: expected unqualified-id before 'int'
  231 |       auto b = () -> int { return '0'; }();
      |                      ^~~
conftest.cpp:231:41: error: expected ',' or ';' before '(' token
  231 |       auto b = () -> int { return '0'; }();
      |                                         ^
conftest.cpp:232:16: error: expected primary-expression before '=' token
  232 |       auto c = =(){ return a + b; }();
      |                ^
conftest.cpp:232:18: error: expected primary-expression before ')' token
  232 |       auto c = =(){ return a + b; }();
      |                  ^
conftest.cpp:232:36: error: expected ',' or ';' before '(' token
  232 |       auto c = =(){ return a + b; }();
      |                                    ^
conftest.cpp:233:18: error: expected primary-expression before ')' token
  233 |       auto d = &(){ return c; }();
      |                  ^
conftest.cpp:233:32: error: expected ',' or ';' before '(' token
  233 |       auto d = &(){ return c; }();
      |                                ^
conftest.cpp:234:29: error: expected initializer before 'mutable'
  234 |       auto e = a, &b(int x) mutable {
      |                             ^~~~~~~
conftest.cpp: In function 'int cxx11::test_lambdas::test3()':
conftest.cpp:246:29: error: expected primary-expression before ')' token
  246 |       const auto nullary = (){ return 0; };
      |                             ^
conftest.cpp:247:27: error: expected primary-expression before 'int'
  247 |       const auto unary = (int x){ return x; };
      |                           ^~~
conftest.cpp:247:27: error: expected ')' before 'int'
  247 |       const auto unary = (int x){ return x; };
      |                          ~^~~
      |                           )
conftest.cpp:250:31: error: 'nullary_t' was not declared in this scope
  250 |       const auto higher1st = (nullary_t f){ return f(); };
      |                               ^~~~~~~~~
conftest.cpp:250:40: error: expected ')' before 'f'
  250 |       const auto higher1st = (nullary_t f){ return f(); };
      |                              ~         ^~
      |                                        )
conftest.cpp:251:45: error: expected ')' before 'f1'
  251 |       const auto higher2nd = unary(nullary_t f1){
      |                                   ~         ^~~
      |                                             )
configure:17101: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "libEmuSC"
| #define PACKAGE_TARNAME "libemusc"
| #define PACKAGE_VERSION "0.0.1"
| #define PACKAGE_STRING "libEmuSC 0.0.1"
| #define PACKAGE_BUGREPORT "skjelten@pvv.org"
| #define PACKAGE_URL "https://github.com/skjelten/emusc"
| #define PACKAGE "libemusc"
| #define VERSION "0.0.1"
| #define HAVE_STDIO_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_UNISTD_H 1
| #define STDC_HEADERS 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| /* end confdefs.h.  */
| 
| 
| // If the compiler admits that it is not ready for C++11, why torture it?
| // Hopefully, this will speed up the test.
| 
| #ifndef __cplusplus
| 
| #error "This is not a C++ compiler"
| 
| // MSVC always sets __cplusplus to 199711L in older versions; newer versions
| // only set it correctly if /Zc:__cplusplus is specified as well as a
| // /std:c++NN switch:
| // https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
| #elif __cplusplus < 201103L && !defined _MSC_VER
| 
| #error "This is not a C++11 compiler"
| 
| #else
| 
| namespace cxx11
| {
| 
|   namespace test_static_assert
|   {
| 
|     template <typename T>
|     struct check
|     {
|       static_assert(sizeof(int) <= sizeof(T), "not big enough");
|     };
| 
|   }
| 
|   namespace test_final_override
|   {
| 
|     struct Base
|     {
|       virtual ~Base() {}
|       virtual void f() {}
|     };
| 
|     struct Derived : public Base
|     {
|       virtual ~Derived() override {}
|       virtual void f() override {}
|     };
| 
|   }
| 
|   namespace test_double_right_angle_brackets
|   {
| 
|     template < typename T >
|     struct check {};
| 
|     typedef check<void> single_type;
|     typedef check<check<void>> double_type;
|     typedef check<check<check<void>>> triple_type;
|     typedef check<check<check<check<void>>>> quadruple_type;
| 
|   }
| 
|   namespace test_decltype
|   {
| 
|     int
|     f()
|     {
|       int a = 1;
|       decltype(a) b = 2;
|       return a + b;
|     }
| 
|   }
| 
|   namespace test_type_deduction
|   {
| 
|     template < typename T1, typename T2 >
|     struct is_same
|     {
|       static const bool value = false;
|     };
| 
|     template < typename T >
|     struct is_same<T, T>
|     {
|       static const bool value = true;
|     };
| 
|     template < typename T1, typename T2 >
|     auto
|     add(T1 a1, T2 a2) -> decltype(a1 + a2)
|     {
|       return a1 + a2;
|     }
| 
|     int
|     test(const int c, volatile int v)
|     {
|       static_assert(is_same<int, decltype(0)>::value == true, "");
|       static_assert(is_same<int, decltype(c)>::value == false, "");
|       static_assert(is_same<int, decltype(v)>::value == false, "");
|       auto ac = c;
|       auto av = v;
|       auto sumi = ac + av + 'x';
|       auto sumf = ac + av + 1.0;
|       static_assert(is_same<int, decltype(ac)>::value == true, "");
|       static_assert(is_same<int, decltype(av)>::value == true, "");
|       static_assert(is_same<int, decltype(sumi)>::value == true, "");
|       static_assert(is_same<int, decltype(sumf)>::value == false, "");
|       static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
|       return (sumf > 0.0) ? sumi : add(c, v);
|     }
| 
|   }
| 
|   namespace test_noexcept
|   {
| 
|     int f() { return 0; }
|     int g() noexcept { return 0; }
| 
|     static_assert(noexcept(f()) == false, "");
|     static_assert(noexcept(g()) == true, "");
| 
|   }
| 
|   namespace test_constexpr
|   {
| 
|     template < typename CharT >
|     unsigned long constexpr
|     strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
|     {
|       return *s ? strlen_c_r(s + 1, acc + 1) : acc;
|     }
| 
|     template < typename CharT >
|     unsigned long constexpr
|     strlen_c(const CharT *const s) noexcept
|     {
|       return strlen_c_r(s, 0UL);
|     }
| 
|     static_assert(strlen_c("") == 0UL, "");
|     static_assert(strlen_c("1") == 1UL, "");
|     static_assert(strlen_c("example") == 7UL, "");
|     static_assert(strlen_c("another\0example") == 7UL, "");
| 
|   }
| 
|   namespace test_rvalue_references
|   {
| 
|     template < int N >
|     struct answer
|     {
|       static constexpr int value = N;
|     };
| 
|     answer<1> f(int&)       { return answer<1>(); }
|     answer<2> f(const int&) { return answer<2>(); }
|     answer<3> f(int&&)      { return answer<3>(); }
| 
|     void
|     test()
|     {
|       int i = 0;
|       const int c = 0;
|       static_assert(decltype(f(i))::value == 1, "");
|       static_assert(decltype(f(c))::value == 2, "");
|       static_assert(decltype(f(0))::value == 3, "");
|     }
| 
|   }
| 
|   namespace test_uniform_initialization
|   {
| 
|     struct test
|     {
|       static const int zero {};
|       static const int one {1};
|     };
| 
|     static_assert(test::zero == 0, "");
|     static_assert(test::one == 1, "");
| 
|   }
| 
|   namespace test_lambdas
|   {
| 
|     void
|     test1()
|     {
|       auto lambda1 = (){};
|       auto lambda2 = lambda1;
|       lambda1();
|       lambda2();
|     }
| 
|     int
|     test2()
|     {
|       auto a = (int i, int j){ return i + j; }(1, 2);
|       auto b = () -> int { return '0'; }();
|       auto c = =(){ return a + b; }();
|       auto d = &(){ return c; }();
|       auto e = a, &b(int x) mutable {
|         const auto identity = (int y){ return y; };
|         for (auto i = 0; i < a; ++i)
|           a += b--;
|         return x + identity(a + b);
|       }(0);
|       return a + b + c + d + e;
|     }
| 
|     int
|     test3()
|     {
|       const auto nullary = (){ return 0; };
|       const auto unary = (int x){ return x; };
|       using nullary_t = decltype(nullary);
|       using unary_t = decltype(unary);
|       const auto higher1st = (nullary_t f){ return f(); };
|       const auto higher2nd = unary(nullary_t f1){
|         return unary, f1(unary_t f2){ return f2(unary(f1())); };
|       };
|       return higher1st(nullary) + higher2nd(nullary)(unary);
|     }
| 
|   }
| 
|   namespace test_variadic_templates
|   {
| 
|     template <int...>
|     struct sum;
| 
|     template <int N0, int... N1toN>
|     struct sum<N0, N1toN...>
|     {
|       static constexpr auto value = N0 + sum<N1toN...>::value;
|     };
| 
|     template <>
|     struct sum<>
|     {
|       static constexpr auto value = 0;
|     };
| 
|     static_assert(sum<>::value == 0, "");
|     static_assert(sum<1>::value == 1, "");
|     static_assert(sum<23>::value == 23, "");
|     static_assert(sum<1, 2>::value == 3, "");
|     static_assert(sum<5, 5, 11>::value == 21, "");
|     static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
| 
|   }
| 
|   // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
|   // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
|   // because of this.
|   namespace test_template_alias_sfinae
|   {
| 
|     struct foo {};
| 
|     template<typename T>
|     using member = typename T::member_type;
| 
|     template<typename T>
|     void func(...) {}
| 
|     template<typename T>
|     void func(member<T>*) {}
| 
|     void test();
| 
|     void test() { func<foo>(0); }
| 
|   }
| 
| }  // namespace cxx11
| 
| #endif  // __cplusplus >= 201103L
| 
| 
| 
configure:17111: result: no
kode54 commented 1 year ago

Ah, you have to escape your square brackets in M4 scripts, even in double-bracket blocks.

diff --git a/libemusc/acsite.m4 b/libemusc/acsite.m4
index 5604159..b12b9b8 100644
--- a/libemusc/acsite.m4
+++ b/libemusc/acsite.m4
@@ -380,7 +380,7 @@ namespace cxx11
     void
     test1()
     {
-      auto lambda1 = [](){};
+      auto lambda1 = @<:@@:>@(){};
       auto lambda2 = lambda1;
       lambda1();
       lambda2();
@@ -389,12 +389,12 @@ namespace cxx11
     int
     test2()
     {
-      auto a = [](int i, int j){ return i + j; }(1, 2);
-      auto b = []() -> int { return '0'; }();
-      auto c = [=](){ return a + b; }();
-      auto d = [&](){ return c; }();
-      auto e = [a, &b](int x) mutable {
-        const auto identity = [](int y){ return y; };
+      auto a = @<:@@:>@(int i, int j){ return i + j; }(1, 2);
+      auto b = @<:@@:>@() -> int { return '0'; }();
+      auto c = @<:@=@:>@(){ return a + b; }();
+      auto d = @<:@&@:>@(){ return c; }();
+      auto e = @<:@a, &b@:>@(int x) mutable {
+        const auto identity = @<:@@:>@(int y){ return y; };
         for (auto i = 0; i < a; ++i)
           a += b--;
         return x + identity(a + b);
@@ -405,13 +405,13 @@ namespace cxx11
     int
     test3()
     {
-      const auto nullary = [](){ return 0; };
-      const auto unary = [](int x){ return x; };
+      const auto nullary = @<:@@:>@(){ return 0; };
+      const auto unary = @<:@@:>@(int x){ return x; };
       using nullary_t = decltype(nullary);
       using unary_t = decltype(unary);
-      const auto higher1st = [](nullary_t f){ return f(); };
-      const auto higher2nd = [unary](nullary_t f1){
-        return [unary, f1](unary_t f2){ return f2(unary(f1())); };
+      const auto higher1st = @<:@@:>@(nullary_t f){ return f(); };
+      const auto higher2nd = @<:@unary@:>@(nullary_t f1){
+        return @<:@unary, f1@:>@(unary_t f2){ return f2(unary(f1())); };
       };
       return higher1st(nullary) + higher2nd(nullary)(unary);
     }

Should I make a pull request fixing this?

skjelten commented 1 year ago

Hi @kode54

Strange thing I have never come across that issue before. Are you using MSYS2/mingw?

Anyways, thanks for your PR! I will merge it later, just in time for a rewrite to CMake that I have been working on for a few weeks :slightly_smiling_face:

kode54 commented 1 year ago

Sorry, didn't realize this issue was only for MSYS2. I was building from Arch Linux.

skjelten commented 1 year ago

Ahh, no worries! Just curious to how you found an issue no one else have reported.

Feel free to test the CMake build system that was just committed as well, I have no Arch Linux systems up and running to test on myself.

Closing this issue since we no longer are using autotools and the instructions has been updated. If anyone has trouble compiling EmuSC, just open a new issue.