#5134 closed Support Requests (invalid)
[thread] Simple, all sources, compile fails
Reported by: | René Rivera | Owned by: | viboes |
---|---|---|---|
Milestone: | To Be Determined | Component: | thread |
Version: | Boost 1.45.0 | Severity: | Problem |
Keywords: | Cc: | viboes |
Description
If I try to do a simple/dumb compile I get errors because some source files assume that they will only be compiled in a particular platform/API. By simple/dumb I mean going to my build system, whatever that might be, and adding all the files under the libs/thread/src/*.cpp
& libs/thread/src/*/*.cpp
.
Change History (11)
comment:1 by , 11 years ago
Type: | Bugs → Support Requests |
---|
comment:2 by , 11 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Closed by missing details.
comment:3 by , 11 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
Sorry for the very delayed response.. Didn't see the trac email about this.
I'm not sure how much more detail I can give other than I was trying to compile for iOS at the time. Simply put one can't compile the libs/thread/src/win32/*.cpp files when compiling for something other than a Windows target as it includes and references Windows specific headers and definitions.
Please note that I said "my build system". I.e. I'm not talking about building with BBv2 and the libs/thread/build/Jamfile.v2.
comment:4 by , 11 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | reopened → new |
How do you expect that we solve this issue, if it is one?
comment:5 by , 11 years ago
A common solution is to #ifdef (based on the platform) the source files so that they end up mostly empty.
follow-up: 7 comment:6 by , 11 years ago
Please, could you post the error you find and the command line used to get these errors? Otherwise we are unable to help you.
comment:7 by , 11 years ago
Replying to viboes:
Please, could you post the error you find and the command line used to get these errors? Otherwise we are unable to help you.
Sure.. Here's a simple example:
Froggy:trunk grafik$ uname -a Darwin Froggy.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64 Froggy:trunk grafik$ g++ --version i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00) Copyright (C) 2007 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Froggy:trunk grafik$ pwd /Users/grafik/devroots/Boost/trunk Froggy:trunk grafik$ cat thread_compile_test.cpp #include <boost/thread.hpp> int main() { return 0; } Froggy:trunk grafik$ g++ -I. thread_compile_test.cpp libs/thread/src/*.cpp libs/thread/src/*/*.cpp libs/thread/src/win32/thread.cpp:13:21: error: process.h: No such file or directory libs/thread/src/win32/thread.cpp:22:21: error: windows.h: No such file or directory libs/thread/src/win32/thread.cpp:30: error: ‘DWORD’ does not name a type libs/thread/src/win32/thread.cpp: In function ‘void boost::<unnamed>::create_current_thread_tls_key()’: libs/thread/src/win32/thread.cpp:34: error: ‘tss_cleanup_implemented’ was not declared in this scope libs/thread/src/win32/thread.cpp:35: error: ‘current_thread_tls_key’ was not declared in this scope libs/thread/src/win32/thread.cpp:35: error: ‘TlsAlloc’ was not declared in this scope libs/thread/src/win32/thread.cpp:40: error: ‘TLS_OUT_OF_INDEXES’ was not declared in this scope libs/thread/src/win32/thread.cpp: In function ‘void boost::<unnamed>::cleanup_tls_key()’: libs/thread/src/win32/thread.cpp:46: error: ‘current_thread_tls_key’ was not declared in this scope libs/thread/src/win32/thread.cpp:48: error: ‘TlsFree’ was not declared in this scope libs/thread/src/win32/thread.cpp: In function ‘boost::detail::thread_data_base* boost::<unnamed>::get_current_thread_data()’: libs/thread/src/win32/thread.cpp:55: error: ‘current_thread_tls_key’ was not declared in this scope libs/thread/src/win32/thread.cpp:59: error: ‘current_thread_tls_key’ was not declared in this scope libs/thread/src/win32/thread.cpp:59: error: ‘TlsGetValue’ was not declared in this scope libs/thread/src/win32/thread.cpp: In function ‘void boost::<unnamed>::set_current_thread_data(boost::detail::thread_data_base*)’: libs/thread/src/win32/thread.cpp:65: error: ‘current_thread_tls_key’ was not declared in this scope libs/thread/src/win32/thread.cpp:66: error: ‘TlsSetValue’ was not declared in this scope libs/thread/src/win32/thread.cpp: At global scope: libs/thread/src/win32/thread.cpp:76: error: expected `)' before ‘*’ token libs/thread/src/win32/thread.cpp:77: error: ‘func’ does not name a type libs/thread/src/win32/thread.cpp:79: error: expected `)' before ‘start_address’ libs/thread/src/win32/thread.cpp:82: error: ‘DWORD’ does not name a type libs/thread/src/win32/thread.cpp:91: error: expected `)' before ‘*’ token libs/thread/src/win32/thread.cpp:91: error: expected ‘,’ or ‘...’ before ‘*’ token libs/thread/src/win32/thread.cpp:91: error: ‘_beginthreadex’ declared as function returning a function libs/thread/src/win32/thread.cpp:92: error: expected unqualified-id before ‘void’ libs/thread/src/win32/thread.cpp:631: error: expected `}' at end of input libs/thread/src/win32/thread.cpp:631: error: expected `}' at end of input Froggy:trunk grafik$
Same applies for just about anywhere you try the equivalent simple operation.
HTH.
comment:8 by , 11 years ago
Depending on the target, the files that must be compiled and the compiler flags are different (see libs/boost/build/Jamfile)
alias thread_sources : ## win32 sources ## win32/thread.cpp win32/tss_dll.cpp win32/tss_pe.cpp : ## requirements ## <threadapi>win32 ; alias thread_sources : ## pthread sources ## pthread/thread.cpp pthread/once.cpp : ## requirements ## <threadapi>pthread ;
You will need to add at least the define BOOST_THREAD_POSIX and BOOST_THREAD_USE_LIB.
BTW, why do you want to do this?
comment:9 by , 11 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Closed, as Boost don't need to support this neither document which sources must be compiled other than the explicit build/Jamfile.
comment:10 by , 7 years ago
Because of this, it's impossible to compile for Android using BOOST_ALL_NO_LIB. I don't know why boost permanently makes my life a nightmare.
Please, could you provide more information so we can help you. I have moved to support request until you give the exact error and context.