Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

openal-soft doesn't build without pthread-emb #84

Open
sharkwouter opened this issue Aug 7, 2021 · 12 comments
Open

openal-soft doesn't build without pthread-emb #84

sharkwouter opened this issue Aug 7, 2021 · 12 comments

Comments

@sharkwouter
Copy link
Member

Since pthread is implemented by newlib, it would make sense if openal-soft could build without the pthread-emb library installed. This is unfortunately not the case.

Here the build log:

patching file Alc/ALc.c
patching file Alc/backends/alsa.c
patching file Alc/backends/dsound.c
patching file Alc/backends/mmdevapi.c
patching file Alc/backends/oss.c
patching file Alc/backends/solaris.c
patching file Alc/backends/wave.c
patching file Alc/backends/winmm.c
patching file OpenAL32/Include/alu.h
==> Starting build()...
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29") 
-- The C compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/local/pspdev/bin/psp-gcc
-- Check for working C compiler: /usr/local/pspdev/bin/psp-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of long
-- Check size of long - done
-- Check size of long long
-- Check size of long long - done
-- Performing Test HAVE_RESTRICT
-- Performing Test HAVE_RESTRICT - Success
-- Performing Test HAVE___RESTRICT
-- Performing Test HAVE___RESTRICT - Success
-- Checking if C compiler supports -Wextra
-- Checking if C compiler supports -Wextra - Success
-- Performing Test HAVE_GCC_DESTRUCTOR
-- Performing Test HAVE_GCC_DESTRUCTOR - Success
-- Performing Test HAVE_GCC_PROTECTED_VISIBILITY
-- Performing Test HAVE_GCC_PROTECTED_VISIBILITY - Success
-- Checking if C compiler supports -fvisibility=internal
-- Checking if C compiler supports -fvisibility=internal - Success
-- Performing Test HAVE_GCC_FORMAT
-- Performing Test HAVE_GCC_FORMAT - Success
-- Looking for fenv.h
-- Looking for fenv.h - not found
-- Looking for fpu_control.h
-- Looking for fpu_control.h - not found
-- Looking for float.h
-- Looking for float.h - found
-- Looking for ieeefp.h
-- Looking for ieeefp.h - found
-- Looking for guiddef.h
-- Looking for guiddef.h - not found
-- Looking for initguid.h
-- Looking for initguid.h - not found
-- Looking for arm_neon.h
-- Looking for arm_neon.h - not found
-- Looking for pow in m
-- Looking for pow in m - found
-- Looking for powf
-- Looking for powf - found
-- Looking for sqrtf
-- Looking for sqrtf - found
-- Looking for cosf
-- Looking for cosf - found
-- Looking for sinf
-- Looking for sinf - found
-- Looking for acosf
-- Looking for acosf - found
-- Looking for asinf
-- Looking for asinf - found
-- Looking for atanf
-- Looking for atanf - found
-- Looking for atan2f
-- Looking for atan2f - found
-- Looking for fabsf
-- Looking for fabsf - found
-- Looking for log10f
-- Looking for log10f - found
-- Looking for floorf
-- Looking for floorf - found
-- Looking for strtof
-- Looking for strtof - found
-- Looking for _controlfp
-- Looking for _controlfp - found
-- Looking for stat
-- Looking for stat - found
-- Looking for strcasecmp
-- Looking for strcasecmp - found
-- Looking for strncasecmp
-- Looking for strncasecmp - found
-- Looking for snprintf
-- Looking for snprintf - found
-- Looking for vsnprintf
-- Looking for vsnprintf - found
-- Looking for isfinite
-- Looking for isfinite - found
-- Looking for isnan
-- Looking for isnan - found
-- Looking for dlfcn.h
CMake Warning (dev) at /usr/share/cmake-3.13/Modules/CheckIncludeFile.cmake:70 (message):
  Policy CMP0075 is not set: Include file check macros honor
  CMAKE_REQUIRED_LIBRARIES.  Run "cmake --help-policy CMP0075" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  CMAKE_REQUIRED_LIBRARIES is set to:

    m

  For compatibility with CMake 3.11 and below this check is ignoring it.
Call Stack (most recent call first):
  CMakeLists.txt:325 (CHECK_INCLUDE_FILE)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Looking for dlfcn.h - not found
-- Looking for windows.h
-- Looking for windows.h - not found
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Looking for nanosleep
-- Looking for nanosleep - found
-- Checking if C compiler supports -pthread
-- Checking if C compiler supports -pthread - Failed
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for include files pthread.h, pthread_np.h
-- Looking for include files pthread.h, pthread_np.h - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Looking for pthread_setschedparam in pthread
-- Looking for pthread_setschedparam in pthread - found
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- Looking for timeGetTime in winmm
-- Looking for timeGetTime in winmm - not found.
-- Looking for alsa/asoundlib.h
-- Looking for alsa/asoundlib.h - not found
-- Looking for sys/soundcard.h
-- Looking for sys/soundcard.h - not found
-- Looking for sys/audioio.h
-- Looking for sys/audioio.h - not found
-- Looking for sndio.h
-- Looking for sndio.h - not found
-- Looking for dsound.h
-- Looking for dsound.h - not found
-- Looking for portaudio.h
-- Looking for portaudio.h - not found
-- Looking for pulse/pulseaudio.h
-- Looking for pulse/pulseaudio.h - not found
-- Looking for /System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h
-- Looking for /System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h - not found
-- Looking for include files SLES/OpenSLES.h, SLES/OpenSLES_Android.h
-- Looking for include files SLES/OpenSLES.h, SLES/OpenSLES_Android.h - not found
CMake Warning (dev) at CMakeLists.txt:692 (ADD_LIBRARY):
  ADD_LIBRARY called with SHARED option but the target platform does not
  support dynamic linking.  Building a STATIC library instead.  This may lead
  to problems.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- 
-- Building OpenAL with support for the following backends:
--      WaveFile, Null
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14
Scanning dependencies of target openal
[  3%] Building C object CMakeFiles/openal.dir/OpenAL32/alBuffer.c.obj
[ 14%] Building C object CMakeFiles/openal.dir/OpenAL32/alError.c.obj
[ 14%] Building C object CMakeFiles/openal.dir/OpenAL32/alExtension.c.obj
[ 14%] Building C object CMakeFiles/openal.dir/OpenAL32/alFilter.c.obj
[ 17%] Building C object CMakeFiles/openal.dir/OpenAL32/alListener.c.obj
[ 21%] Building C object CMakeFiles/openal.dir/OpenAL32/alAuxEffectSlot.c.obj
[ 25%] Building C object CMakeFiles/openal.dir/OpenAL32/alEffect.c.obj
[ 28%] Building C object CMakeFiles/openal.dir/OpenAL32/alSource.c.obj
In file included from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alListener.c:23:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alMain.h:111:9: error: unknown type name ‘pthread_mutex_t’
  111 | typedef pthread_mutex_t CRITICAL_SECTION;
      |         ^~~~~~~~~~~~~~~
In file included from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alMain.h:345,
                 from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alListener.c:23:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alu.h: In function ‘SetMixerFPUMode’:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alu.h:242:16: warning: implicit declaration of function ‘_controlfp’ [-Wimplicit-function-declaration]
  242 |     fpuState = _controlfp(0, 0);
      |                ^~~~~~~~~~
In file included from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alBuffer.c:28:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alMain.h:111:9: error: unknown type name ‘pthread_mutex_t’
  111 | typedef pthread_mutex_t CRITICAL_SECTION;
      |         ^~~~~~~~~~~~~~~
In file included from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alError.c:25:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alMain.h:111:9: error: unknown type name ‘pthread_mutex_t’
  111 | typedef pthread_mutex_t CRITICAL_SECTION;
      |         ^~~~~~~~~~~~~~~
In file included from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alFilter.c:27:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alMain.h:111:9: error: unknown type name ‘pthread_mutex_t’
  111 | typedef pthread_mutex_t CRITICAL_SECTION;
      |         ^~~~~~~~~~~~~~~
In file included from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alExtension.c:28:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alMain.h:111:9: error: unknown type name ‘pthread_mutex_t’
  111 | typedef pthread_mutex_t CRITICAL_SECTION;
      |         ^~~~~~~~~~~~~~~
In file included from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alAuxEffectSlot.c:28:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alMain.h:111:9: error: unknown type name ‘pthread_mutex_t’
  111 | typedef pthread_mutex_t CRITICAL_SECTION;
      |         ^~~~~~~~~~~~~~~
In file included from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alMain.h:345,
                 from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alBuffer.c:28:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alu.h: In function ‘SetMixerFPUMode’:
In file included from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alMain.h:345,
                 from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alError.c:25:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alu.h: In function ‘SetMixerFPUMode’:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alu.h:242:16: warning: implicit declaration of function ‘_controlfp’ [-Wimplicit-function-declaration]
  242 |     fpuState = _controlfp(0, 0);
      |                ^~~~~~~~~~
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alu.h:242:16: warning: implicit declaration of function ‘_controlfp’ [-Wimplicit-function-declaration]
  242 |     fpuState = _controlfp(0, 0);
      |                ^~~~~~~~~~
In file included from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alMain.h:345,
                 from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alFilter.c:27:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alu.h: In function ‘SetMixerFPUMode’:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alu.h:242:16: warning: implicit declaration of function ‘_controlfp’ [-Wimplicit-function-declaration]
  242 |     fpuState = _controlfp(0, 0);
      |                ^~~~~~~~~~
make[2]: *** [CMakeFiles/openal.dir/build.make:141: CMakeFiles/openal.dir/OpenAL32/alListener.c.obj] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alMain.h:345,
                 from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alExtension.c:28:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alu.h: In function ‘SetMixerFPUMode’:
In file included from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alSource.c:26:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alMain.h:111:9: error: unknown type name ‘pthread_mutex_t’
  111 | typedef pthread_mutex_t CRITICAL_SECTION;
      |         ^~~~~~~~~~~~~~~
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alu.h:242:16: warning: implicit declaration of function ‘_controlfp’ [-Wimplicit-function-declaration]
  242 |     fpuState = _controlfp(0, 0);
      |                ^~~~~~~~~~
In file included from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alMain.h:345,
                 from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alAuxEffectSlot.c:28:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alu.h: In function ‘SetMixerFPUMode’:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alu.h:242:16: warning: implicit declaration of function ‘_controlfp’ [-Wimplicit-function-declaration]
  242 |     fpuState = _controlfp(0, 0);
      |                ^~~~~~~~~~
make[2]: *** [CMakeFiles/openal.dir/build.make:102: CMakeFiles/openal.dir/OpenAL32/alError.c.obj] Error 1
In file included from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alMain.h:345,
                 from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alSource.c:26:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alu.h: In function ‘SetMixerFPUMode’:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alu.h:242:16: warning: implicit declaration of function ‘_controlfp’ [-Wimplicit-function-declaration]
  242 |     fpuState = _controlfp(0, 0);
      |                ^~~~~~~~~~
In file included from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alExtension.c:25:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alExtension.c: In function ‘alIsExtensionPresent’:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alExtension.c:359:48: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  359 |                (ptr[len] == '\0' || isspace(ptr[len])))
      |                                             ~~~^~~~~
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alExtension.c:368:33: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  368 |                 } while(isspace(*ptr));
      |                                 ^~~~
make[2]: *** [CMakeFiles/openal.dir/build.make:115: CMakeFiles/openal.dir/OpenAL32/alExtension.c.obj] Error 1
make[2]: *** [CMakeFiles/openal.dir/build.make:128: CMakeFiles/openal.dir/OpenAL32/alFilter.c.obj] Error 1
In file included from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alEffect.c:28:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alMain.h:111:9: error: unknown type name ‘pthread_mutex_t’
  111 | typedef pthread_mutex_t CRITICAL_SECTION;
      |         ^~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/openal.dir/build.make:63: CMakeFiles/openal.dir/OpenAL32/alAuxEffectSlot.c.obj] Error 1
In file included from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alMain.h:345,
                 from /home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/alEffect.c:28:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alu.h: In function ‘SetMixerFPUMode’:
/home/wouter/Sources/psplibraries/openal-soft/src/openal-soft-1.14/OpenAL32/Include/alu.h:242:16: warning: implicit declaration of function ‘_controlfp’ [-Wimplicit-function-declaration]
  242 |     fpuState = _controlfp(0, 0);
      |                ^~~~~~~~~~
make[2]: *** [CMakeFiles/openal.dir/build.make:154: CMakeFiles/openal.dir/OpenAL32/alSource.c.obj] Error 1
make[2]: *** [CMakeFiles/openal.dir/build.make:89: CMakeFiles/openal.dir/OpenAL32/alEffect.c.obj] Error 1
make[2]: *** [CMakeFiles/openal.dir/build.make:76: CMakeFiles/openal.dir/OpenAL32/alBuffer.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/openal.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
@sharkwouter
Copy link
Member Author

@isage
Copy link

isage commented Nov 11, 2021

Since pthread is implemented by newlib

Is it, though? newlib implements posix-threads only when targeting windows (cygwin).

@sharkwouter
Copy link
Member Author

I'm not quite sure what it implements, but it's not enough to drop pthread-emb, but installing pthread-emb will overwrite a header file from newlib. This makes it so psp-pacman cannot install it, so it was a blocker there. I think @fjtrujy has found a solution for it in his fork of the psp toolchain.

@fjtrujy
Copy link
Member

fjtrujy commented Nov 11, 2021

I'm not quite sure what it implements, but it's not enough to drop pthread-emb, but installing pthread-emb will overwrite a header file from newlib. This makes it so psp-pacman cannot install it, so it was a blocker there. I think @fjtrujy has found a solution for it in his fork of the psp toolchain.

Exactly, so the current Pthread embedded overrides some headers from newlib, it has issues when using pacman, but using the override property, it works

@isage
Copy link

isage commented Nov 11, 2021

newlib header files should be synchronized with pthread-emb. pthread-emb should override newlib headers, as it's the only working implementation (newlib only has headers).
honestly, i think pthread-emb should be part of toolchain, not a separate package

@fjtrujy
Copy link
Member

fjtrujy commented Nov 11, 2021

newlib header files should be synchronized with pthread-emb. pthread-emb should override newlib headers, as it's the only working implementation (newlib only has headers). honestly, i think pthread-emb should be part of toolchain, not a separate package

I think that synchronize newlib header with pthread embedded headers is a waste of time.... making future upgrades of newlib more difficult.

The problem is that for compiling pthread embedded you require to have pspsdk already, however with the new toolchain implementation one of the major points is to separate the dependency between the toolchain and the pspsdk, so I think that pthread can not be part of the toolchain, unfortunately.

In my opinion, the only valid and perfect way of using pthread is to include them as part of the pspsdk where we just implement the pthread as it is defined in the newlib headers, that's all (but it requires a lot of work and dedication).

Thanks

@isage
Copy link

isage commented Nov 11, 2021

It doesn't make upgrading newlib more difficult. Headers live in sys/psp.

@fjtrujy
Copy link
Member

fjtrujy commented Nov 11, 2021

It doesn't make upgrading newlib more difficult. Headers live in sys/psp.

I know, but you have a bigger newlib patch.
I prefer to have thing as much as possible mainstream, to see if they can be merged.

Anyway, what do you earn putting "legacy pthread headers" in "newlib"?

@isage
Copy link

isage commented Nov 11, 2021

How are they legacy, pthread-emb being the only working impl?
R/n buildscripts fail to even build pthread-emb. The one in pspsdk and the one in vitasdk (which i kept compatible and buildable with pspsdk and they were working fine like couple of months ago)

@fjtrujy
Copy link
Member

fjtrujy commented Nov 11, 2021

I don't know where you want to go.....

As probably you know I'm doing a big change in the whole psptoolchain, making it more POSIX.

If there are things that you don't like, as usual PR are more than welcome.

I just can tell you that with my current approach (still pending to create all the PRs) RetroArch which uses pthread is working as expected, not sure if there are other issues

@sharkwouter
Copy link
Member Author

Here is the related issue: #83

@fjtrujy
Copy link
Member

fjtrujy commented Nov 11, 2021

This is why I still think that the best solution is to do a new pthread implementation in pspsdk repo, generating libpthread.a that satisfies the newlib headers.

However this isn't a easy task.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants