uxlfoundation/oneTBB

Error while building on WIndows with Cygwin64

Opened this issue · 3 comments

Summary

Hello,

When building with Cygwin64 and Windows 10, I got an error

/home/user/oneTBB-2021.13.0/src/tbb/allocator.cpp: Dans la fonction « void* tbb::detail::r1::std_cache_aligned_allocate(std::size_t, std::size_t) »:
/home/florent/oneTBB-2021.13.0/src/tbb/allocator.cpp:210:15: erreur: « posix_memalign » n'a pas été déclaré dans cette portée
210 | int res = posix_memalign(&p, alignment, bytes);
| ^~~~~~~~~~~~~~
make[2]: *** [src/tbb/CMakeFiles/tbb.dir/build.make:90: src/tbb/CMakeFiles/tbb.dir/allocator.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:467: src/tbb/CMakeFiles/tbb.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

After investigating, the issue seems to be that the flag __POSIX_VISIBLE is not set to 200112 (stdlib.h file) which define the function posix_memalign.

If I force the define with #define __POSIX_VISIBLE 200112, I have another error :

> 
> /home/florent/oneTBB-2021.13.0/src/tbb/dynamic_link.cpp: Dans la fonction « void tbb::detail::r1::init_ap_data() »:
> /home/florent/oneTBB-2021.13.0/src/tbb/dynamic_link.cpp:252:9: erreur: « Dl_info » n'a pas été déclaré dans cette portée
>   252 |         Dl_info dlinfo;
>       |         ^~~~~~~
> /home/florent/oneTBB-2021.13.0/src/tbb/dynamic_link.cpp:253:50: erreur: « dlinfo » n'a pas été déclaré dans cette portée
>   253 |         int res = dladdr( (void*)&dynamic_link, &dlinfo ); // any function inside the library can be used for the address
>       |                                                  ^~~~~~
> /home/florent/oneTBB-2021.13.0/src/tbb/dynamic_link.cpp:253:19: erreur: « dladdr » n'a pas été déclaré dans cette portée
>   253 |         int res = dladdr( (void*)&dynamic_link, &dlinfo ); // any function inside the library can be used for the address
>       |                   ^~~~~~
> make[2]: *** [src/tbb/CMakeFiles/tbb.dir/build.make:146: src/tbb/CMakeFiles/tbb.dir/dynamic_link.cpp.o] Error 1
> make[1]: *** [CMakeFiles/Makefile2:467: src/tbb/CMakeFiles/tbb.dir/all] Error 2
> make: *** [Makefile:166: all] Error 2
> 

Version

oneTBB-2021.13

Environment

Windows 10 - x64
Cygwin64

Steps To Reproduce

Just use cmake last version to generate configuration files and then build using "make"

Any ideas ?

Thanks

@wehostadm As of now oneTBB will support for certain list of compiler which is mentioned in the SYSTEM_REQUIREMENTS.md, you will get the details of the supported compiler and system requirements in it . Nevertheless it would be great if you contribute for the fixes related to Cygwin64

@arunparkugan I was able to compile on Cygwin environment thanks to this command :

cmake . -Bbuild -DTBB_STRICT=0 -DCMAKE_CXX_FLAGS="-D_GNU_SOURCE" -DCMAKE_MAKE_PROGRAM=make
(the CMAKE_MAKE_PROGRAM=make is specific to my computer due to bugs with the path of make program)

Adding CMAKE_CXX_FLAGS="-D_GNU_SOURCE" fixes the compilation of the TBB library. However, the link failed with this error :

[ 10%] Linking CXX shared library ../../gnu_12.4_cxx11_64_relwithdebinfo/cygtbb-12.dll
/usr/lib/gcc/x86_64-pc-cygwin/12/../../../../x86_64-pc-cygwin/bin/ld : CMakeFiles/tbb.dir/rml_tbb.cpp.o:rml_tbb.cpp:(.rdata$.refptr.__TBB_call_with_my_server_info[.refptr.__TBB_call_with_my_server_info]+0x0) : référence indéfinie vers « __TBB_call_with_my_server_info »
/usr/lib/gcc/x86_64-pc-cygwin/12/../../../../x86_64-pc-cygwin/bin/ld : CMakeFiles/tbb.dir/rml_tbb.cpp.o:rml_tbb.cpp:(.rdata$.refptr.__RML_close_factory[.refptr.__RML_close_factory]+0x0) : référence indéfinie vers « __RML_close_factory »
/usr/lib/gcc/x86_64-pc-cygwin/12/../../../../x86_64-pc-cygwin/bin/ld : CMakeFiles/tbb.dir/rml_tbb.cpp.o:rml_tbb.cpp:(.rdata$.refptr.__TBB_make_rml_server[.refptr.__TBB_make_rml_server]+0x0) : référence indéfinie vers « __TBB_make_rml_server »
/usr/lib/gcc/x86_64-pc-cygwin/12/../../../../x86_64-pc-cygwin/bin/ld : CMakeFiles/tbb.dir/rml_tbb.cpp.o:rml_tbb.cpp:(.rdata$.refptr.__RML_open_factory[.refptr.__RML_open_factory]+0x0) : référence indéfinie vers « __RML_open_factory »
collect2: erreur: ld a retourné le statut de sortie 1
make[2]: *** [src/tbb/CMakeFiles/tbb.dir/build.make:594: gnu_12.4_cxx11_64_relwithdebinfo/cygtbb-12.dll] Error 1
make[1]: *** [CMakeFiles/Makefile2:467: src/tbb/CMakeFiles/tbb.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

My computer is in French so the first message "référence indéfinie vers « __TBB_call_with_my_server_info »" means in English : "Undefined reference to __TBB_call_with_my_server_info"

Can you help me about that ? And maybe, I could test the library on Cygwin and tell you if everything is okay with these changes :)

Thanks

@wehostadm Unfortunately we cant provide support for the Cygwin64 as it is not in the list of supported compilers of oneTBB. If possible than you can look into the oneAPI base toolkit which includes the compiler and other supported libraries.