mywave82 / opencubicplayer

Open Cubic Player (unix fork). Music visualizer for various tracked music formats (amiga modules, S3M, IT), chiptunes and other formats related to demoscene
https://stian.cubic.org/project-ocp.php
GNU General Public License v2.0
292 stars 19 forks source link

Compile error: kickload.o #54

Closed kpstsp closed 2 years ago

kpstsp commented 2 years ago

I try to build latest code from git on Mac OS X Catalina 10.15.7

opencubicplayer >>> make
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C boot TOPDIR=.././
gcc -I/opt/local/include -fno-common -fPIC -Wall -I.././ kickload.c -o kickload.o -c
In file included from kickload.c:56:
.././types.h:74:11: warning: 'CLOCK_REALTIME' macro redefined [-Wmacro-redefined]
#  define CLOCK_REALTIME CALENDAR_CLOCK
          ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/time.h:155:9: note:
      previous definition is here
#define CLOCK_REALTIME _CLOCK_REALTIME
        ^
In file included from kickload.c:56:
.././types.h:75:11: warning: 'CLOCK_MONOTONIC' macro redefined [-Wmacro-redefined]
#  define CLOCK_MONOTONIC SYSTEM_CLOCK
          ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/time.h:157:9: note:
      previous definition is here
#define CLOCK_MONOTONIC _CLOCK_MONOTONIC
        ^
In file included from kickload.c:56:
.././types.h:76:13: error: typedef redefinition with different types
      ('int' vs 'enum clockid_t')
typedef int clockid_t;
            ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/time.h:172:3: note:
      previous definition is here
} clockid_t;
  ^
2 warnings and 1 error generated.
make[1]: *** [kickload.o] Error 1
make: *** [dirs] Error 2

0.2.9.6 from tar.gz fail with same errors

mywave82 commented 2 years ago

I only have access to an ancient Mac that is stuck at an old version of MacOS, so I need to provide work-around for POSIX functionality that first appeared in version MacOS 10.12 and tried using examples found online for what the "correct" ifdef for this would be, which obviously didn't work.

Can you test for me:

In types.h and stuff/compat.c Change: # if !defined(MAC_OS_X_VERSION_10_12) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12 into: # if !defined(MAC_OS_X_VERSION_10_12)

And I will later test the same change on my old MacOS and check that it still works as expected there too.

kpstsp commented 2 years ago
image

I did changes. 'make' still failing.

PS: I also have Mojave for tests if need.

mywave82 commented 2 years ago

Could you attach Availability.h from your system to this bugreport?

mywave82 commented 2 years ago

Hmm, doing some more searches online, maybe the simple fix is to instead add #include <AvailabilityVersions.h> under #include <Availability.h>

kpstsp commented 2 years ago

Hmm, doing some more searches online, maybe the simple fix is to instead add #include <AvailabilityVersions.h> under #include <Availability.h>

Works with both modifications: replacing if defined and added #include <AvailabilityVersions.h>

gist patch

make did some works and stop on next error

g++ -I/opt/local/include -fno-common -fPIC -Wall -I.././ -DVERSION=\"2.3.4-beta\" -Dstricmp=strcasecmp -Ilibbinio-git/src  adplug-git/src/adl.cpp -o adplug_adl.o -c
adplug-git/src/adl.cpp:109:14: error: '(anonymous struct at adplug-git/src/adl.cpp:109:14)' cannot be defined in the
      result type of a function
static const struct {
             ^
adplug-git/src/adl.cpp:111:3: error: functions that differ only in their return type cannot be overloaded
} nullptr;
  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__nullptr:48:24: note:
      expanded from macro 'nullptr'
#define nullptr _VSTD::__get_nullptr_t()
                       ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__nullptr:46:62: note:
      previous definition is here
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
                                                   ~~~~~~~~~ ^
2 errors generated.
make[1]: *** [adplug_adl.o] Error 1
make: *** [dirs] Error 2
mywave82 commented 2 years ago

I think the latest master should compile for you, (but probably throws a lot of warnings)

kpstsp commented 2 years ago

I tried latest master:head, got error: typedef redefinition with different types than I applied patch with changes in type.h and compat.c:

# if !defined(MAC_OS_X_VERSION_10_12) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12 to ->> # if !defined(MAC_OS_X_VERSION_10_12)

(looks like it still not changed in repos) and 'make' finally done.

I got another problem with ld paths (mb problem with my configure options). But it already another case.

mywave82 commented 2 years ago

I thought that the original guard # if !defined(MAC_OS_X_VERSION_10_12) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12 worked after we added #include <AvailabilityVersions.h>

mywave82 commented 2 years ago

I added one more include file: #include <AvailabilityMacros.h

kpstsp commented 2 years ago

Finally build done successful! Thanks