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

FreeBSD compatibility patches #1705

Closed
wants to merge 7 commits into from

Conversation

yurivict
Copy link

@yurivict yurivict commented Dec 5, 2021

Description of Change(s)

These patches allow to build USD on FreeBSD.

@meshula
Copy link
Member

meshula commented Dec 5, 2021

I notice that for the most part, the change involves adding ARCH_OS_FREEBSD to the unix-like blocks. I wonder if it might make sense to define ARCH_OS_LINUX as well as ARCH_OS_FREEBSD, so that only FREEBSD specific cases need to be explicitly addressed?

(Out of scope for what you're trying to do, I have the same question about ARCH_OS_DARWIN. Perhaps ARCH_OS_POSIX, with LINUX, DARWIN, FREEBSD, and MINGW specializations... )

@yurivict
Copy link
Author

yurivict commented Dec 5, 2021

Perhaps ARCH_OS_POSIX, with LINUX, DARWIN, FREEBSD, and MINGW specializations

I agree but this is orthogonal to this patch. The patch adds ifdefs in the same way as the code is now. The change that you propose can be made later for all relevant architectures.

@spiffmon
Copy link
Member

spiffmon commented Dec 6, 2021

Agreed - it seems like a nice future simplification to define an ARCH_UNIX_DERIVED with smaller specializations for each of the flavors, but it doesn't seem right to handle BSD as LINUX.

@spiffmon
Copy link
Member

spiffmon commented Dec 6, 2021

@yurivict , given that FreeBSD is not represented in our internal build/test infrastructure, and likely will not be anytime soon, and that our azure testing is not covering it either, I just wanted to verify that you have run the full public USD testsuite locally with your changes? Thanks again!

@yurivict
Copy link
Author

yurivict commented Dec 6, 2021

Is it documented how to run the USD testsuite?

@spiffmon
Copy link
Member

spiffmon commented Dec 6, 2021 via email

@yurivict yurivict force-pushed the FreeBSD_patches branch 2 times, most recently from 676c080 to 4942189 Compare December 6, 2021 20:05
@yurivict
Copy link
Author

yurivict commented Dec 6, 2021

The testsuite looks for test executables in a wrong place:

7: FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/tests/testArchFunction'

The executable path is: ./work/.build/pxr/base/arch/testArchFunction

@sunyab
Copy link
Contributor

sunyab commented Dec 6, 2021

Hello @yurivict, the build and test infrastructure currently expect that tests will be installed like other build products and run from the installed location. Assuming your cmake install prefix is /usr/local, we would expect /usr/local/tests/testArchFunction and other tests to exist. If it does not, or if your cmake install prefix isn't /usr/local, that indicates that either the build did not fully complete or there is a bug in the build system. In that case, could you please post log files with your cmake and build output so we could have a look?

@jilliene
Copy link

jilliene commented Dec 8, 2021

Filed as internal issue #USD-7057

@sunyab
Copy link
Contributor

sunyab commented Dec 10, 2021

Hi @yurivict, we are looking at merging these patches in. However, we need a signed CLA from contributors before we are able to merge their changes. Could you please follow the instructions at: https://graphics.pixar.com/usd/release/contributing_to_usd.html

Once we receive the CLA we can move forward. Thank you!

if (kf->kf_path[0])
{
path.resize(strlen(kf->kf_path) + 1);
sprintf(&path[0], "%s", kf->kf_path);
Copy link

Choose a reason for hiding this comment

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

Why not strcpy(path, kf->kf_path)?

@spitzak
Copy link

spitzak commented Dec 17, 2021

It seems like "!ARCH_OS_WINDOWS" could be used for "unix derived". I have also seen "POSIX" used to avoid the Unix trademark.

@spiffmon
Copy link
Member

Hi @yurivict ! Pinging again here to see if we can get a CLA from you? We'd like to process this PR, but cannot proceed without a CLA.

@spiffmon
Copy link
Member

Hello, @yurivict - I see from recently filed Issue #1840 that you are still active, here. So I'd like to repeat once more our request for you to file a CLA with us so that we can accept this great contribution. Thank you!

@yurivict
Copy link
Author

Sorry for the delay. I've sent the signed agreement.

@yurivict yurivict force-pushed the FreeBSD_patches branch from 4942189 to ac3969d Compare May 7, 2022 17:01
sunyab added 4 commits May 9, 2022 14:03
could lead to invalid memory access.

(Internal change: 2228809)
(Internal change: 2230317)
(Internal change: 2230746)
(Internal change: 2237514)
@sunyab sunyab changed the base branch from release to dev June 18, 2022 00:38
@yurivict
Copy link
Author

@spiffmon Could you please merge this PR?

Thanks,
Yuri

@spiffmon
Copy link
Member

Hi @yurivict ,
Apologies for not updating the PR... @sunyab attempted to merge this PR, and it caused the supported Centos/RHEL build to fail, I believe. He may remember more details, but are you able to test in a Linux environment?

@yurivict
Copy link
Author

[...] are you able to test in a Linux environment?

No, sorry, I don't have Linux. But the patch should be orthogonal to Linux.

@yurivict
Copy link
Author

This line:

#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) && defined(ARCH_COMPILER_GCC)

should be

#if (defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD)) && defined(ARCH_COMPILER_GCC)

@@ -46,6 +46,7 @@
#include <unistd.h>
#include <string>
#endif
#include <signal.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is signal.h needed here when csignal is included above?

#include <unistd.h>
#include <sys/statfs.h>
//#include <sys/statfs.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

If this line is unnecessary on Linux and FreeBSD, please remove it instead of commenting it out.

@sunyab
Copy link
Contributor

sunyab commented Jul 23, 2022

My Apologies for not updating this PR earlier. This PR did fail to build on Linux on Azure, and when I tried it a while back on Linux I got the following error. Aside from that and the other issue you mentioned in your earlier post, I've left two questions/notes on the changes.

base/arch/systemInfo.cpp: In lambda function:
base/arch/systemInfo.cpp:130:44: error: expected ')' before ';' token                                                                                                                                     
                 const ssize_t n = readlink(SELF_PATHNAME, buffer, *size);                                                                                                                                
                                            ^~~~~~~~~~~~~
base/arch/systemInfo.cpp:130:57: error: expected primary-expression before ',' token
                 const ssize_t n = readlink(SELF_PATHNAME, buffer, *size);                                                                                                                                
                                                         ^
base/arch/systemInfo.cpp:132:21: error: expected ')' before ';' token                                                                                                                                     
                     ARCH_WARNING("Unable to read " SELF_PATHNAME " to obtain "
                     ^~~~~~~~~~~~
base/arch/systemInfo.cpp:132:21: error: left operand of comma operator has no effect [-Werror=unused-value]
base/arch/systemInfo.cpp:132:21: error: right operand of comma operator has no effect [-Werror=unused-value]
base/arch/systemInfo.cpp:132:21: error: right operand of comma operator has no effect [-Werror=unused-value]
base/arch/systemInfo.cpp:132:21: error: expected ';' before ')' token                                                                                                                                     
base/arch/systemInfo.cpp:133:52: error: right operand of comma operator has no effect [-Werror=unused-value]
                                  "executable path");                                                                                                                                                     
                                                    ^
base/arch/systemInfo.cpp:140:31: error: expected ')' before ';' token                                                                                                                                     
                     if (lstat(SELF_PATHNAME, &sb) == 0) {
                               ^~~~~~~~~~~~~
base/arch/systemInfo.cpp:140:31: error: expected ')' before ';' token                                                                                                                                     
base/arch/systemInfo.cpp:140:44: error: expected primary-expression before ',' token
                     if (lstat(SELF_PATHNAME, &sb) == 0) {
                                            ^
base/arch/systemInfo.cpp:143:21: error: expected '}' before 'else'
                     else {
                     ^~~~
base/arch/systemInfo.cpp: In function 'std::string ArchGetExecutablePath()':
base/arch/systemInfo.cpp:149:17: error: expected ')' before 'else'
                 else {
                 ^~~~
base/arch/systemInfo.cpp:153:13: error: expected ';' before '}' token                                                                                                                                     
             });                                                                                                                                                                                          
             ^
base/arch/systemInfo.cpp: At global scope:
base/arch/systemInfo.cpp:153:14: error: expected unqualified-id before ')' token
             });                                                                                                                                                                                          
              ^
base/arch/systemInfo.cpp:198:1: error: expected declaration before '}' token
 }
 ^
compiling: arch regex.o
cc1plus: all warnings being treated as errors

@yurivict
Copy link
Author

It looks like Arch_ComputeNanosecondsPerTick now needs to be implemented for FreeBSD. This will take some time.

@yurivict
Copy link
Author

@sunyab I've created this new PR #1961 instead.

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.

7 participants