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

Fix macOS PowerPC #55

Closed
wants to merge 1 commit into from

Conversation

barracuda156
Copy link

Fixes: #54

@barracuda156
Copy link
Author

@lmailletcontoz Could you please take a look at this, and another two PRs below?
I have 100% tests passing now on macOS PowerPC.

@maehne
Copy link
Contributor

maehne commented Aug 29, 2023

@pah: Could you have a look on this PR and the associated issue?

@lmailletcontoz
Copy link
Contributor

PowerPC is only supported using POSIX threads in SystemC 3.0.0

@barracuda156
Copy link
Author

@lmailletcontoz @maehne You still have ppc64 broken though in 3.0.0: there is no define for it in CMakeLists.

@maehne
Copy link
Contributor

maehne commented Dec 13, 2023

@lmailletcontoz: Please reopen so that maybe @pah can have a second look.

@barracuda156
Copy link
Author

@maehne I have rebased to master and dropped QuickThreads addition as unneeded now.

@lmailletcontoz
Copy link
Contributor

configuration no longer supported

@barracuda156
Copy link
Author

@lmailletcontoz We are not taking about QuickThreads here anymore.

Macros here have ppc but lack ppc64:

systemc/CMakeLists.txt

Lines 335 to 336 in bec1010

check_symbol_exists (__ppc__ "" HAS__ppc__DEFINED)
check_symbol_exists (__powerpc "" HAS__powerpc_DEFINED)

Macros here have neither:

systemc/CMakeLists.txt

Lines 339 to 427 in bec1010

# Set SystemC_TARGET_ARCH according to the detected
# OS/processor/compiler platform
if (NOT SystemC_TARGET_ARCH)
if (DEFINED ENV{SYSTEMC_TARGET_ARCH})
message (STATUS "Using SYSTEMC_TARGET_ARCH from the environment.")
set (_TARGET_ARCH $ENV{SYSTEMC_TARGET_ARCH})
elseif (APPLE)
if (N_OSX_ARCHITECTURES GREATER 1)
set (_TARGET_ARCH "macosuniversal")
elseif (HAS__aarch64__DEFINED)
set (_TARGET_ARCH "macosarm64")
elseif (HAS__x86_64__DEFINED)
set (_TARGET_ARCH "macosx64")
else (N_OSX_ARCHITECTURES GREATER 1)
set (_TARGET_ARCH "macosunknown")
endif (N_OSX_ARCHITECTURES GREATER 1)
elseif (UNIX AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
if (HAS__i386_DEFINED)
set (_TARGET_ARCH "linux")
elseif (HAS__x86_64__DEFINED)
set (_TARGET_ARCH "linux64")
elseif (HAS__aarch64__DEFINED)
set (_TARGET_ARCH "linuxaarch64")
elseif (HAS__powerpc_DEFINED)
# Untested platform.
set (_TARGET_ARCH "linuxppc")
elseif (HAS__sparc_DEFINED OR HAS__sparc__DEFINED)
# Untested platform.
set (_TARGET_ARCH "linuxsparc")
else (HAS__i386_DEFINED)
# Untested platform.
set (_TARGET_ARCH "linuxunknown")
endif (HAS__i386_DEFINED)
elseif (UNIX AND CMAKE_SYSTEM_NAME MATCHES ".*BSD")
if (HAS__i386_DEFINED)
set (_TARGET_ARCH "bsd")
elseif (HAS__x86_64__DEFINED)
set (_TARGET_ARCH "bsd64")
else (HAS__i386_DEFINED)
# Untested platform.
set (_TARGET_ARCH "bsdunknown")
endif (HAS__i386_DEFINED)
elseif (UNIX AND CMAKE_SYSTEM_NAME STREQUAL "SunOS"
AND (HAS__sparc_DEFINED OR HAS__sparc__DEFINED))
# Untested platform.
set (_TARGET_ARCH "sparcOS5")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set (_TARGET_ARCH "gcc${_TARGET_ARCH}")
endif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
elseif (UNIX AND CMAKE_SYSTEM_NAME STREQUAL "HP-UX" AND HAS__hppa_DEFINED)
# Untested platform.
set (_TARGET_ARCH "hpux11")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set (_TARGET_ARCH "gcc${_TARGET_ARCH}")
endif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if (HAS__LP64__DEFINED)
set (_TARGET_ARCH "${_TARGET_ARCH}64")
endif (HAS__LP64__DEFINED)
elseif (MSVC)
set (_TARGET_ARCH "msvc")
if (CMAKE_CL_64)
set (_TARGET_ARCH "${_TARGET_ARCH}64")
endif (CMAKE_CL_64)
elseif (CYGWIN)
if (HAS__i386_DEFINED)
set (_TARGET_ARCH "cygwin")
elseif (HAS__x86_64__DEFINED)
set (_TARGET_ARCH "cygwin64")
else (HAS__i386_DEFINED)
set (_TARGET_ARCH "cygwinunknown")
endif (HAS__i386_DEFINED)
elseif (WIN32
AND ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")))
# MinGW platform, as CYGWIN already has been handled
if (HAS__i386_DEFINED)
set (_TARGET_ARCH "mingw")
elseif (HAS__x86_64__DEFINED)
set (_TARGET_ARCH "mingw64")
else (HAS__i386_DEFINED)
set (_TARGET_ARCH "mingwunknown")
endif (HAS__i386_DEFINED)
else ($ENV{SYSTEMC_TARGET_ARCH})
# Unknown platform, so guess a SystemC target architecture value.
string (TOLOWER "${CMAKE_SYSTEM_NAME}${CMAKE_PROCESSOR_NAME}" _TARGET_ARCH)
endif (DEFINED ENV{SYSTEMC_TARGET_ARCH})
set (SystemC_TARGET_ARCH ${_TARGET_ARCH} CACHE STRING "SystemC Target Architecture")
unset (_TARGET_ARCH)
endif (NOT SystemC_TARGET_ARCH)

Copy link
Contributor

@maehne maehne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my side the proposed changes look OK, but I have no possibility to test it. The PowerPC platform for Mac OS X is legacy, but we have even older legacy platforms considered in the build system.

@pah: What do you think?

@@ -77,6 +77,8 @@
#
# - Linux (Clang): aarch64
#
# - macOS 10.5, 10.6 (GCC): ppc, ppc64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"macOS" -> "Mac OS X"

@barracuda156
Copy link
Author

@maehne I think as long as it builds fine de facto, there is no reason to prevent that merely by not having a case in arch/platform detection. That can’t possibly hurt anyone.

@pah
Copy link
Contributor

pah commented Apr 3, 2024

This is merely a cosmetic issue. The library may (or may not) still build on such unsupported configurations. If you want a different target architecture string than macosunknown in such an unsupported scenario, you can set the environment variable SYSTEMC_TARGET_ARCH during the cmake configuration step.

@barracuda156
Copy link
Author

For the record, tests seem to pass on macOS ppc for 3.0.1:

cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_systemc/systemc/work/build/examples && /opt/local/bin/ctest -C MacPorts
Test project /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_systemc/systemc/work/build/examples
      Start  1: examples/sysc/2.1/dpipe/dpipe/MacPorts
 1/35 Test  #1: examples/sysc/2.1/dpipe/dpipe/MacPorts .............................................   Passed    0.17 sec
      Start  2: examples/sysc/2.1/forkjoin/forkjoin/MacPorts
 2/35 Test  #2: examples/sysc/2.1/forkjoin/forkjoin/MacPorts .......................................   Passed    0.15 sec
      Start  3: examples/sysc/2.1/reset_signal_is/reset_signal_is/MacPorts
 3/35 Test  #3: examples/sysc/2.1/reset_signal_is/reset_signal_is/MacPorts .........................   Passed    0.17 sec
      Start  4: examples/sysc/2.1/sc_export/sc_export/MacPorts
 4/35 Test  #4: examples/sysc/2.1/sc_export/sc_export/MacPorts .....................................   Passed    0.15 sec
      Start  5: examples/sysc/2.1/sc_report/sc_report/MacPorts
 5/35 Test  #5: examples/sysc/2.1/sc_report/sc_report/MacPorts .....................................   Passed    0.15 sec
      Start  6: examples/sysc/2.1/scx_barrier/scx_barrier/MacPorts
 6/35 Test  #6: examples/sysc/2.1/scx_barrier/scx_barrier/MacPorts .................................   Passed    0.16 sec
      Start  7: examples/sysc/2.1/scx_mutex_w_policy/scx_mutex_w_policy/MacPorts
 7/35 Test  #7: examples/sysc/2.1/scx_mutex_w_policy/scx_mutex_w_policy/MacPorts ...................   Passed    0.16 sec
      Start  8: examples/sysc/2.3/sc_rvd/sc_rvd/MacPorts
 8/35 Test  #8: examples/sysc/2.3/sc_rvd/sc_rvd/MacPorts ...........................................   Passed    0.17 sec
      Start  9: examples/sysc/2.3/sc_ttd/sc_ttd/MacPorts
 9/35 Test  #9: examples/sysc/2.3/sc_ttd/sc_ttd/MacPorts ...........................................   Passed    0.21 sec
      Start 10: examples/sysc/2.3/simple_async/simple_async/MacPorts
10/35 Test #10: examples/sysc/2.3/simple_async/simple_async/MacPorts ...............................   Passed    1.17 sec
      Start 11: examples/sysc/2.4/in_class_initialization/in_class_initialization/MacPorts
11/35 Test #11: examples/sysc/2.4/in_class_initialization/in_class_initialization/MacPorts .........   Passed    0.14 sec
      Start 12: examples/sysc/2.4/in_class_initialization/in_class_initialization_pimpl/MacPorts
12/35 Test #12: examples/sysc/2.4/in_class_initialization/in_class_initialization_pimpl/MacPorts ...   Passed    0.14 sec
      Start 13: examples/sysc/fft/fft_flpt/fft_flpt/MacPorts
13/35 Test #13: examples/sysc/fft/fft_flpt/fft_flpt/MacPorts .......................................   Passed    0.20 sec
      Start 14: examples/sysc/fft/fft_fxpt/fft_fxpt/MacPorts
14/35 Test #14: examples/sysc/fft/fft_fxpt/fft_fxpt/MacPorts .......................................   Passed    0.18 sec
      Start 15: examples/sysc/fir/fir/MacPorts
15/35 Test #15: examples/sysc/fir/fir/MacPorts .....................................................   Passed    0.16 sec
      Start 16: examples/sysc/fir/fir_rtl/MacPorts
16/35 Test #16: examples/sysc/fir/fir_rtl/MacPorts .................................................   Passed    0.14 sec
      Start 17: examples/sysc/pipe/pipe/MacPorts
17/35 Test #17: examples/sysc/pipe/pipe/MacPorts ...................................................   Passed    0.14 sec
      Start 18: examples/sysc/pkt_switch/pkt_switch/MacPorts
18/35 Test #18: examples/sysc/pkt_switch/pkt_switch/MacPorts .......................................   Passed    0.23 sec
      Start 19: examples/sysc/risc_cpu/risc_cpu/MacPorts
19/35 Test #19: examples/sysc/risc_cpu/risc_cpu/MacPorts ...........................................   Passed    0.19 sec
      Start 20: examples/sysc/rsa/rsa/MacPorts
20/35 Test #20: examples/sysc/rsa/rsa/MacPorts .....................................................   Passed    0.20 sec
      Start 21: examples/sysc/simple_bus/simple_bus/MacPorts
21/35 Test #21: examples/sysc/simple_bus/simple_bus/MacPorts .......................................   Passed    0.26 sec
      Start 22: examples/sysc/simple_fifo/simple_fifo/MacPorts
22/35 Test #22: examples/sysc/simple_fifo/simple_fifo/MacPorts .....................................   Passed    0.18 sec
      Start 23: examples/sysc/simple_perf/simple_perf/MacPorts
23/35 Test #23: examples/sysc/simple_perf/simple_perf/MacPorts .....................................   Passed    4.03 sec
      Start 24: examples/sysc/async_suspend/async_suspend/MacPorts
24/35 Test #24: examples/sysc/async_suspend/async_suspend/MacPorts .................................   Passed    0.60 sec
      Start 25: examples/tlm/at_1_phase/at_1_phase/MacPorts
25/35 Test #25: examples/tlm/at_1_phase/at_1_phase/MacPorts ........................................   Passed    0.24 sec
      Start 26: examples/tlm/at_2_phase/at_2_phase/MacPorts
26/35 Test #26: examples/tlm/at_2_phase/at_2_phase/MacPorts ........................................   Passed    0.32 sec
      Start 27: examples/tlm/at_4_phase/at_4_phase/MacPorts
27/35 Test #27: examples/tlm/at_4_phase/at_4_phase/MacPorts ........................................   Passed    0.29 sec
      Start 28: examples/tlm/at_extension_optional/at_extension_optional/MacPorts
28/35 Test #28: examples/tlm/at_extension_optional/at_extension_optional/MacPorts ..................   Passed    0.31 sec
      Start 29: examples/tlm/at_mixed_targets/at_mixed_targets/MacPorts
29/35 Test #29: examples/tlm/at_mixed_targets/at_mixed_targets/MacPorts ............................   Passed    0.30 sec
      Start 30: examples/tlm/at_ooo/at_ooo/MacPorts
30/35 Test #30: examples/tlm/at_ooo/at_ooo/MacPorts ................................................   Passed    0.48 sec
      Start 31: examples/tlm/lt/lt/MacPorts
31/35 Test #31: examples/tlm/lt/lt/MacPorts ........................................................   Passed    0.23 sec
      Start 32: examples/tlm/lt_dmi/lt_dmi/MacPorts
32/35 Test #32: examples/tlm/lt_dmi/lt_dmi/MacPorts ................................................   Passed    0.30 sec
      Start 33: examples/tlm/lt_extension_mandatory/lt_extension_mandatory/MacPorts
33/35 Test #33: examples/tlm/lt_extension_mandatory/lt_extension_mandatory/MacPorts ................   Passed    0.23 sec
      Start 34: examples/tlm/lt_mixed_endian/lt_mixed_endian/MacPorts
34/35 Test #34: examples/tlm/lt_mixed_endian/lt_mixed_endian/MacPorts ..............................   Passed    0.24 sec
      Start 35: examples/tlm/lt_temporal_decouple/lt_temporal_decouple/MacPorts
35/35 Test #35: examples/tlm/lt_temporal_decouple/lt_temporal_decouple/MacPorts ....................   Passed    0.29 sec

100% tests passed, 0 tests failed out of 35

Total Test time (real) =  12.78 sec

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

Successfully merging this pull request may close these issues.

Implementation of QuickThreads for Darwin PowerPC is broken
4 participants