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

MacOS BigSur / M1 Monterey build failures #12

Closed
atsb opened this issue Nov 15, 2021 · 10 comments
Closed

MacOS BigSur / M1 Monterey build failures #12

atsb opened this issue Nov 15, 2021 · 10 comments
Labels
bug Something isn't working

Comments

@atsb
Copy link
Contributor

atsb commented Nov 15, 2021

[  6%] Building CXX object source_files/ddf/CMakeFiles/edge_ddf.dir/anim.cc.o
In file included from /Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/anim.cc:22:
In file included from /Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/local.h:22:
/Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/../epi/epi.h:48:37: error: expected function body after function declarator
void I_Error(const char *error,...) GCCATTR((format(printf, 1, 2)));
                                    ^
/Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/../epi/epi.h:49:41: error: expected function body after function declarator
void I_Warning(const char *warning,...) GCCATTR((format(printf, 1, 2)));
                                        ^
/Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/../epi/epi.h:50:40: error: expected function body after function declarator
void I_Printf(const char *message,...) GCCATTR((format(printf, 1, 2)));
                                       ^
/Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/../epi/epi.h:51:40: error: expected function body after function declarator
void I_Debugf(const char *message,...) GCCATTR((format(printf, 1, 2)));
                                       ^
In file included from /Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/anim.cc:22:
/Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/local.h:242:42: error: expected function body after function declarator
void DDF_Error    (const char *err, ...) GCCATTR((format (printf,1,2)));
                                         ^
/Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/local.h:243:42: error: expected function body after function declarator
void DDF_Warning  (const char *err, ...) GCCATTR((format (printf,1,2)));
                                         ^
/Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/local.h:244:42: error: expected function body after function declarator
void DDF_WarnError(const char *err, ...) GCCATTR((format (printf,1,2)));
                                         ^
/Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/anim.cc:82:3: error: use of undeclared identifier 'DDF_WarnError'
                DDF_WarnError("New anim entry is missing a name!");
                ^
/Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/anim.cc:91:4: error: use of undeclared identifier 'DDF_Error'
                        DDF_Error("Unknown animdef to extend: %s\n", name);
                        ^
/Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/anim.cc:120:2: error: use of undeclared identifier 'DDF_WarnError'
        DDF_WarnError("Unknown anims.ddf command: %s\n", field);
        ^
/Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/anim.cc:127:3: error: use of undeclared identifier 'DDF_WarnError'
                DDF_WarnError("Bad TICS value for anim: %d\n", dynamic_anim->speed);
                ^
/Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/anim.cc:136:4: error: use of undeclared identifier 'DDF_Error'
                        DDF_Error("Missing animation sequence.\n");
                        ^
/Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/anim.cc:140:4: error: use of undeclared identifier 'DDF_Error'
                        DDF_Error("TYPE=GRAPHIC animations must use the SEQUENCE command.\n");
                        ^
/Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/anim.cc:203:2: error: use of undeclared identifier 'I_Error'
        SYS_ASSERT(storage);
        ^
/Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/../epi/asserts.h:41:20: note: expanded from macro 'SYS_ASSERT'
        ((cond)? (void)0 :I_Error("Assertion '%s' failed in %s (%s:%d).\n",  \
                          ^
/Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/anim.cc:215:3: error: use of undeclared identifier 'DDF_WarnError'
                DDF_WarnError("Unknown animation type: %s\n", info);
                ^
/Users/ats/Downloads/EDGE-classic-Preview-1/source_files/ddf/anim.cc:244:3: error: use of undeclared identifier 'I_Debugf'
                I_Debugf("- ANIMATED LUMP: start '%s' : end '%s'\n", first, last);
                ^
16 errors generated.

Clang Target:

Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin20.6.0
Thread model: posix

SDL2/GLEW etc.. are all correctly resolved and identified via CMake.

@dashodanger
Copy link
Member

dashodanger commented Nov 15, 2021

I'll have to try to wrangle up a VM for testing this.

Although it's not causing the error in question, SDL 1.x should be the dependency here. Is it asking you to explicitly install the SDL2 library/headers?

In the meantime, does changing line 31 of source_files/epi/epi_macosx.h to this help?:

#ifdef GNUC
#define GCCATTR(xyz) attribute (xyz)
#else
#define GCCATTR(xyz) /* nothing */
#endif

@atsb
Copy link
Contributor Author

atsb commented Nov 15, 2021

Ahh yes, it is SDL 1.2 not SDL2. Sorry, I've spent a lot of time lately with SDL2 source ports.

So you were right about that one addition. I'm working on a few others to get it building. I'll report back once that is done.

EDIT:

So you were right with that fix you mentioned. Below are a few others.

Since your CMake file does not define a MACOSX preprocessor macro, the resulting Makefile does not define MACOSX, and so anything in an ifdef/else with MACOSX will not be triggered. I would suggest to go the least painful route and use 'APPLE' as this will be triggered when running on all Apple systems.

epi.h

#ifdef __APPLE__
#include "epi_macosx.h"
#endif

deh_edge/i_defs.h

// MacOS X
#elif defined (__APPLE__)

edge/i_defs_gl.h

#ifdef __APPLE__
#include <GL/glew.h>
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
#endif

edge/unx_system.cc

Remove the MACOSX ifndef. This is no longer true and MacOS needs this function.

//
// I_MessageBox
//
void I_MessageBox(const char *message, const char *title)
{
#ifdef USE_FLTK
	Fl::scheme(NULL);
	fl_message_font(FL_HELVETICA /*_BOLD*/, 18);	
	fl_message("%s", message);

#else // USE_FLTK
	fprintf(stderr, "\n%s\n", message);
#endif // USE_FLTK
}

Finally (I also renamed all MACOSX macros to APPLE), I also had to manually configure the link.txt file to correctly point to all the right things (CMake should do this when it is properly configured for a MacOS system).

link.txt:
/Library/Developer/CommandLineTools/usr/bin/c++ -O2 -ffast-math -fno-strict-aliasing -DINLINE_G=inline -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/edge135.dir/source_files/edge/i_main.cc.o CMakeFiles/edge135.dir/source_files/edge/i_ctrl.cc.o CMakeFiles/edge135.dir/source_files/edge/i_video.cc.o CMakeFiles/edge135.dir/source_files/edge/i_sound.cc.o CMakeFiles/edge135.dir/source_files/edge/i_net.cc.o CMakeFiles/edge135.dir/source_files/edge/am_map.cc.o CMakeFiles/edge135.dir/source_files/edge/con_con.cc.o CMakeFiles/edge135.dir/source_files/edge/con_main.cc.o CMakeFiles/edge135.dir/source_files/edge/con_link.cc.o CMakeFiles/edge135.dir/source_files/edge/con_var.cc.o CMakeFiles/edge135.dir/source_files/edge/e_input.cc.o CMakeFiles/edge135.dir/source_files/edge/e_main.cc.o CMakeFiles/edge135.dir/source_files/edge/e_player.cc.o CMakeFiles/edge135.dir/source_files/edge/f_finale.cc.o CMakeFiles/edge135.dir/source_files/edge/f_interm.cc.o CMakeFiles/edge135.dir/source_files/edge/g_game.cc.o CMakeFiles/edge135.dir/source_files/edge/hu_draw.cc.o CMakeFiles/edge135.dir/source_files/edge/hu_font.cc.o CMakeFiles/edge135.dir/source_files/edge/hu_stuff.cc.o CMakeFiles/edge135.dir/source_files/edge/hu_style.cc.o CMakeFiles/edge135.dir/source_files/edge/l_glbsp.cc.o CMakeFiles/edge135.dir/source_files/edge/l_deh.cc.o CMakeFiles/edge135.dir/source_files/edge/m_argv.cc.o CMakeFiles/edge135.dir/source_files/edge/m_bbox.cc.o CMakeFiles/edge135.dir/source_files/edge/m_cheat.cc.o CMakeFiles/edge135.dir/source_files/edge/m_math.cc.o CMakeFiles/edge135.dir/source_files/edge/m_menu.cc.o CMakeFiles/edge135.dir/source_files/edge/m_misc.cc.o CMakeFiles/edge135.dir/source_files/edge/m_option.cc.o CMakeFiles/edge135.dir/source_files/edge/m_netgame.cc.o CMakeFiles/edge135.dir/source_files/edge/m_random.cc.o CMakeFiles/edge135.dir/source_files/edge/n_bcast.cc.o CMakeFiles/edge135.dir/source_files/edge/n_reliable.cc.o CMakeFiles/edge135.dir/source_files/edge/n_network.cc.o CMakeFiles/edge135.dir/source_files/edge/p_action.cc.o CMakeFiles/edge135.dir/source_files/edge/p_blockmap.cc.o CMakeFiles/edge135.dir/source_files/edge/p_bot.cc.o CMakeFiles/edge135.dir/source_files/edge/p_enemy.cc.o CMakeFiles/edge135.dir/source_files/edge/p_inter.cc.o CMakeFiles/edge135.dir/source_files/edge/p_lights.cc.o CMakeFiles/edge135.dir/source_files/edge/p_map.cc.o CMakeFiles/edge135.dir/source_files/edge/p_maputl.cc.o CMakeFiles/edge135.dir/source_files/edge/p_mobj.cc.o CMakeFiles/edge135.dir/source_files/edge/p_plane.cc.o CMakeFiles/edge135.dir/source_files/edge/p_setup.cc.o CMakeFiles/edge135.dir/source_files/edge/p_sight.cc.o CMakeFiles/edge135.dir/source_files/edge/p_spec.cc.o CMakeFiles/edge135.dir/source_files/edge/p_switch.cc.o CMakeFiles/edge135.dir/source_files/edge/p_tick.cc.o CMakeFiles/edge135.dir/source_files/edge/p_user.cc.o CMakeFiles/edge135.dir/source_files/edge/p_forces.cc.o CMakeFiles/edge135.dir/source_files/edge/p_telept.cc.o CMakeFiles/edge135.dir/source_files/edge/p_weapon.cc.o CMakeFiles/edge135.dir/source_files/edge/rad_act.cc.o CMakeFiles/edge135.dir/source_files/edge/rad_pars.cc.o CMakeFiles/edge135.dir/source_files/edge/rad_trig.cc.o CMakeFiles/edge135.dir/source_files/edge/r_draw.cc.o CMakeFiles/edge135.dir/source_files/edge/r_shader.cc.o CMakeFiles/edge135.dir/source_files/edge/r_render.cc.o CMakeFiles/edge135.dir/source_files/edge/r_effects.cc.o CMakeFiles/edge135.dir/source_files/edge/r_main.cc.o CMakeFiles/edge135.dir/source_files/edge/r_occlude.cc.o CMakeFiles/edge135.dir/source_files/edge/m_logo.cc.o CMakeFiles/edge135.dir/source_files/edge/r_things.cc.o CMakeFiles/edge135.dir/source_files/edge/r_units.cc.o CMakeFiles/edge135.dir/source_files/edge/r_wipe.cc.o CMakeFiles/edge135.dir/source_files/edge/r_misc.cc.o CMakeFiles/edge135.dir/source_files/edge/r_sky.cc.o CMakeFiles/edge135.dir/source_files/edge/r_colormap.cc.o CMakeFiles/edge135.dir/source_files/edge/r_modes.cc.o CMakeFiles/edge135.dir/source_files/edge/r_md2.cc.o CMakeFiles/edge135.dir/source_files/edge/r_image.cc.o CMakeFiles/edge135.dir/source_files/edge/r_doomtex.cc.o CMakeFiles/edge135.dir/source_files/edge/r_texgl.cc.o CMakeFiles/edge135.dir/source_files/edge/s_blit.cc.o CMakeFiles/edge135.dir/source_files/edge/s_cache.cc.o CMakeFiles/edge135.dir/source_files/edge/s_sound.cc.o CMakeFiles/edge135.dir/source_files/edge/s_mp3.cc.o CMakeFiles/edge135.dir/source_files/edge/s_music.cc.o CMakeFiles/edge135.dir/source_files/edge/s_ogg.cc.o CMakeFiles/edge135.dir/source_files/edge/s_tsf.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_chunk.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_glob.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_level.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_load.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_main.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_misc.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_mobj.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_play.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_save.cc.o CMakeFiles/edge135.dir/source_files/edge/w_flat.cc.o CMakeFiles/edge135.dir/source_files/edge/w_model.cc.o CMakeFiles/edge135.dir/source_files/edge/w_sprite.cc.o CMakeFiles/edge135.dir/source_files/edge/w_texture.cc.o CMakeFiles/edge135.dir/source_files/edge/w_wad.cc.o CMakeFiles/edge135.dir/source_files/edge/z_zone.cc.o CMakeFiles/edge135.dir/source_files/edge/vm_coal.cc.o CMakeFiles/edge135.dir/source_files/edge/vm_hud.cc.o CMakeFiles/edge135.dir/source_files/edge/vm_player.cc.o CMakeFiles/edge135.dir/source_files/edge/unx_music.cc.o CMakeFiles/edge135.dir/source_files/edge/unx_net.cc.o CMakeFiles/edge135.dir/source_files/edge/unx_system.cc.o -o edge135 source_files/coal/libedge_coal.a source_files/ddf/libedge_ddf.a source_files/deh_edge/libedge_deh.a source_files/epi/libedge_epi.a source_files/glbsp/libedge_glbsp.a -framework OpenGL /usr/local/lib/libGLEW.dylib /usr/local/Cellar/sdl/1.2.15_3/lib/libSDLmain.a /usr/local/Cellar/sdl/1.2.15_3/lib/libSDL.dylib -framework Foundation -framework Cocoa source_files/libpng/libpng16.a source_files/libjpeg/libjpeg.a source_files/zlib/libz.a

After all this, it links without issues and it is playable. Phew.. as always, I'll be more than happy to test any CMake additions for Mac systems that you may do.

edge-classic-mac

@dashodanger
Copy link
Member

Wow, well I'm happy to see that got up and running relatively quickly! I'll leave this open while I fold in the changes you've suggested. Thanks for the help.

@dashodanger
Copy link
Member

6728121 should have the changes you've mentioned above...were those enough for link.txt to be fixed when starting fresh, or were there further adjustments needed?

@atsb
Copy link
Contributor Author

atsb commented Nov 19, 2021

I had an issue with OpenGL and SDL linking. I used the below in the unix target_link_libraries part:

		  ${OPENGL_LIBRARIES} 
		  ${GLEW_LIBRARIES}
		  ${SDL_LIBRARIES}

Then it linked without issues. Compilation went through without a hitch.

@dashodanger
Copy link
Member

I wonder if that's related to me trying to make non-Window builds link with the bundled glew folder instead...would you be able to attach your CMakeLists.txt?

@atsb
Copy link
Contributor Author

atsb commented Nov 19, 2021

CMakeLists.txt

@dashodanger
Copy link
Member

CMakeLists.txt

Would you mind giving this one a spin? If it doesn't work, I may need to add a find_package(GLEW) for Apple targets

@atsb
Copy link
Contributor Author

atsb commented Nov 20, 2021

Perfect! Works fine with your latest master.

@dashodanger
Copy link
Member

Sweet, thanks for testing. I just pushed the same CMakeLists as 17a48ac and will close this issue then. Let me know if any other Apple issues crop up.

@dashodanger dashodanger added the bug Something isn't working label Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants