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

[ENHANCEMENT] xtd - FreeBSD support #241

Open
MCCLXXXVII opened this issue Dec 5, 2023 · 12 comments
Open

[ENHANCEMENT] xtd - FreeBSD support #241

MCCLXXXVII opened this issue Dec 5, 2023 · 12 comments
Assignees
Labels
enhancement New feature or request In progress
Milestone

Comments

@MCCLXXXVII
Copy link

xtd - FreeBSD support

Library

xtd

Enhancement

Add support for FreeBSD

Description

Great library, was looking forward to use it. Been patching the install script bit by bit seeing what's missing to get FreeBSD support and it seems to be a bit beyond my ability. I'll be working on this myself but if there is another person who is more capable please, the demand is there - even if it's just one person 😛

@MCCLXXXVII MCCLXXXVII added the enhancement New feature or request label Dec 5, 2023
@MCCLXXXVII
Copy link
Author

MCCLXXXVII commented Dec 5, 2023

To the switch case on OSTYPE to see required packages, this seems to cover everything

*"FreeBSD"*) sudo pkg update; sudo pkg install -y cmake doxygen gtk3 gsound alsa-plugins wx32-gtk3 libsysinfo;;

Now looking into changing the makefile to use freebsd headers instead for the next part.

EDIT: added libsysinfo

@MCCLXXXVII
Copy link
Author

sys/statfs can be replaced with sys/statvfs, I think I will be able to get it to compile soon as there aren't too many other errors.

One worrying thing is that console.cpp uses linux specific headers, there are crossplatform alternatives available which I might have to use.

@MCCLXXXVII
Copy link
Author

MCCLXXXVII commented Dec 5, 2023

One last error to fix and I think it should be portable, getting a few such errors when casting pthread to int:

/xtd/src/xtd.core.native.unix/src/xtd/native/unix/thread.cpp:28:8: error: static_cast from 'pthread_t' (aka 'pthread *') to 'intmax
_t' (aka 'long') is not allowed
  id = static_cast<intmax_t>(thread);

from

bool thread::cancel(intmax_t handle) {
  if (static_cast<pthread_t>(handle) == PTHREAD_FAILED) return false;
  return pthread_cancel(static_cast<pthread_t>(handle)) == 0;
}

@gammasoft71 gammasoft71 self-assigned this Dec 5, 2023
@gammasoft71 gammasoft71 added this to the 0.2.0 milestone Dec 5, 2023
@gammasoft71 gammasoft71 added this to To do in xtd - kanban board via automation Dec 5, 2023
@gammasoft71
Copy link
Owner

Hi,

First off all, thank you for your interest to xtd. 😀

I can't install FreeBSD on my system because it doesn't work on Apple silicon M1.
I can try to find a solution to have a virtual machine on other hardware if necessary.

"FreeBSD") sudo pkg update; sudo pkg install -y cmake doxygen gtk3 gsound alsa-plugins wx32-gtk3 libsysinfo;;

If seems to be correct.

sys/statfs can be replaced with sys/statvfs, I think I will be able to get it to compile soon as there aren't too many other errors.

One worrying thing is that console.cpp uses linux specific headers, there are crossplatform alternatives available which I might have to use.

and

/xtd/src/xtd.core.native.unix/src/xtd/native/unix/thread.cpp:28:8: error: static_cast from 'pthread_t' (aka 'pthread *') to 'intmax_t' (aka 'long') is not allowed
id = static_cast<intmax_t>(thread);

It seems that previous errors are due to native.core.unix is designed to linux and not to linux. I am the source of this problem, sorry.

The best way to solve this problem would be to create a new xtd.core.native.linux for linux and associate xtd.core.native.unix with FreeBSD.
Check the CMakeLists.txt file to see whether the current operating system is Linux or FreeBSD, so that you can call the correct native library.

I can take care of modifying the CMakeLists.txt file and creating and calling the right native libraries.

However, I won't be able to validate the xtd.core.native.unix library for FreeBSD until I have a working system.
What I will be able to do, however, is to validate with you the various problems that you are unable to correct.

@MCCLXXXVII
Copy link
Author

MCCLXXXVII commented Dec 5, 2023

Thanks for the quick reply, another issue seems to be that the __slong__ workaround is unnecessary on BSD and thus the only solution I thought of so far is to #ifdef it out of convert.h and so on.

I'm referring to types.h

	using slong = __slong__; // Workaround: On linux 64 bits unfortunately 'int_least64_t' is an alias on 'long' and not on 'long long int' as other platforms. In order to avoid conflicts in operator or method overloads, it is necessary to give the type that is not taken into account.

except this breaks on FreeBSDas it works as other platforms.

I tried to ifdef it out on the basis #ifdef __slong__ != int_least64_t but I gave up after doing convert.cpp and convert.h and seeing identical errors now in as.h

@MCCLXXXVII
Copy link
Author

Here is my diff so far, I don't want to consolidate this all into a PR because I don't understand the codebase at all at the moment, perhaps some of this is useful though I suspect there will be other ways to rectify some issues.

free_bsd_patches.txt

@gammasoft71
Copy link
Owner

I have just made the following changes:

  • Update install.sh with :

*"FreeBSD"*) sudo pkg update; sudo pkg install -y cmake doxygen gtk3 gsound alsa-plugins wx32-gtk3 libsysinfo;;

  • Update CMakeLists.txt to detect correctly operating system and differentiate Linux from Unix (like FreeBSD).
  • Add native library xtd.core.native.linux for Linux OS and dedicate xtd.core.native.unix to Unix OS (like FreeBSD).
  • I updated the xtd.core.native.unix files to build with Unix.

For the last point, I updated files without having a Unix operating system. Could you please check if this build works for you and if there is a problem, please let me know. Thanks you in advance.

@gammasoft71 gammasoft71 moved this from To do to In progress in xtd - kanban board Dec 7, 2023
@gammasoft71
Copy link
Owner

I hadn't seen your last message.
I'll compare it with the changes I've made. I'll get back to you as soon as it's done.

@MCCLXXXVII
Copy link
Author

MCCLXXXVII commented Dec 7, 2023

Install xtd libraries version 0.2.0, copyright Gammasoft, 2023

Detecting operating system...
  Operating System is Unix
Using up to 11 build cores
Installing needed packages and libraries...
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The most recent versions of packages are already installed
Get cmake_install_prefix...
mkdir: build: File exists
~/xtd/build ~/xtd
~/xtd/build/cmake_install_prefix ~/xtd/build ~/xtd
-- The C compiler identification is Clang 16.0.6
-- The CXX compiler identification is Clang 16.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/mantas/xtd/build/cmake_install_prefix
~/xtd/build ~/xtd
~/xtd
cmake_install_prefix="/usr/local"
Checks wxWidgets...
rm: build/Debug/CMakeFiles/Progress/count.txt: Permission denied
rm: build/Debug/CMakeFiles/Progress: Directory not empty
rm: build/Debug/CMakeFiles: Directory not empty
rm: build/Debug: Directory not empty
rm: build/Release/CMakeFiles/Progress/count.txt: Permission denied
rm: build/Release/CMakeFiles/Progress: Directory not empty
rm: build/Release/CMakeFiles: Directory not empty
rm: build/Release: Directory not empty
rm: build: Directory not empty
mkdir: build: File exists
~/xtd/build ~/xtd
~/xtd/build/test_wxwidgets ~/xtd/build ~/xtd
-- The C compiler identification is Clang 16.0.6
-- The CXX compiler identification is Clang 16.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found wxWidgets: -L/usr/local/lib;-pthread;;;-lwx_gtk3u_xrc-3.2;-lwx_gtk3u_html-3.2;-lwx_gtk3u_qa-3.2;-lwx_gtk3u_core-3.2;-lwx_baseu_xml-3.2;-lwx_baseu_net-3.2;-lwx_baseu-3.2 (found suitable version "3.2.1", minimum required is "3.2.0") 
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /home/mantas/xtd/build/test_wxwidgets
~/xtd/build ~/xtd
~/xtd
Installing xtd 0.2.0...
mkdir: build: File exists
~/xtd/build ~/xtd
mkdir: Release: File exists
~/xtd/build/Release ~/xtd/build ~/xtd
-- The C compiler identification is Clang 16.0.6
-- The CXX compiler identification is Clang 16.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "2.0.3") 
-- Checking for module 'gtk+-3.0'
--   Found gtk+-3.0, version 3.24.34
-- Checking for module 'gtk+-3.0'
--   Found gtk+-3.0, version 3.24.34
-- Found wxWidgets: -L/usr/local/lib;-pthread;;;-lwx_gtk3u_xrc-3.2;-lwx_gtk3u_html-3.2;-lwx_gtk3u_qa-3.2;-lwx_gtk3u_core-3.2;-lwx_baseu_xml-3.2;-lwx_baseu_net-3.2;-lwx_baseu-3.2 (found version "3.2.1") 
-- Configuring done (0.7s)
-- Generating done (0.1s)
-- Build files have been written to: /home/mantas/xtd/build/Release
[  0%] Built target xtd.drawing.native
[  0%] Built target xtd.core.native
[  0%] Built target xtd.forms.native
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/debugger.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/console.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/cryptography.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/condition_variable.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/critical_section.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/date_time.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/directory.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/dns.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/drive.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/environment.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/file.cpp.o
In file included from /home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/critical_section.cpp:3:
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:14:19: error: static declaration of 'pthread_mutex_timedlock' follows non-static declaration
In file included from /home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/condition_variable.cpp:3:
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:14:19: error: static declaration of 'pthread_mutex_timedlock' follows non-static declaration
static inline int pthread_mutex_timedlock(pthread_mutex_t* mut, const struct timespec *abs_timeout) {
                  ^
In file included from static inline int pthread_mutex_timedlock(pthread_mutex_t* mut, const struct timespec *abs_timeout) {
                  ^
/usr/include/pthread.h:241:6: note: previous declaration is here
/usr/include/pthread.h:241:6: note: previous declaration is here
int             pthread_mutex_timedlock(pthread_mutex_t * __restrict __mutex,/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/file.cppint             pthread_mutex_timedlock(pthread_mutex_t * __restrict __mutex,:4:
In file included from /home/mantas/xtd/src/xtd.core.native/include/xtd/native/file_system:2:
/home/mantas/xtd/src/xtd.core.native/include/xtd/native/file_system.h:73:68: error: unknown type name 'time_t'


                ^
                ^
      static int_least32_t get_file_times(const std::string& path, time_t& creation_time, time_t& last_access_time, time_t& last_write_time);
                                                                   ^
In file included from /home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/critical_section.cpp:3:
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:34:10: error: call to 'pthread_mutex_timedlock' is ambiguous
In file included from /home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/condition_variable.cpp:3:
  return pthread_mutex_timedlock(mut, &timeout);
         ^~~~~~~~~~~~~~~~~~~~~~~
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:34:10: error: call to 'pthread_mutex_timedlock' is ambiguous
/usr/include/pthread.h:241:6: note: candidate function
  return pthread_mutex_timedlock(mut, &timeout);
         ^~~~~~~~~~~~~~~~~~~~~~~
int             pthread_mutex_timedlock(pthread_mutex_t * __restrict __mutex,
                ^
/usr/include/pthread.h/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:14:19: note: candidate function
:241:6: note: candidate function
static inline int pthread_mutex_timedlock(pthread_mutex_t* mut, const struct timespec *abs_timeout) {
                  ^
int             pthread_mutex_timedlock(pthread_mutex_t * __restrict __mutex,
                ^
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:14:19: note: candidate function
static inline int pthread_mutex_timedlock(pthread_mutex_t* mut, const struct timespec *abs_timeout) {
                  ^
/home/mantas/xtd/src/xtd.core.native/include/xtd/native/file_system.h:73:91: error: unknown type name 'time_t'
      static int_least32_t get_file_times(const std::string& path, time_t& creation_time, time_t& last_access_time, time_t& last_write_time);
                                                                                          ^
/home/mantas/xtd/src/xtd.core.native/include/xtd/native/file_system.h:73:117: error: unknown type name 'time_t'
      static int_least32_t get_file_times(const std::string& path, time_t& creation_time, time_t& last_access_time, time_t& last_write_time);
                                                                                                                    ^
2 errors generated.
2 errors generated.
gmake[2]: *** [src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/build.make:76: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/condition_variable.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[2]: *** [src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/build.make:104: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/critical_section.cpp.o] Error 1
/home/mantas/xtd/src/xtd.core.native/include/xtd/native/file_system.h:95:71: error: unknown type name 'time_t'
      static int_least32_t set_creation_time(const std::string& path, time_t creation_time);
                                                                      ^
/home/mantas/xtd/src/xtd.core.native/include/xtd/native/file_system.h:101:74: error: unknown type name 'time_t'
      static int_least32_t set_last_access_time(const std::string& path, time_t last_access_time);
                                                                         ^
/home/mantas/xtd/src/xtd.core.native/include/xtd/native/file_system.h:107:73: error: unknown type name 'time_t'
      static int_least32_t set_last_write_time(const std::string& path, time_t last_write_time);
                                                                        ^
6 errors generated.
gmake[2]: *** [src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/build.make:216: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/file.cpp.o] Error 1
In file included from /home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/console.cpp:17:
In file included from /usr/local/include/alsa/asoundlib.h:63:
/usr/local/include/alsa/pcm.h:617:19: warning: zero size arrays are an extension [-Wzero-length-array]
        unsigned int pos[0];    /**< channel position array */
                         ^
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/console.cpp:623:15: error: redefinition of 'beep'
bool console::beep(uint_least32_t frequency, uint_least32_t duration) {
              ^
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/console.cpp:602:15: note: previous definition is here
bool console::beep(uint_least32_t frequency, uint_least32_t duration) {
              ^
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/console.cpp:624:10: error: use of undeclared identifier 'audio'
  return audio::beep(frequency, duration);
         ^
In file included from /home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/environment.cpp:10:
/usr/local/include/sys/sysinfo.h:23:11: warning: zero size arrays are an extension [-Wzero-length-array]
  char _f[20-2*sizeof(long)-sizeof(int)];       /* leaving this for linux compatability */
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/drive.cpp:9:10: fatal error: 'sys/statfs.h' file not found
#include <sys/statfs.h>
         ^~~~~~~~~~~~~~
1 error generated.
gmake[2]: *** [src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/build.make:188: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/drive.cpp.o] Error 1
1 warning and 2 errors generated.
gmake[2]: *** [src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/build.make:90: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/console.cpp.o] Error 1
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/date_time.cpp:243:66: error: invalid argument type 'char *(*)(int, int)' to unary expression
    local_time_zone.base_utc_offset = static_cast<int_least64_t>(-timezone * ticks_per_second);
                                                                 ^~~~~~~~~
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/date_time.cpp:245:74: error: invalid argument type 'char *(*)(int, int)' to unary expression
    local_time_zone.display_name = string_printf("(UTC%s%02d:%02d) %s", (-timezone) ? "+" : "", abs(timezone) / 3600, (abs(timezone) % 3600) / 60, reinterpret_cast<const char*>(tzname[0]));
                                                                         ^~~~~~~~~
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/date_time.cpp:245:97: error: no matching function for call to 'abs'
    local_time_zone.display_name = string_printf("(UTC%s%02d:%02d) %s", (-timezone) ? "+" : "", abs(timezone) / 3600, (abs(timezone) % 3600) / 60, reinterpret_cast<const char*>(tzname[0]));
                                                                                                ^~~
/usr/include/stdlib.h:90:6: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'int' for 1st argument
int      abs(int) __pure2;
         ^
/usr/include/c++/v1/stdlib.h:113:61: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'long' for 1st argument
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
                                                            ^
/usr/include/c++/v1/stdlib.h:116:66: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'long long' for 1st argument
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {
                                                                 ^
/usr/include/c++/v1/stdlib.h:122:62: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'float' for 1st argument
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT {
                                                             ^
/usr/include/c++/v1/stdlib.h:126:63: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'double' for 1st argument
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT {
                                                              ^
/usr/include/c++/v1/stdlib.h:131:1: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'long double' for 1st argument
abs(long double __lcpp_x) _NOEXCEPT {
^
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/date_time.cpp:245:120: error: no matching function for call to 'abs'
    local_time_zone.display_name = string_printf("(UTC%s%02d:%02d) %s", (-timezone) ? "+" : "", abs(timezone) / 3600, (abs(timezone) % 3600) / 60, reinterpret_cast<const char*>(tzname[0]));
                                                                                                                       ^~~
/usr/include/stdlib.h:90:6: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'int' for 1st argument
int      abs(int) __pure2;
         ^
/usr/include/c++/v1/stdlib.h:113:61: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'long' for 1st argument
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
                                                            ^
/usr/include/c++/v1/stdlib.h:116:66: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'long long' for 1st argument
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {
                                                                 ^
/usr/include/c++/v1/stdlib.h:122:62: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'float' for 1st argument
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT {
                                                             ^
/usr/include/c++/v1/stdlib.h:126:63: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'double' for 1st argument
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT {
                                                              ^
/usr/include/c++/v1/stdlib.h:131:1: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'long double' for 1st argument
abs(long double __lcpp_x) _NOEXCEPT {
^
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/date_time.cpp:247:53: error: use of undeclared identifier 'daylight'
    local_time_zone.supports_daylight_saving_time = daylight != 0;
                                                    ^
5 errors generated.
gmake[2]: *** [src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/build.make:132: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/date_time.cpp.o] Error 1
1 warning generated.
gmake[1]: *** [CMakeFiles/Makefile2:541: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/all] Error 2
gmake: *** [Makefile:166: all] Error 2
[  0%] Built target xtd.core.native
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/condition_variable.cpp.o
In file included from /home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/condition_variable.cpp:3:
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:14:19: error: static declaration of 'pthread_mutex_timedlock' follows non-static declaration
static inline int pthread_mutex_timedlock(pthread_mutex_t* mut, const struct timespec *abs_timeout) {
                  ^
/usr/include/pthread.h:241:6: note: previous declaration is here
int             pthread_mutex_timedlock(pthread_mutex_t * __restrict __mutex,
                ^
In file included from /home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/condition_variable.cpp:3:
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:34:10: error: call to 'pthread_mutex_timedlock' is ambiguous
  return pthread_mutex_timedlock(mut, &timeout);
         ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:241:6: note: candidate function
int             pthread_mutex_timedlock(pthread_mutex_t * __restrict __mutex,
                ^
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:14:19: note: candidate function
static inline int pthread_mutex_timedlock(pthread_mutex_t* mut, const struct timespec *abs_timeout) {
                  ^
2 errors generated.
gmake[2]: *** [src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/build.make:76: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/condition_variable.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:541: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/all] Error 2
gmake: *** [Makefile:166: all] Error 2
~/xtd/build ~/xtd
~/xtd/build/Debug ~/xtd/build ~/xtd
-- The C compiler identification is Clang 16.0.6
-- The CXX compiler identification is Clang 16.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "2.0.3") 
-- Checking for module 'gtk+-3.0'
--   Found gtk+-3.0, version 3.24.34
-- Checking for module 'gtk+-3.0'
--   Found gtk+-3.0, version 3.24.34
-- Found wxWidgets: -L/usr/local/lib;-pthread;;;-lwx_gtk3u_xrc-3.2;-lwx_gtk3u_html-3.2;-lwx_gtk3u_qa-3.2;-lwx_gtk3u_core-3.2;-lwx_baseu_xml-3.2;-lwx_baseu_net-3.2;-lwx_baseu-3.2 (found version "3.2.1") 
-- Configuring done (0.7s)
-- Generating done (0.1s)
-- Build files have been written to: /home/mantas/xtd/build/Debug
[  0%] Built target xtd.drawing.native
[  0%] Built target xtd.core.native
[  0%] Built target xtd.forms.native
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/debugger.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/console.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/condition_variable.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/critical_section.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/cryptography.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/date_time.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/directory.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/drive.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/dns.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/environment.cpp.o
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/file.cpp.o
In file included from /home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/file.cpp:4:
In file included from /home/mantas/xtd/src/xtd.core.native/include/xtd/native/file_system:2:
/home/mantas/xtd/src/xtd.core.native/include/xtd/native/file_system.h:73:68: error: unknown type name 'time_t'
      static int_least32_t get_file_times(const std::string& path, time_t& creation_time, time_t& last_access_time, time_t& last_write_time);
                                                                   ^
/home/mantas/xtd/src/xtd.core.native/include/xtd/native/file_system.h:73:91: error: unknown type name 'time_t'
      static int_least32_t get_file_times(const std::string& path, time_t& creation_time, time_t& last_access_time, time_t& last_write_time);
                                                                                          ^
/home/mantas/xtd/src/xtd.core.native/include/xtd/native/file_system.h:73:117: error: unknown type name 'time_t'
      static int_least32_t get_file_times(const std::string& path, time_t& creation_time, time_t& last_access_time, time_t& last_write_time);
                                                                                                                    ^
/home/mantas/xtd/src/xtd.core.native/include/xtd/native/file_system.h:95:71: error: unknown type name 'time_t'
      static int_least32_t set_creation_time(const std::string& path, time_t creation_time);
                                                                      ^
/home/mantas/xtd/src/xtd.core.native/include/xtd/native/file_system.h:101:74: error: unknown type name 'time_t'
      static int_least32_t set_last_access_time(const std::string& path, time_t last_access_time);
                                                                         ^
/home/mantas/xtd/src/xtd.core.native/include/xtd/native/file_system.h:107:73: error: unknown type name 'time_t'
      static int_least32_t set_last_write_time(const std::string& path, time_t last_write_time);
                                                                        ^
In file included from /home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/critical_section.cpp:3:
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:14:19: error: static declaration of 'pthread_mutex_timedlock' follows non-static declaration
static inline int pthread_mutex_timedlock(pthread_mutex_t* mut, const struct timespec *abs_timeout) {
                  ^
/usr/include/pthread.h:241:6: note: previous declaration is here
int             pthread_mutex_timedlock(pthread_mutex_t * __restrict __mutex,
                ^
In file included from /home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/critical_section.cpp:3:
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:34:10: error: call to 'pthread_mutex_timedlock' is ambiguous
  return pthread_mutex_timedlock(mut, &timeout);
         ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:241:6: note: candidate function
int             pthread_mutex_timedlock(pthread_mutex_t * __restrict __mutex,
                ^
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:14:19: note: candidate function
static inline int pthread_mutex_timedlock(pthread_mutex_t* mut, const struct timespec *abs_timeout) {
                  ^
2 errors generated.
gmake[2]: *** [src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/build.make:104: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/critical_section.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
In file included from /home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/condition_variable.cpp:3:
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:14:19: error: static declaration of 'pthread_mutex_timedlock' follows non-static declaration
static inline int pthread_mutex_timedlock(pthread_mutex_t* mut, const struct timespec *abs_timeout) {
                  ^
/usr/include/pthread.h:241:6: note: previous declaration is here
int             pthread_mutex_timedlock(pthread_mutex_t * __restrict __mutex,
                ^
In file included from /home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/condition_variable.cpp:3:
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:34:10: error: call to 'pthread_mutex_timedlock' is ambiguous
  return pthread_mutex_timedlock(mut, &timeout);
         ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:241:6: note: candidate function
int             pthread_mutex_timedlock(pthread_mutex_t * __restrict __mutex,
                ^
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:14:19: note: candidate function
static inline int pthread_mutex_timedlock(pthread_mutex_t* mut, const struct timespec *abs_timeout) {
                  ^
2 errors generated.
gmake[2]: *** [src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/build.make:76: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/condition_variable.cpp.o] Error 1
6 errors generated.
gmake[2]: *** [src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/build.make:216: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/file.cpp.o] Error 1
In file included from /home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/console.cpp:17:
In file included from /usr/local/include/alsa/asoundlib.h:63:
/usr/local/include/alsa/pcm.h:617:19: warning: zero size arrays are an extension [-Wzero-length-array]
        unsigned int pos[0];    /**< channel position array */
                         ^
In file included from /home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/environment.cpp:10:
/usr/local/include/sys/sysinfo.h:23:11: warning: zero size arrays are an extension [-Wzero-length-array]
  char _f[20-2*sizeof(long)-sizeof(int)];       /* leaving this for linux compatability */
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/drive.cpp:9:10: fatal error: 'sys/statfs.h' file not found
#include <sys/statfs.h>
         ^~~~~~~~~~~~~~
1 error generated.
gmake[2]: *** [src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/build.make:188: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/drive.cpp.o] Error 1
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/date_time.cpp:243:66: error: invalid argument type 'char *(*)(int, int)' to unary expression
    local_time_zone.base_utc_offset = static_cast<int_least64_t>(-timezone * ticks_per_second);
                                                                 ^~~~~~~~~
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/date_time.cpp:245:74: error: invalid argument type 'char *(*)(int, int)' to unary expression
    local_time_zone.display_name = string_printf("(UTC%s%02d:%02d) %s", (-timezone) ? "+" : "", abs(timezone) / 3600, (abs(timezone) % 3600) / 60, reinterpret_cast<const char*>(tzname[0]));
                                                                         ^~~~~~~~~
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/date_time.cpp:245:97: error: no matching function for call to 'abs'
    local_time_zone.display_name = string_printf("(UTC%s%02d:%02d) %s", (-timezone) ? "+" : "", abs(timezone) / 3600, (abs(timezone) % 3600) / 60, reinterpret_cast<const char*>(tzname[0]));
                                                                                                ^~~
/usr/include/stdlib.h:90:6: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'int' for 1st argument
int      abs(int) __pure2;
         ^
/usr/include/c++/v1/stdlib.h:113:61: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'long' for 1st argument
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
                                                            ^
/usr/include/c++/v1/stdlib.h:116:66: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'long long' for 1st argument
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {
                                                                 ^
/usr/include/c++/v1/stdlib.h:122:62: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'float' for 1st argument
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT {
                                                             ^
/usr/include/c++/v1/stdlib.h:126:63: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'double' for 1st argument
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT {
                                                              ^
/usr/include/c++/v1/stdlib.h:131:1: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'long double' for 1st argument
abs(long double __lcpp_x) _NOEXCEPT {
^
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/date_time.cpp:245:120: error: no matching function for call to 'abs'
    local_time_zone.display_name = string_printf("(UTC%s%02d:%02d) %s", (-timezone) ? "+" : "", abs(timezone) / 3600, (abs(timezone) % 3600) / 60, reinterpret_cast<const char*>(tzname[0]));
                                                                                                                       ^~~
/usr/include/stdlib.h:90:6: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'int' for 1st argument
int      abs(int) __pure2;
         ^
/usr/include/c++/v1/stdlib.h:113:61: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'long' for 1st argument
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
                                                            ^
/usr/include/c++/v1/stdlib.h:116:66: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'long long' for 1st argument
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {
                                                                 ^
/usr/include/c++/v1/stdlib.h:122:62: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'float' for 1st argument
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT {
                                                             ^
/usr/include/c++/v1/stdlib.h:126:63: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'double' for 1st argument
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT {
                                                              ^
/usr/include/c++/v1/stdlib.h:131:1: note: candidate function not viable: no known conversion from 'char *(int, int)' to 'long double' for 1st argument
abs(long double __lcpp_x) _NOEXCEPT {
^
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/date_time.cpp:247:53: error: use of undeclared identifier 'daylight'
    local_time_zone.supports_daylight_saving_time = daylight != 0;
                                                    ^
5 errors generated.
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/console.cpp:623:15: error: redefinition of 'beep'
bool console::beep(uint_least32_t frequency, uint_least32_t duration) {
              ^
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/console.cpp:602:15: note: previous definition is here
bool console::beep(uint_least32_t frequency, uint_least32_t duration) {
              ^
gmake[2]: *** [src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/build.make:132: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/date_time.cpp.o] Error 1
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/console.cpp:624:10: error: use of undeclared identifier 'audio'
  return audio::beep(frequency, duration);
         ^
1 warning generated.
1 warning and 2 errors generated.
gmake[2]: *** [src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/build.make:90: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/console.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:541: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/all] Error 2
gmake: *** [Makefile:166: all] Error 2
[  0%] Built target xtd.core.native
[  0%] Building CXX object src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/condition_variable.cpp.o
In file included from /home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/condition_variable.cpp:3:
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:14:19: error: static declaration of 'pthread_mutex_timedlock' follows non-static declaration
static inline int pthread_mutex_timedlock(pthread_mutex_t* mut, const struct timespec *abs_timeout) {
                  ^
/usr/include/pthread.h:241:6: note: previous declaration is here
int             pthread_mutex_timedlock(pthread_mutex_t * __restrict __mutex,
                ^
In file included from /home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/condition_variable.cpp:3:
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:34:10: error: call to 'pthread_mutex_timedlock' is ambiguous
  return pthread_mutex_timedlock(mut, &timeout);
         ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:241:6: note: candidate function
int             pthread_mutex_timedlock(pthread_mutex_t * __restrict __mutex,
                ^
/home/mantas/xtd/src/xtd.core.native.unix/src/xtd/native/unix/../../../../include/xtd/native/unix/mutex.h:14:19: note: candidate function
static inline int pthread_mutex_timedlock(pthread_mutex_t* mut, const struct timespec *abs_timeout) {
                  ^
2 errors generated.
gmake[2]: *** [src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/build.make:76: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/src/xtd/native/unix/condition_variable.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:541: src/xtd.core.native.unix/CMakeFiles/xtd.core.native.unix.dir/all] Error 2
gmake: *** [Makefile:166: all] Error 2
~/xtd/build ~/xtd
~/xtd
cp: build/3rdparty/wxwidgets/build_cmake/Release/install_manifest.txt: No such file or directory
cp: build/3rdparty/wxwidgets/build_cmake/Debug/install_manifest.txt: No such file or directory
cp: build/Release/install_manifest.txt: No such file or directory
cp: build/Debug/install_manifest.txt: No such file or directory
Launching xtdc-gui...

@gammasoft71
Copy link
Owner

gammasoft71 commented Dec 16, 2023

I updated the xtd.core.native.unix library and applied your patch. However, I still don't have a working FreeBSD version. Could you (@MCCLXXXVII) tell me if it works for you. Thanks for your help.

@MCCLXXXVII
Copy link
Author

Here is the output of the build process (failed)

logfile.txt

@gammasoft71
Copy link
Owner

Thanks for your comments.
I installed FreeBSD on a virtual machine and fixed the compiler errors. But I have a link error with the following libraries, the linker does not find the :

  • assound
  • uuid
  • gsound
  • gtk-3
  • gk-3
  • harfbuff
  • pangocairo-1.0
  • pango-1.0
  • atk-1.0
  • cairo
  • cairo-gobject
  • gdk_pixbuf-2.0
  • gio-2.0
  • glib-2.0
  • intl
  • gobject-2.0

@MCCLXXXVII, do you have any idea what's going on ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request In progress
Projects
xtd - kanban board
  
In progress
Status: In Progress
Development

No branches or pull requests

2 participants