Attempting to get 1.91 built on Mac

Discussion and announcements regarding the Mac port… er, original version of Oolite.

Moderators: winston, another_commander

Post Reply
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4821
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Attempting to get 1.91 built on Mac

Post by phkb »

I've been trying to get an up-to-date Mac build working, and I think I'm close, but I keep running into a road block. I can get the code to compile, but no matter what I try, I can't get Oolite to use Open GL 3.3. It is stuck using Open GL 2.1 (according to the log file):

Code: Select all

 [rendering.opengl.version]: OpenGL renderer version: 2.1.0 ("2.1 APPLE-14.0.16"). Vendor: "Apple Inc.". Renderer: "Apple Software Rendered".
Which means, when I run the app, I get this

Image

For the technically curious, this is what I've changed:

Switch to the Open GL 3 headers in "src/OOOpenGLOnly.h"

Code: Select all

...
// Apple OpenGL includes...
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl3.h>
#include <OpenGL/glu.h>
#include <OpenGL/gl3ext.h>
Added some missing definitions to "src/Cocoa/MyOpenGLView.h"

Code: Select all

#define MAX_COLOR_SATURATION 2.0f
#define GL_CLAMP_VERTEX_COLOR_ARB   0x891A
#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B
#define GL_CLAMP_VERTEX_COLOR       0x891A
#define GL_CLAMP_FRAGMENT_COLOR     0x891B
Added some extra definitions to NSOpenGLView in "src/Cocoa/MyOpenGLView.h"

Code: Select all

@interface MyOpenGLView: NSOpenGLView
{
@private
    ...
    float           _colorSaturation;
}
- (float) colorSaturation;
- (void) adjustColorSaturation:(float)colorSaturationAdjustment;
Added the missing functions to "src/Cocoa/MyOpenGLView.m"

Code: Select all

- (float) colorSaturation
{
    return _colorSaturation;
}

- (void) adjustColorSaturation:(float)colorSaturationAdjustment
{
    _colorSaturation += colorSaturationAdjustment;
    _colorSaturation = OOClamp_0_max_f(_colorSaturation, MAX_COLOR_SATURATION);
}
Added some extra parameters to the NSOpenGLPixelFormatAttribute settings in the "initWithFrame" function in "src/Cocoa/MyOpenGLView.m", and preset the colorSaturation level:

Code: Select all

    NSOpenGLPixelFormatAttribute attrs[] 
    {
        ...
        NSOpenGLPFAWindow,
        NSOpenGLPFAOpenGLProfile, (NSOpenGLPixelFormatAttribute)NSOpenGLProfileVersion4_1Core,
        ...
    }
    _colorSaturation = 1.0f;
I've also tried using "NSOpenGLProfileVersion3_2Core" (instead of NSOpenGLProfileVersion4_1Core), and moving the two new options in front of the existing "NSOpenGLPFAWindow" option, but the result is the same.

Finally, I've changed the macOS Deployment Target to "macOS 10.7", and I've added some compiler flags to the "Other C flags" in the build settings:

Code: Select all

-DOSG_GL3_AVAILABLE::BOOL=1 -DOSG_GL1_AVAILABLE::BOOL=0 -DOSG_GL2_AVAILABLE::BOOL=0 -DOSG_GLES1_AVAILABLE::BOOL=0 -DOSG_GLES2_AVAILABLE::BOOL=0
(Edit: nevermind about these compiler flags. They're not related.)

There are some other changes I've made (for example, I've removed all the "Sparkle" package references and code), and there are a bunch of caveats to the environment I'm using. First, I'm using Mac OS 10.12.6 (Sierra), which is seriously out of date and support. Second, I'm doing this in a Hackintosh VM inside VirtualBox.

So that's the sum total of where I'm at. I think the extra options added to NSOpenGLPixelGFormatAttribute are correct, but I don't know why they're not being applied.

Any suggestions anyone can throw my way would be great. And please note that *I am not a Mac developer*. I largely have no idea what I'm doing, and I've been relying of Google to help me get this far. So if a real Xcode dev was to offer input, please make it as idiot-proof as you can. For reference, I'm using Xcode v9.2
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4821
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Attempting to get 1.91 built on Mac

Post by phkb »

I should also add, I have no idea if there will be other issues to solve if I can get past the current one. This still may not result in an updated Mac build, just so expectations are set at an appropriate level.
User avatar
MrFlibble
---- E L I T E ----
---- E L I T E ----
Posts: 313
Joined: Sun Feb 18, 2024 12:13 pm

Re: Attempting to get 1.91 built on Mac

Post by MrFlibble »

phkb wrote: Mon Jun 24, 2024 4:10 am
I should also add, I have no idea if there will be other issues to solve if I can get past the current one. This still may not result in an updated Mac build, just so expectations are set at an appropriate level.
I've been banging my head against a single bug in an alpha version of Debug Console using an x86_64 Hackintosh in libvirt/qemu on and off for a few days. Switching between desktops is a keyboard muscle-memory nightmare.

You are indeed brave to attempt such a monster task!
User avatar
hiran
Theorethicist
Posts: 2358
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Attempting to get 1.91 built on Mac

Post by hiran »

phkb wrote: Mon Jun 24, 2024 4:10 am
I should also add, I have no idea if there will be other issues to solve if I can get past the current one. This still may not result in an updated Mac build, just so expectations are set at an appropriate level.
The development in 1.91 is quite little - only minor fixes as I see them. And the change to OpenGL 3 came in 1.91 also.
How about going back a few commits to a state where OpenGL 2 is still in use and verify if other problems appear or can get covered?

I fear not only libraries are outdated. As Apple moved to another CPU architecture this is a monster. Do you have a large enough pan for frying?
Sunshine - Moonlight - Good Times - Oolite
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6654
Joined: Wed Feb 28, 2007 7:54 am

Re: Attempting to get 1.91 built on Mac

Post by another_commander »

Looks like the VM has old OpenGL installed. I don't think you are doing anything wrong, you just need a test machine with a more recent gl version. Updating ogl on the VM is probably not going to work. You could upload your binaries somewhere though, so Mac users could attempt a test run on actual Apple hardware instead of emulated.
User avatar
MrFlibble
---- E L I T E ----
---- E L I T E ----
Posts: 313
Joined: Sun Feb 18, 2024 12:13 pm

Re: Attempting to get 1.91 built on Mac

Post by MrFlibble »

If it helps to compare VM's, I'm running ventura 13.6.7 x86_64 on libvirt/qemu.

man glut show 3.7 at the bottom. Is there a proper way to check opengl version, short of installing xcode etc.?
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 673
Joined: Sat Aug 09, 2014 4:16 pm

Re: Attempting to get 1.91 built on Mac

Post by Commander_X »

another_commander wrote: Mon Jun 24, 2024 11:10 am
[...] You could upload your binaries somewhere though, so Mac users could attempt a test run on actual Apple hardware instead of emulated.
I am actually wondering that our wiki master didn't already offer :-D

The other way for OSX-KVM users to attempt getting a better OpenGL support for testing, would be a VM with GPU passthrough for a graphics card known to be well supported on the VM's version of MacOS (not too many; e.g. newer NVidia are out of this bunch).
User avatar
Cholmondely
Archivist
Archivist
Posts: 5290
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Attempting to get 1.91 built on Mac

Post by Cholmondely »

Commander_X wrote: Wed Jun 26, 2024 4:00 pm
another_commander wrote: Mon Jun 24, 2024 11:10 am
[...] You could upload your binaries somewhere though, so Mac users could attempt a test run on actual Apple hardware instead of emulated.
I am actually wondering that our wiki master didn't already offer :-D
Ahem! And just what is a "binary" supposed to be? I've been following these conversations without any understanding of what's being discussed...

Also - I've no great idea as to how much memory our wiki uses - or how it impacts on Winston's putting his hand in his pocket each month to pay for it all...
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4821
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Attempting to get 1.91 built on Mac

Post by phkb »

A binary in this instance is the result of the compilation process. When you “build” the game, you end up with a binary file which is the executable part of the game. It’s the thing you run to play the game.
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 673
Joined: Sat Aug 09, 2014 4:16 pm

Re: Attempting to get 1.91 built on Mac

Post by Commander_X »

Cholmondely wrote: Wed Jun 26, 2024 7:19 pm
[...]
Also - I've no great idea as to how much memory our wiki uses - or how it impacts on Winston's putting his hand in his pocket each month to pay for it all...
Apologies if the appellative I used caused offense, let me state that none was intended.
User avatar
hiran
Theorethicist
Posts: 2358
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Attempting to get 1.91 built on Mac

Post by hiran »

For years we have been sharing OXPs on various sites - it used to be in the OXP author's hands to find a suitable location. And it took long until the practice evolved to host them in one site for easier maintenance.

But these other mechanisms still exist and can be used. So I want to remind you of sites like Dropbox, Box, various WebDAV or 'Drive' sites or tools like eMule and BitTorrent.

Should the latter be problematic as the files get shared to potentially everyone some PGP encryption could be applied.
Sunshine - Moonlight - Good Times - Oolite
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4821
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Attempting to get 1.91 built on Mac

Post by phkb »

OK, I really truly have no idea whether this work work or not. The most likely result will be an error I haven't been able to get to yet, so this might be worthless. But as I don't have a real Mac to do any testing on...

(edit: link removed - see later posts)

I've tried to give this the same folder structure as the official 1.90 release zip has. I just left out "Extras", because the only thing in that is the BBC Keys keyconfig file, which wouldn't work with this build anyway.

So, yeah. If you have a Mac, and feeling brave, carefully download the zip file, extract, and very, very gently run the app. Don't make too many loud noises while you're doing it.

All care taken, etc etc. Make sure you have backups, don't load your main save game into this (if you even get that far). I'm flying blind here, folks.
User avatar
MrFlibble
---- E L I T E ----
---- E L I T E ----
Posts: 313
Joined: Sun Feb 18, 2024 12:13 pm

Re: Attempting to get 1.91 built on Mac

Post by MrFlibble »

phkb wrote: Thu Jun 27, 2024 10:48 am
OK, I really truly have no idea whether this work work or not. The most likely result will be an error I haven't been able to get to yet, so this might be worthless. But as I don't have a real Mac to do any testing on...

Mac_Oolite_1.91_ExperimentalBuild.zip

I've tried to give this the same folder structure as the official 1.90 release zip has. I just left out "Extras", because the only thing in that is the BBC Keys keyconfig file, which wouldn't work with this build anyway.

So, yeah. If you have a Mac, and feeling brave, carefully download the zip file, extract, and very, very gently run the app. Don't make too many loud noises while you're doing it.

All care taken, etc etc. Make sure you have backups, don't load your main save game into this (if you even get that far). I'm flying blind here, folks.
Hackintosh Vetura 13.6.7 x86 libvirt-qemu-KVM

Runs 1.90, poorly.

Double clicked the app:
The application "Oolite" can't be opened.

Code: Select all

cd Desktop/Mac_Oolite_1.91_ExperimentalBuild/Oolite.app/Contents/MacOS

% file Oolite 
Oolite: Mach-O 64-bit executable x86_64 <- not a real mac, I know.

% ls -al Oolite 
-rw-r--r--@ 1 mrflibble  staff  8808848 27 Jun  2024 Oolite

# 644 No executable bits!

% chmod 755 Oolite
% ls -al Oolite 

-rwxr-xr-x@ 1 mrflibble  staff  8808848 27 Jun  2024 Oolite

# Better.

Double clicked the app again. Was greeted with standard 'Won't run. Unknown dev.'

Right clicked the app, selected 'open'. Yay!... Oh!
Oolite failed to start up, because an unhandled exception occurred.

An exception of type OoliteOpenGLTooOldException occurred. If this problem persists, please file a bug report.
Guess next time I have some spare beans I'll have to get down Cex and buy a suitable graphics card to hand-off to the VM!

Latest.log

Code: Select all

Opening log for Oolite version 1.91 (x86-64 test release) under Mac OS X Version 13.6.7 (Build 22G720) at 2024-06-27 15:27:23 +0000.
Machine type: iMacPro1,1, 8192 MiB memory, 2 x x86 (Penryn) @ 3200 MHz.
Build options: OpenAL, GLSL shaders, new planets, JavaScript console support, Debug plug-in support, OXP verifier, localization tools, debug GraphViz support, JavaScript profiling.

Note that the contents of the log file can be adjusted by editing logcontrol.plist.

16:27:23.720 [dataCache.rebuild]: Data cache version (1.90) does not match Oolite version (1.91), rebuilding cache.
16:27:25.294 [testing]: setting gl versions
16:27:25.522 [joystick.error.init]: Cannot open HID manager; joystick support will not function.
16:27:25.523 [rendering.opengl.version]: OpenGL renderer version: 2.1.0 ("2.1 APPLE-20.5.2"). Vendor: "Apple Inc.". Renderer: "Apple Software Renderer".
16:27:25.523 [rendering.opengl.extensions]: OpenGL extensions (133):
GL_EXT_texture_compression_dxt1, GL_EXT_rescale_normal, GL_EXT_transform_feedback, GL_EXT_blend_func_separate, GL_EXT_framebuffer_sRGB, GL_ATI_texture_env_combine3, GL_ARB_draw_elements_base_vertex, GL_EXT_debug_label, GL_EXT_geometry_shader4, GL_EXT_secondary_color, GL_EXT_separate_specular_color, GL_EXT_shadow_funcs, GL_NV_texgen_reflection, GL_NV_blend_square, GL_ARB_texture_compression_rgtc, GL_EXT_stencil_wrap, GL_ARB_texture_env_crossbar, GL_EXT_framebuffer_blit, GL_EXT_bindable_uniform, GL_ATI_separate_stencil, GL_APPLE_vertex_point_size, GL_EXT_texture_rectangle, GL_APPLE_specular_vector, GL_EXT_packed_depth_stencil, GL_EXT_blend_color, GL_ARB_fragment_program_shadow, GL_EXT_texture_env_add, GL_ARB_imaging, GL_EXT_provoking_vertex, GL_EXT_texture_array, GL_ARB_texture_env_combine, GL_ARB_point_sprite, GL_ARB_multisample, GL_EXT_framebuffer_object, GL_ARB_framebuffer_sRGB, GL_EXT_texture_lod_bias, GL_APPLE_pixel_buffer, GL_ARB_vertex_program, GL_EXT_bgra, GL_APPLE_fence, GL_APPLE_ycbcr_422, GL_EXT_timer_query, GL_EXT_vertex_array_bgra, GL_ARB_depth_clamp, GL_IBM_rasterpos_clip, GL_ARB_pixel_buffer_object, GL_SGIS_generate_mipmap, GL_EXT_framebuffer_multisample_blit_scaled, GL_ARB_shader_texture_lod, GL_ARB_texture_float, GL_ARB_texture_rectangle, GL_ARB_vertex_shader, GL_NV_texture_barrier, GL_ARB_provoking_vertex, GL_ARB_texture_env_add, GL_ARB_texture_env_dot3, GL_APPLE_rgb_422, GL_NV_depth_clamp, GL_ARB_texture_mirrored_repeat, GL_ARB_texture_cube_map, GL_APPLE_element_array, GL_ATI_texture_float, GL_ARB_window_pos, GL_ARB_sync, GL_ARB_vertex_buffer_object, GL_APPLE_texture_range, GL_ATI_texture_compression_3dc, GL_EXT_stencil_two_side, GL_ARB_texture_compression, GL_ARB_instanced_arrays, GL_EXT_blend_minmax, GL_ARB_texture_border_clamp, GL_EXT_draw_buffers2, GL_ARB_shading_language_100, GL_EXT_blend_equation_separate, GL_ARB_vertex_blend, GL_EXT_blend_subtract, GL_EXT_packed_float, GL_APPLE_aux_depth_stencil, GL_APPLE_row_bytes, GL_NV_conditional_render, GL_NV_light_max_exponent, GL_EXT_abgr, GL_EXT_texture_filter_anisotropic, GL_ARB_vertex_array_bgra, GL_ARB_draw_buffers, GL_ARB_transpose_matrix, GL_ARB_color_buffer_float, GL_EXT_gpu_program_parameters, GL_APPLE_client_storage, GL_ARB_texture_non_power_of_two, GL_ARB_multitexture, GL_EXT_gpu_shader4, GL_APPLE_flush_render, GL_ARB_framebuffer_object, GL_APPLE_vertex_program_evaluators, GL_APPLE_transform_hint, GL_EXT_texture_compression_s3tc, GL_APPLE_flush_buffer_range, GL_EXT_texture_integer, GL_SGIS_texture_edge_clamp, GL_EXT_texture_mirror_clamp, GL_ARB_occlusion_query, GL_ARB_fragment_shader, GL_ARB_texture_rg, GL_NV_fog_distance, GL_ARB_fragment_program, GL_ARB_seamless_cube_map, GL_ARB_shader_objects, GL_EXT_draw_range_elements, GL_APPLE_vertex_array_object, GL_ARB_depth_texture, GL_EXT_texture_sRGB, GL_ARB_half_float_vertex, GL_APPLE_vertex_array_range, GL_ARB_shadow, GL_EXT_multi_draw_arrays, GL_ARB_half_float_pixel, GL_APPLE_packed_pixels, GL_ARB_point_parameters, GL_EXT_debug_marker, GL_EXT_texture_sRGB_decode, GL_EXT_clip_volume_hint, GL_EXT_depth_bounds_test, GL_SGIS_texture_lod, GL_EXT_fog_coord, GL_EXT_texture_shared_exponent, GL_ATI_texture_mirror_once, GL_ARB_shadow_ambient, GL_EXT_framebuffer_multisample, GL_APPLE_float_pixels, GL_ARB_depth_buffer_float, GL_ARB_draw_instanced
16:27:25.523 [rendering.opengl.version.insufficient]: ***** Oolite requires OpenGL version 3.3 or later.
16:27:25.523 [startup.exception]: ***** Unhandled exception during startup: OoliteOpenGLTooOldException (Oolite requires at least OpenGL 3.3. You have 2.1 ("2.1 APPLE-20.5.2").).
User avatar
Cholmondely
Archivist
Archivist
Posts: 5290
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Attempting to get 1.91 built on Mac

Post by Cholmondely »

Downloaded.

Unzipped.

Clicked on the Oolite icon: "The application "Oolite" can't be opened".

No difference whether I held down the control button or not. But I did not get the usual greeting "Get lost - the developer of this game did not give us oodles of dosh and we refuse to let your computer do anything useful with it" (or words to that affect. This can usually be tamed by holding down the caontrol key while trying to open the application. Unusually, not needed here...).

AppleMac with Intel chip (1.1 GHz Dual-Core Intel Core i3) and thus slightly older Operating System (Catalina 10.15.3)
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6654
Joined: Wed Feb 28, 2007 7:54 am

Re: Attempting to get 1.91 built on Mac

Post by another_commander »

Log file?
Post Reply