FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Adding FreeBSD build support. by LadySerenaKitty · Pull Request #460 · DiligentGraphics/DiligentCore · GitHub

Adding FreeBSD build support. - #460

Open
LadySerenaKitty wants to merge 1 commit into
DiligentGraphics:masterfrom
LadySerenaKitty:master
Open

Adding FreeBSD build support.#460
LadySerenaKitty wants to merge 1 commit into
DiligentGraphics:masterfrom
LadySerenaKitty:master

Conversation

Copy link
Copy Markdown

Making all changes required to build on FreeBSD. Some CMake entries for Linux may have changed, but their functionality remains unchanged.

Comment thread BuildTools/CMake/BuildUtils.cmake Outdated
Comment thread CMakeLists.txt Outdated
#define __vectorcall
#define __thiscall
#ifndef PLATFORM_FREEBSD
#define __fastcall

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Is __fastcall a recognized keyword when compiling on FreeBSD?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

On this one, the compiler was complaining about fastcall being redefined, as FreeBSD's headers already define fastcall.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Which compiler are you using?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Believe it or not, the entirety of DiligentEngine was built using the compiler provided by the base system: clang 16.0.6.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It is actually strange why it only complains about __fastcall. It also recognized all other attributes
https://clang.llvm.org/docs/AttributeReference.html#target-version

Can you post the error that the compiler produces?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This is what happens without skipping __fastcall:

[ 35%] Building CXX object DiligentCore/Graphics/ShaderTools/CMakeFiles/Diligent-ShaderTools.dir/src/DXCompiler.cpp.o
In file included from /usr/home/jlhawkwell/Projects/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/DXCompiler.cpp:42:
In file included from /usr/home/jlhawkwell/Projects/DiligentEngine/DiligentCore/Graphics/ShaderTools/include/DXCompilerBaseLinux.hpp:31:
In file included from /usr/home/jlhawkwell/Projects/DiligentEngine/DiligentCore/Graphics/ShaderTools/../../ThirdParty/DirectXShaderCompiler/dxc/dxcapi.h:37:
/usr/home/jlhawkwell/Projects/DiligentEngine/DiligentCore/Graphics/ShaderTools/../../ThirdParty/DirectXShaderCompiler/dxc/WinAdapter.h:345:9: error: '__fastcall' macro redefined [-Werror,-Wmacro-redefined]
#define __fastcall
        ^
/usr/include/sys/cdefs.h:365:9: note: previous definition is here
#define __fastcall      __attribute__((__fastcall__))
        ^
1 error generated.
gmake[2]: *** [DiligentCore/Graphics/ShaderTools/CMakeFiles/Diligent-ShaderTools.dir/build.make:122: DiligentCore/Graphics/ShaderTools/CMakeFiles/Diligent-ShaderTools.dir/src/DXCompiler.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:3521: DiligentCore/Graphics/ShaderTools/CMakeFiles/Diligent-ShaderTools.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I updated DXC headers, so this should work now - please try the latest version

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

A better way to fix this is to check

#ifndef __fastcall

Though I do really not understand why it only complains about __fastcall. All other macros are defined in the same way.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The __fastcall macro is already defined in /usr/include/sys/cdefs.h on line 365.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What I suggested is to use the #ifndef __fastcall guard instead of #ifndef PLATFORM_FREEBSD.
Also note that this file is a third-party header so with the next update, it may break again.

Comment thread CMakeLists.txt
Comment thread BuildTools/CMakeLists.txt Outdated
Comment thread CMakeLists.txt
Comment thread CMakeLists.txt Outdated
Comment thread Graphics/Archiver/CMakeLists.txt Outdated
#define __vectorcall
#define __thiscall
#ifndef PLATFORM_FREEBSD
#define __fastcall

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Which compiler are you using?

TheMostDiligent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I updated core module, so that format validation will be disabled on platforms that don't have the script.
Can you update to the latest version and try it?

Copy link
Copy Markdown
Author

I updated core module, so that format validation will be disabled on platforms that don't have the script. Can you update to the latest version and try it?

Format validation is successfully skipped (tested after deleting the scripts I added). Would you like a new push with the scripts removed?

Copy link
Copy Markdown
Contributor

Would you like a new push with the scripts removed?

You can force-push to the same branch - the PR will be updated.

LadySerenaKitty force-pushed the master branch 2 times, most recently from d41441e to 73ac8e7 Compare February 2, 2024 17:48
Comment thread BuildTools/CMakeLists.txt
Comment thread Graphics/Archiver/CMakeLists.txt Outdated
#define __vectorcall
#define __thiscall
#ifndef PLATFORM_FREEBSD
#define __fastcall

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I updated DXC headers, so this should work now - please try the latest version

Comment thread CMakeLists.txt Outdated
endif()

if(PLATFORM_FREEBSD AND EXISTS /usr/local/include)
target_include_directories(Diligent-BuildSettings SYSTEM AFTER INTERFACE /usr/local/include)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What errors do you get without this include?
This change does not seem right

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It is quite correct. Without this, anything that isn't part of base will not be found.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What base?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

FreeBSD! "base" is short for "base operating system" and is the stuff that's made by the FreeBSD Project - kernel and world. This includes everything outside of /usr/home and /usr/local, which isn't much.

A mirror of the source repo is available here, so you can see what all is part of FreeBSD's base: https://github.com/freebsd/freebsd-src

Comment thread CMakeLists.txt
endif()

if(PLATFORM_FREEBSD AND EXISTS /usr/local/include)
target_include_directories(Diligent-BuildSettings SYSTEM AFTER INTERFACE /usr/local/include)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I tried to find some info about this problem, and I think that the right way to fix this is to set CMAKE_REQUIRED_INCLUDES at your project's CMake level:

dotnet/runtime#4073

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Did you try setting the CMAKE_REQUIRED_INCLUDES in your project CMake?

TheMostDiligent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sorry for a long delay with response.

#define __vectorcall
#define __thiscall
#ifndef PLATFORM_FREEBSD
#define __fastcall

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

A better way to fix this is to check

#ifndef __fastcall

Though I do really not understand why it only complains about __fastcall. All other macros are defined in the same way.

#define __vectorcall
#define __thiscall
#ifndef PLATFORM_FREEBSD
#define __fastcall

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What I suggested is to use the #ifndef __fastcall guard instead of #ifndef PLATFORM_FREEBSD.
Also note that this file is a third-party header so with the next update, it may break again.

Comment thread CMakeLists.txt
endif()

if(PLATFORM_FREEBSD AND EXISTS /usr/local/include)
target_include_directories(Diligent-BuildSettings SYSTEM AFTER INTERFACE /usr/local/include)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Did you try setting the CMAKE_REQUIRED_INCLUDES in your project CMake?

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

2 participants


Back | FazBrowse Home | New Git URL