Project

General

Profile

Actions

Emulator Issues #1141

closed

Mac OS X build problems since svn r3775 with Atomic operations library

Added by celgilles over 15 years ago. Updated 11 months ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

What steps will reproduce the problem?

  1. Building svn r3775 and up with Atomic operations library breaks the compilation (r3774 works
    fine, even SMSunshine works on OS X 10.5.7)
    2.
    3.

What is the expected output? What do you see instead?
Compiling Build/Darwin-i386-release/Source/Core/AudioCommon/Src/AOSoundStream.o
Source/Core/Common/Src/Atomic_GCC.h: In function 'void Common::AtomicAdd(volatile u32&,
u32)':
Source/Core/Common/Src/Atomic_GCC.h:43: error: '__sync_add_and_fetch' was not declared in
this scope
Source/Core/Common/Src/Atomic_GCC.h: In function 'void Common::AtomicIncrement(volatile
u32&)':
Source/Core/Common/Src/Atomic_GCC.h:48: error: '__sync_add_and_fetch' was not declared in
this scope
Source/Core/Common/Src/Atomic_GCC.h: In function 'u32 Common::AtomicLoadAcquire(volatile
u32&)':
Source/Core/Common/Src/Atomic_GCC.h:55: error: '__sync_synchronize' was not declared in
this scope
Source/Core/AudioCommon/Src/Mixer.h: At global scope:
Source/Core/AudioCommon/Src/Mixer.h:29: warning: 'class CMixer' has virtual functions but
non-virtual destructor
scons: *** [Build/Darwin-i386-release/Source/Core/AudioCommon/Src/AOSoundStream.o]
Error 1
scons: building terminated because of errors.

Please use labels and text to provide additional information.

I tried to add #include "Atomic.h" to Core.h / Thread.h / CommandProcessor.h which partly
works but for "AOSoundStream" it breaks up the compilation.
Mac OS X 10.5.7 Intel with XCode 3.1.3 (gcc 4.0.1).
All revision < 3774 works well (and even launches Gamecube games)

Thanks for your patience ;-)

gilcel


Related issues 1 (0 open1 closed)

Is duplicate of Emulator - Emulator Issues #889: Dolphin Doesn't Work in Mac OS XFixed

Actions
Actions #1

Updated by nakeee over 15 years ago

those atomic operations were added in gcc 4.1 or 4.2 you are using 4.0.1

Actions #2

Updated by Sonicadvance1 over 15 years ago

nothing I can do.

Actions #3

Updated by celgilles over 15 years ago

Yuhuu! Compilation works again! nakeee and SonicAdvance, thanks for the tip for installing gcc-4.2. Indeed
this will fix the Atomic library compile error.
In fact if you install Apple's XCode 3.1.x it installs also gcc-4.2!

So I succesfully compiled dolphin svn-3851 on Mac OS X INTEL and it works much better (I get about 60fps on
Super Mario Sunshine) with my iMac 24" Core 2 Duo with ATI Radeon HD2600, before I got about 16fps!!!
Unbelievable!
Instructions here:

  1. Install all the prerequirements from Mac OS X Build page (I even updated nvidia cgtoolkit to version 2.2)
  2. Install Apple XCode 3.1.3 (free download from http://connect.apple.com ), this will also install "gcc-4.2" in
    /usr/bin/
  3. Change root SConstruct (dolphin-emu-read-only/SConstruct) line 122 and 123 to use version 4.2 of gcc
    compiler to read:

('CC', 'The c compiler', 'gcc-4.2'),
('CXX', 'The c++ compiler', 'g++-4.2'),

  1. If you get compile error:
    Compiling Build/Darwin-i386-release/Source/Core/AudioCommon/Src/OpenALStream.o
    Source/Core/AudioCommon/Src/OpenALStream.cpp: In member function 'virtual bool OpenALStream::Start()':
    Source/Core/AudioCommon/Src/OpenALStream.cpp:38: error: invalid conversion from 'ALCubyte*' to 'const
    ALCchar*'
    Source/Core/AudioCommon/Src/OpenALStream.cpp:38: error: initializing argument 1 of 'ALCdevice*
    alcOpenDevice(const ALCchar*)'
    scons: *** [Build/Darwin-i386-release/Source/Core/AudioCommon/Src/OpenALStream.o] Error 1

This is due to a bad Header linking (the one from openal library on your system). We fix it by just linking it to
the dolphin-emu's openal headers in "Externals" library.It's easy: just change line 30 and 32
Source/Core/AudioCommon/Src/OpenALStream.h from
elif defined(APPLE)
#include "openal/al.h"
#include "openal/alc.h"
to:
elif defined(APPLE)
#include "../../../../Externals/OpenAL/include/al.h"
#include "../../../../Externals/OpenAL/include/alc.h"

Compile it with 'scons' and it should work (if it crashes just delete your 'User' folder in ~/Library/Application
Support/Dolphin). Then start Dolphin again, configure your "Plugins" from the "Config" Menu, load a game and
it should hopefully work.

So in fact kind dolphin-emu developers should just update:

  1. SConstruct (with a condition for APPLE to use gcc-4.2 and g++-4.2
  2. Change the line 32-33 of Source/Core/AudioCommon/Src/OpenALStream.h to use dolphin's OpenAL
    library!

Dear Developers: Can this be done please ? That would be soooo great!

Actions #4

Updated by marcus over 15 years ago

  • Status changed from New to Invalid
Actions #5

Updated by MonkMad2 over 15 years ago

Thank you ! I second the dev request!

Actions #6

Updated by sl1nk3.s over 15 years ago

So in fact kind dolphin-emu developers should just update:

  1. SConstruct (with a condition for APPLE to use gcc-4.2 and g++-4.2
  2. Change the line 32-33 of Source/Core/AudioCommon/Src/OpenALStream.h to use
    dolphin's OpenAL
    library!

I'll see if i can do something about it :)

Actions #7

Updated by celgilles over 15 years ago

Update: To change SConstruct so that Mac OS X should use gcc-4.2 just addd the following lines of code after
line 123 (after vars.AddVariables())

if sys.platform == 'darwin':
vars.AddVariables(
('CC', 'The c compiler', 'gcc-4.2'),
('CXX', 'The c++ compiler', 'g++-4.2') )

Then some kind developer needs just to change line 32-33 of
Source/Core/AudioCommon/Src/OpenALStream.h as mentioned before

thanks

Actions #8

Updated by celgilles over 15 years ago

Please use the following files for building dolphin-svn on Mac OS X (used on svn-3856, it actually works
great! Even Dualcore support works and is very fast indeed. )

  1. "SConstruct" > replace it the root of your dolphin-emu-read-only directory... it adds compatibility with the
    Atomic library on Mac OS X (just added code to use gcc-4.2 and g++-4.2, see previous message). You must
    use Apple's XCode 3.1.3 for this (3.1.2 should also be fine)

  2. and OpenALStream.h. Copy this file to Source/Core/AudioCommon/Src/OpenALStream.h (it will then use
    dolphin's OpenAL lib instead of Mac OS X)

hope this helps

Actions #9

Updated by sl1nk3.s over 15 years ago

  • Status changed from Invalid to Duplicate

Please, tell me if the patch included here would work, i never used the scons thing
myself so i don't really know how it works :o
That might be something worth committing if it actually helps compilation and
wxWidget issues on Macs.

Actions #10

Updated by sl1nk3.s over 15 years ago

woops, here's the patch :

Actions #11

Updated by moosereilly about 14 years ago

where does the patch go and how to use it

Actions

Also available in: Atom PDF