Skip to content

Initial support for building on FreeBSD#12996

Merged
Axel-Naumann merged 21 commits into
root-project:masterfrom
mkrzewic:FreeBSD
Jun 22, 2023
Merged

Initial support for building on FreeBSD#12996
Axel-Naumann merged 21 commits into
root-project:masterfrom
mkrzewic:FreeBSD

Conversation

@mkrzewic
Copy link
Copy Markdown
Contributor

@mkrzewic mkrzewic commented Jun 12, 2023

This Pull request:

This is an initial attempt at getting this thing building on modern FreeBSD (i.e. without /proc)
some discussion was going on in issue #12787 and @hahnjo suggested a broader review and discussion in a PR.

Changes or fixes:

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #12787

@phsft-bot
Copy link
Copy Markdown

Can one of the admins verify this patch?

@bellenot
Copy link
Copy Markdown
Member

@phsft-bot build

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac12/noimt, mac11/cxx14, windows10/cxx14
How to customize builds

@hahnjo hahnjo requested a review from jalopezg-git June 12, 2023 15:38
@hahnjo
Copy link
Copy Markdown
Member

hahnjo commented Jun 12, 2023

Thanks @mkrzewic! We kicked off testing to make sure it doesn't break other platforms. I will take a closer look tomorrow 😉

Copy link
Copy Markdown
Member

@Axel-Naumann Axel-Naumann left a comment

Choose a reason for hiding this comment

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

This is fantastic, thank you so much!

Just suggesting some small wording (thisisabloodyhackZFS) / indentation changes. I'm curious to see how the CI will deal with the textual module!

Comment thread core/unix/CMakeLists.txt Outdated
Comment thread interpreter/cling/include/cling/libc.modulemap Outdated
Comment thread interpreter/cling/lib/Interpreter/DynamicLibraryManagerSymbol.cpp
Comment thread interpreter/cling/lib/Interpreter/DynamicLibraryManagerSymbol.cpp Outdated
@bellenot bellenot self-assigned this Jun 13, 2023
Comment thread core/dictgen/src/rootcling_impl.cxx
Comment thread cmake/modules/SetUpFreeBSD.cmake Outdated
Comment on lines +10 to +12
if(CMAKE_CXX_COMPILER_ID STREQUAL Intel)
set(ROOT_ARCHITECTURE freebsdx8664icc)
else()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there really an Intel compiler for FreeBSD? I'd throw out anything that is not needed / tested on FreeBSD, probably only leave freebsdadm64 as ROOT_ARCHITECTURE

Copy link
Copy Markdown
Contributor Author

@mkrzewic mkrzewic Jun 13, 2023

Choose a reason for hiding this comment

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

I got a request from the port maintainer (@eamjensen) to keep (and add/fix some of the FBSD specific naming) the cpu architectures in the SetupFreeBSD. Maybe refs to the old freebsd archs can be removed (freebsd4,freebsd5,freebsd7 in config/root-config.in and a bunch of options in etc/Makefile.arch) - instead we could glob/wildcard as they all seem to to the same thing for now plus I think it's safe to say older (gcc based) freebsd systems will not be supported (e.g. because they don't support c++14 etc.)
I'll remove the intel thing, it makes no sense indeed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I cleaned up a bit, all in new commits.

Comment thread cmake/modules/SetUpFreeBSD.cmake Outdated
Comment thread cmake/modules/SetUpFreeBSD.cmake Outdated
Comment thread core/unix/CMakeLists.txt Outdated
Comment thread core/dictgen/src/rootcling_impl.cxx Outdated
Comment thread core/foundation/src/FoundationUtils.cxx Outdated
Comment on lines +135 to +138
auto parent_path = [](std::string path) {
return path.substr(0, path.find_last_of("/\\"));
};
fallback = parent_path(parent_path({path_str}));
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.

I see that this part is common with the WIN32 case. Perhaps we can restructure this a bit to avoid code duplication.

Copy link
Copy Markdown
Contributor Author

@mkrzewic mkrzewic Jun 15, 2023

Choose a reason for hiding this comment

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

possibly, I even tried, but for some reason this was better if I remember correctly... maybe not a good reason though:)

#endif
#if defined R__FBSD || defined __FreeBSD__
procstat* ps = procstat_open_sysctl(); //
kinfo_proc* kp = kinfo_getproc(getpid());
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.

I saw some other usages of the procfs filesystem typically mounted on /proc on Linux, namely in:

  • The proof/, rootx/ and bindings/pyroot/cppyy/ directories
  • The config/thisroot.sh file

Maybe we should take a look into those too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

config/thisroot.sh should work as it is
rootx I'll fix, but is there no common library/place to define GetExePath (and the like) once for all components?
proof and python I'll leave for later as I have no use for those. Someone will contribute a patch if there is need:)

Comment on lines +24 to +25
char* __progname;
char** environ;
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.

These are extern, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

possibly, this is a "legacy" fix from the port maintainer, it is needed and sufficient (it seems). I think maybe for some reason the symbols needed to be visible for lld, possibly some subtle difference with ld.

Comment thread core/unix/src/TUnixSystem.cxx Outdated
Comment on lines +46 to +47
// libprocstat pulls in sys/elf.h which seems to clash with llvm/BinaryFormat/ELF.h
// similar collision happens with ZFS. Defining ZFS disables this 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.

Interesting 🧐...

Comment thread interpreter/cling/lib/Interpreter/DynamicLibraryManagerSymbol.cpp Outdated
Comment thread interpreter/cling/lib/Interpreter/DynamicLibraryManagerSymbol.cpp Outdated
Comment thread io/io/src/TFile.cxx Outdated
Comment thread cmake/modules/SetUpFreeBSD.cmake Outdated
mkrzewic and others added 3 commits June 15, 2023 14:41
Co-authored-by: Javier Lopez-Gomez <javier.lopez.gomez@cern.ch>
Co-authored-by: Javier Lopez-Gomez <javier.lopez.gomez@cern.ch>
Co-authored-by: Javier Lopez-Gomez <javier.lopez.gomez@cern.ch>
mkrzewic and others added 5 commits June 15, 2023 14:45
Co-authored-by: Javier Lopez-Gomez <javier.lopez.gomez@cern.ch>
Co-authored-by: Javier Lopez-Gomez <javier.lopez.gomez@cern.ch>
Co-authored-by: Javier Lopez-Gomez <javier.lopez.gomez@cern.ch>
@mkrzewic
Copy link
Copy Markdown
Contributor Author

I have one more question, this gets it building and kinda working, but there are still runtime issues: bunch of tests fail, most notably some io (basic works, higher compression levels fail) and threading (some TThread tests fail, for various reasons, from trivial _REENTRANT macro not defined, to proper crashes). Question is: keep adding to this PR or open a new issue some time in the future?

@Axel-Naumann
Copy link
Copy Markdown
Member

New issues, new PRs please - we prefer to work incrementally, grandiose things have the habit to fail :-) I very much appreciate this first step to make it build!

@github-actions
Copy link
Copy Markdown

Test Results

         9 files           9 suites   1d 21h 20m 47s ⏱️
  2 469 tests   2 459 ✔️ 0 💤 10
21 132 runs  21 122 ✔️ 0 💤 10

For more details on these failures, see this check.

Results for commit c37d609.

@hahnjo
Copy link
Copy Markdown
Member

hahnjo commented Jun 19, 2023

Let's not downplay the achievement here - my understanding is that this PR not only allows to compile ROOT on FreeBSD, but gets us a decently functional executable for first tests and further improvements 🚀 I agree with Axel that other problems and tests should be addressed in future issues / PRs.

I think the final point to consider is how to merge. With the current state of commits addressing review comments, I would propose to squash on merge; unless @mkrzewic wants to rework the commits and fold the followups into the respective commits 😉

@Axel-Naumann
Copy link
Copy Markdown
Member

Thanks @hahnjo - @mkrzewic unless you have any objection I will merge this tomorrow in a squashed version.

@mkrzewic
Copy link
Copy Markdown
Contributor Author

@Axel-Naumann sure, squash away, then I'll rebase my next branch and open a new PR.

@Axel-Naumann Axel-Naumann merged commit 9734f9a into root-project:master Jun 22, 2023
@Axel-Naumann
Copy link
Copy Markdown
Member

Thanks a LOT for your work, @mkrzewic !

@hahnjo
Copy link
Copy Markdown
Member

hahnjo commented Jun 22, 2023

We forgot to run the old Jenkins CI for the latest push (that is on us), #13073 takes care of an unused-but-set-variable warning...

maksgraczyk pushed a commit to maksgraczyk/root that referenced this pull request Jun 28, 2023
Co-authored-by: Mikolaj Krzewicki <Mikolaj Krzewicki mkrzewicki@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compilation fails on FreeBSD 13.2 RELEASE

7 participants