platformio / platformio-core

Your Gateway to Embedded Software Development Excellence :alien:
https://platformio.org
Apache License 2.0
7.72k stars 785 forks source link

CLion: Unexpected compiler output. This compiler might be unsupported And can not recognize the header file, but it can be compiled #3710

Open aadog opened 3 years ago

aadog commented 3 years ago

What kind of issue is this?

You can erase any parts of this template not applicable to your Issue.


Configuration

Operating system:Win10 x64,python3.9(x64)

PlatformIO Version (platformio --version):platformio.exe -c clion run --target upload -e stc89c52rc

Description of problem

Steps to Reproduce

1.create new project 2.select stc89c52rc 3.open clion pio init

Actual Results

-- Configuring done -- Generating done -- Build files have been written to: C:/Users/pouk/go/src/c51/cmake-build-stc89c52rc

Problems were encountered while collecting compiler information: Unexpected compiler output. This compiler might be unsupported. If you are using GCC/Clang, please report the bug in https://youtrack.jetbrains.com/issues/CPP.

1 2 3 4

Expected Results

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:stc89c52rc]
platform = intel_mcs51
board = stc89c52rc

Source file to reproduce issue:

# https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
#
# If you need to override existing CMake configuration or add extra,
# please create `CMakeListsUser.txt` in the root of project.
# The `CMakeListsUser.txt` will not be overwritten by PlatformIO.

cmake_minimum_required(VERSION 3.13)
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER_WORKS 1)
set(CMAKE_CXX_COMPILER_WORKS 1)

project("c51" C CXX)

include(CMakeListsPrivate.txt)

if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeListsUser.txt)
include(CMakeListsUser.txt)
endif()

add_custom_target(
    Production ALL
    COMMAND platformio -c clion run "$<$<NOT:$<CONFIG:All>>:-e${CMAKE_BUILD_TYPE}>"
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

add_custom_target(
    Debug ALL
    COMMAND platformio -c clion run --target debug "$<$<NOT:$<CONFIG:All>>:-e${CMAKE_BUILD_TYPE}>"
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

add_executable(Z_DUMMY_TARGET ${SRC_LIST})

CMakeListsPrivate.txt

# !!! WARNING !!! AUTO-GENERATED FILE, PLEASE DO NOT MODIFY IT AND USE
# https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
#
# If you need to override existing CMake configuration or add extra,
# please create `CMakeListsUser.txt` in the root of project.
# The `CMakeListsUser.txt` will not be overwritten by PlatformIO.

set(CMAKE_CONFIGURATION_TYPES "stc89c52rc" CACHE STRING "Build Types reflect PlatformIO Environments" FORCE)

SET(CMAKE_C_COMPILER "$ENV{HOMEDRIVE}$ENV{HOMEPATH}/.platformio/packages/toolchain-sdcc/bin/sdcc.exe")
SET(CMAKE_CXX_COMPILER "C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/cc.exe")
SET(CMAKE_CXX_FLAGS "--opt-code-size --peep-return -mmcs51")
SET(CMAKE_C_FLAGS "--std-sdcc11 --opt-code-size --peep-return -mmcs51")

if (CMAKE_BUILD_TYPE MATCHES "stc89c52rc")
    add_definitions(-D'F_CPU=11059200')
    add_definitions(-D'HEAP_SIZE=128')
    add_definitions(-D'PLATFORMIO=50002')

    include_directories("${CMAKE_CURRENT_LIST_DIR}/include")
    include_directories("${CMAKE_CURRENT_LIST_DIR}/src")
    include_directories("$ENV{HOMEDRIVE}$ENV{HOMEPATH}/.platformio/packages/toolchain-sdcc/non-free/include")
    include_directories("$ENV{HOMEDRIVE}$ENV{HOMEPATH}/.platformio/packages/tool-unity")

    FILE(GLOB_RECURSE EXTRA_LIB_SOURCES
        ${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/stc89c52rc/*.*
    )
endif()

FILE(GLOB_RECURSE SRC_LIST
    ${CMAKE_CURRENT_LIST_DIR}/src/*.*
    ${CMAKE_CURRENT_LIST_DIR}/lib/*.*
)

list(APPEND SRC_LIST ${EXTRA_LIB_SOURCES})

Additional info

Anivie commented 1 year ago

Do you solvee this problem? I am get the same error in CLion 2022.3 with windows10 and ubuntu desktop 22.10

aadog commented 1 year ago

no

Cyberavater commented 1 year ago

Yup same here.

XZ8886 commented 8 months ago

Did anyone solve the problem?