From wmamrak at gmail.com Fri Dec 9 02:02:04 2011 From: wmamrak at gmail.com (Wojciech Mamrak) Date: Fri, 9 Dec 2011 02:02:04 +0100 Subject: [C++-sig] miscellaneous questions about boost.python Message-ID: Hello, I have a few doubts and questions I haven't found answer googling here and there. I hope you can help me with them. 1. When exposing C++ objects to python using Boost, instance dictionaries are created only "on demand", the first time the instance's __dict__ attribute is accessed [http://wiki.python.org/moin/boost.python/InternalDataStructures] Some Python scripts make use of __dict__, and here dicts are created only after assigning a value to non-existent (non-c++-defined) members. Is there any way to overcome this? 2. Is it possible to expose variadic functions to Python? Like: inline int printInts(int num, ...); 3. Is there a way to pass a list or dict object with all the arguments to a function as a single parameter? This is possible in Python C when calling a function and might be sometimes very useful. 4. The docs regarding the mutable copying problem are very misleading. Following Python and Boost scripts do not produce the same results: b = a = [] c = list(a) a.append("s1") print a.count("s1"), b.count("s1"), c.count("s1") #1 1 0 list a, b, c; b = a; c = list(a); a.append("s1"); list d = extract(a); printf("%i %i %i %i\n", a.count("s1"), b.count("s1"), c.count("s1"), d.count("s1")); //1 1 1 1 expected 1 1 0 1 according to Pythonic behaviour. This is in confilct with example provided in the tutorial. 5. BOOST_PYTHON_FUNCTION_OVERLOADS and friends on my MSVC10 produce errors C2246 and C2892. 6. Is it ok to expose to Python just some properties/methods of a c++ class? As long as all classes, that the mentioned class inherits after, are defined in boost python, I assume there is no risk that objects created in Python are not complete and compatible (i.e. might not work properly when extracted back to C++). Is this assumption valid? I can provide an example if my intentions are not clear to you. thanks From hans_meine at gmx.net Tue Dec 13 11:03:42 2011 From: hans_meine at gmx.net (Hans Meine) Date: Tue, 13 Dec 2011 11:03:42 +0100 Subject: [C++-sig] boost/slice.hpp: error in compatibility function get_indicies Message-ID: Hi, I am not sure whether this is already fixed in trunk, but I have just noticed that the compatibility function get_indicies() in line 251 of slice.hpp does not properly pass on the results of calling the renamed function (i.e. it misses the 'return'). In effect, you get a compiler warning that tells you about the renamed function, but it should be fixed nevertheless... ;-) Best, Hans From rwgrosse-kunstleve at lbl.gov Tue Dec 13 17:11:18 2011 From: rwgrosse-kunstleve at lbl.gov (Ralf Grosse-Kunstleve) Date: Tue, 13 Dec 2011 08:11:18 -0800 Subject: [C++-sig] boost/slice.hpp: error in compatibility function get_indicies In-Reply-To: References: Message-ID: Yes, sorry for the oversight. I fixed it yesterday (trunk + release branch). Ralf On Tue, Dec 13, 2011 at 2:03 AM, Hans Meine wrote: > Hi, > > I am not sure whether this is already fixed in trunk, but I have just > noticed that the compatibility function get_indicies() in line 251 of > slice.hpp does not properly pass on the results of calling the renamed > function (i.e. it misses the 'return'). In effect, you get a compiler > warning that tells you about the renamed function, but it should be fixed > nevertheless... ;-) > > Best, > Hans > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig at python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From josh.davidson at lmco.com Sat Dec 17 01:23:25 2011 From: josh.davidson at lmco.com (Davidson, Josh) Date: Sat, 17 Dec 2011 00:23:25 +0000 Subject: [C++-sig] pygccxml KeyError Message-ID: <86299D4CFE2C1248AA41ACF782B0D14310D67CD4@HDXDSP12.us.lmco.com> Hopefully, there's enough information in the traceback, but if not I can try to sanitize an example. I'm on rev 1856. INFO gccxml cmd: ""C:\MinGW\bin\gccxml.exe" -DBOOST_NO_RVALUE_REFERENCES -D__mode__(x)= -I"." -I"C:\Users\davidsj2\workspace\SimulationInterface\src\C++\model_io\storage" -I"C:\Users\davidsj2\workspace\SimulationInterface\src\C++" -I"C:\Users\davidsj2\workspace\SimulationInterface\src\C++\model_io\storage" -I"c:\Python26\include" -I"C:\Users\davidsj2\workspace\SimulationInterface\src\C++\model_io\storage" "C:\Users\davidsj2\workspace\SimulationInterface\src\C++\model_io\storage\SpaceWireStore.hpp" -fxml="c:\users\davidsj2\appdata\local\temp\tmpnxyjfn.xml"" INFO GCCXML version - 0.9( 1.135 ) ['C:\\Users\\davidsj2\\workspace\\SimulationInterface', 'c:\\Python26\\lib\\site-packages\\setuptools-0.6c11-py2.6.egg', 'c:\\Python26\\lib\\site-packages\\rpyc-3.2.0-py2.6.egg', 'c:\\Python26\\lib\\site-packages\\construct-2.06-py2.6.egg', 'c:\\Python26\\lib\\site-packages\\winpexpect-1.5-py2.6.egg', 'c:\\Python26\\lib\\site-packages\\pyreadline-1.7.1.dev_r0-py2.6.egg', 'C:\\Users\\davidsj2\\workspace\\SimCommon\\src', 'C:\\Windows\\system32\\python26.zip', 'c:\\Python26\\DLLs', 'c:\\Python26\\lib', 'c:\\Python26\\lib\\plat-win', 'c:\\Python26\\lib\\lib-tk', 'c:\\Python26', 'c:\\Python26\\lib\\site-packages', 'c:\\Python26\\lib\\site-packages\\win32', 'c:\\Python26\\lib\\site-packages\\win32\\lib', 'c:\\Python26\\lib\\site-packages\\Pythonwin'] Traceback (most recent call last): File "setup.py", line 27, in extensions = [b.getExtension() for b in bindings] File "C:\Users\davidsj2\workspace\SimCommon\src\sim\build\bindings.py", line 287, in getExtension self._generate() File "C:\Users\davidsj2\workspace\SimCommon\src\sim\build\bindings.py", line 223, in _generate cflags=cflags) File "c:\Python26\lib\site-packages\pyplusplus\module_builder\boost_python_builder.py", line 95, in __init__ , indexing_suite_version) File "c:\Python26\lib\site-packages\pyplusplus\module_builder\boost_python_builder.py", line 138, in __parse_declarations decls = reader.read_files( files, compilation_mode ) File "c:\Python26\lib\site-packages\pygccxml\parser\project_reader.py", line 217, in read_files return self.__parse_file_by_file(files) File "c:\Python26\lib\site-packages\pygccxml\parser\project_reader.py", line 272, in __parse_file_by_file leaved_classes = self._join_class_hierarchy( answer ) File "c:\Python26\lib\site-packages\pygccxml\parser\project_reader.py", line 445, in _join_class_hierarchy leaved_derived = leaved_classes[ create_key( derived_info.related_class ) ] KeyError: (('c:/mingw64-i686-20110207/lib/gcc/../../x86_64-w64-mingw32/include/boost/intrusive/options.hpp', 209), ('::', 'boost', 'intrusive', 'constant_time_size', 'pack::pack >')) -------------- next part -------------- An HTML attachment was scrubbed... URL: From roman.yakovenko at gmail.com Mon Dec 19 20:37:11 2011 From: roman.yakovenko at gmail.com (Roman Yakovenko) Date: Mon, 19 Dec 2011 21:37:11 +0200 Subject: [C++-sig] pygccxml KeyError In-Reply-To: <86299D4CFE2C1248AA41ACF782B0D14310D67CD4@HDXDSP12.us.lmco.com> References: <86299D4CFE2C1248AA41ACF782B0D14310D67CD4@HDXDSP12.us.lmco.com> Message-ID: On Sat, Dec 17, 2011 at 2:23 AM, Davidson, Josh wrote: > Hopefully, there?s enough information in the traceback, but if not I can try > to sanitize an example.? I?m on rev 1856. More or less. Sorry for late response, I was pretty busy. > ? File "c:\Python26\lib\site-packages\pygccxml\parser\project_reader.py", > line 445, in _join_class_hierarchy You are using project_reader_t class to parse a set of C++ files. This method is not reliable and pretty slow. I suggest you to use "source_reader_t" class. Please read the project documentation, it explains how to start using it. Regards, Roman From josh.davidson at lmco.com Mon Dec 19 21:00:24 2011 From: josh.davidson at lmco.com (Davidson, Josh) Date: Mon, 19 Dec 2011 20:00:24 +0000 Subject: [C++-sig] EXTERNAL: Re: pygccxml KeyError In-Reply-To: References: <86299D4CFE2C1248AA41ACF782B0D14310D67CD4@HDXDSP12.us.lmco.com> Message-ID: <86299D4CFE2C1248AA41ACF782B0D14310D701C5@HDXDSP11.us.lmco.com> Short of modifying the distribution, I don't see any way within Py++ to change the type of reader. It seems to be hardcoded to project_reader_t: def __parse_declarations( self, files, gccxml_config, compilation_mode, cache, indexing_suite_version ): if None is gccxml_config: gccxml_config = parser.config_t() if None is compilation_mode: compilation_mode = parser.COMPILATION_MODE.FILE_BY_FILE start_time = time.clock() self.logger.debug( 'parsing files - started' ) reader = parser.project_reader_t( gccxml_config, cache, decl_wrappers.dwfactory_t() ) -----Original Message----- From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On Behalf Of Roman Yakovenko Sent: Monday, December 19, 2011 12:37 PM To: Development of Python/C++ integration Subject: EXTERNAL: Re: [C++-sig] pygccxml KeyError On Sat, Dec 17, 2011 at 2:23 AM, Davidson, Josh wrote: > Hopefully, there's enough information in the traceback, but if not I > can try to sanitize an example.? I'm on rev 1856. More or less. Sorry for late response, I was pretty busy. > ? File > "c:\Python26\lib\site-packages\pygccxml\parser\project_reader.py", > line 445, in _join_class_hierarchy You are using project_reader_t class to parse a set of C++ files. This method is not reliable and pretty slow. I suggest you to use "source_reader_t" class. Please read the project documentation, it explains how to start using it. Regards, Roman _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig at python.org http://mail.python.org/mailman/listinfo/cplusplus-sig From josh.davidson at lmco.com Mon Dec 19 21:07:03 2011 From: josh.davidson at lmco.com (Davidson, Josh) Date: Mon, 19 Dec 2011 20:07:03 +0000 Subject: [C++-sig] EXTERNAL: Re: pygccxml KeyError References: <86299D4CFE2C1248AA41ACF782B0D14310D67CD4@HDXDSP12.us.lmco.com> Message-ID: <86299D4CFE2C1248AA41ACF782B0D14310D701D1@HDXDSP11.us.lmco.com> May have been a bit too quick to respond. Looks like setting the compilation mode can be used to have the project_reader_t use a source_reader_t. Sorry about that. -----Original Message----- From: Davidson, Josh Sent: Monday, December 19, 2011 1:00 PM To: 'Development of Python/C++ integration' Subject: RE: EXTERNAL: Re: [C++-sig] pygccxml KeyError Short of modifying the distribution, I don't see any way within Py++ to change the type of reader. It seems to be hardcoded to project_reader_t: def __parse_declarations( self, files, gccxml_config, compilation_mode, cache, indexing_suite_version ): if None is gccxml_config: gccxml_config = parser.config_t() if None is compilation_mode: compilation_mode = parser.COMPILATION_MODE.FILE_BY_FILE start_time = time.clock() self.logger.debug( 'parsing files - started' ) reader = parser.project_reader_t( gccxml_config, cache, decl_wrappers.dwfactory_t() ) -----Original Message----- From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On Behalf Of Roman Yakovenko Sent: Monday, December 19, 2011 12:37 PM To: Development of Python/C++ integration Subject: EXTERNAL: Re: [C++-sig] pygccxml KeyError On Sat, Dec 17, 2011 at 2:23 AM, Davidson, Josh wrote: > Hopefully, there's enough information in the traceback, but if not I > can try to sanitize an example.? I'm on rev 1856. More or less. Sorry for late response, I was pretty busy. > ? File > "c:\Python26\lib\site-packages\pygccxml\parser\project_reader.py", > line 445, in _join_class_hierarchy You are using project_reader_t class to parse a set of C++ files. This method is not reliable and pretty slow. I suggest you to use "source_reader_t" class. Please read the project documentation, it explains how to start using it. Regards, Roman _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig at python.org http://mail.python.org/mailman/listinfo/cplusplus-sig From josh.davidson at lmco.com Mon Dec 19 21:24:01 2011 From: josh.davidson at lmco.com (Davidson, Josh) Date: Mon, 19 Dec 2011 20:24:01 +0000 Subject: [C++-sig] EXTERNAL: Re: pygccxml KeyError References: <86299D4CFE2C1248AA41ACF782B0D14310D67CD4@HDXDSP12.us.lmco.com> Message-ID: <86299D4CFE2C1248AA41ACF782B0D14310D701FF@HDXDSP11.us.lmco.com> Actually, it is using a source_reader_t by default. __parse_declarations invokes __parse_file_by_file, which uses a source_reader_t (line 236) to parse each file. It then bombs out after parsing all of the files when it calls _join_class_hierarchy. I continue to have this issue with various combinations of classes. In other words, I have headers that work fine with parsed in isolation, but when I try to build a module containing both, I get the KeyError. -----Original Message----- From: Davidson, Josh Sent: Monday, December 19, 2011 1:07 PM To: 'Development of Python/C++ integration' Subject: RE: EXTERNAL: Re: [C++-sig] pygccxml KeyError May have been a bit too quick to respond. Looks like setting the compilation mode can be used to have the project_reader_t use a source_reader_t. Sorry about that. -----Original Message----- From: Davidson, Josh Sent: Monday, December 19, 2011 1:00 PM To: 'Development of Python/C++ integration' Subject: RE: EXTERNAL: Re: [C++-sig] pygccxml KeyError Short of modifying the distribution, I don't see any way within Py++ to change the type of reader. It seems to be hardcoded to project_reader_t: def __parse_declarations( self, files, gccxml_config, compilation_mode, cache, indexing_suite_version ): if None is gccxml_config: gccxml_config = parser.config_t() if None is compilation_mode: compilation_mode = parser.COMPILATION_MODE.FILE_BY_FILE start_time = time.clock() self.logger.debug( 'parsing files - started' ) reader = parser.project_reader_t( gccxml_config, cache, decl_wrappers.dwfactory_t() ) -----Original Message----- From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On Behalf Of Roman Yakovenko Sent: Monday, December 19, 2011 12:37 PM To: Development of Python/C++ integration Subject: EXTERNAL: Re: [C++-sig] pygccxml KeyError On Sat, Dec 17, 2011 at 2:23 AM, Davidson, Josh wrote: > Hopefully, there's enough information in the traceback, but if not I > can try to sanitize an example.? I'm on rev 1856. More or less. Sorry for late response, I was pretty busy. > ? File > "c:\Python26\lib\site-packages\pygccxml\parser\project_reader.py", > line 445, in _join_class_hierarchy You are using project_reader_t class to parse a set of C++ files. This method is not reliable and pretty slow. I suggest you to use "source_reader_t" class. Please read the project documentation, it explains how to start using it. Regards, Roman _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig at python.org http://mail.python.org/mailman/listinfo/cplusplus-sig From roman.yakovenko at gmail.com Mon Dec 19 21:34:47 2011 From: roman.yakovenko at gmail.com (Roman Yakovenko) Date: Mon, 19 Dec 2011 22:34:47 +0200 Subject: [C++-sig] EXTERNAL: Re: pygccxml KeyError In-Reply-To: <86299D4CFE2C1248AA41ACF782B0D14310D701FF@HDXDSP11.us.lmco.com> References: <86299D4CFE2C1248AA41ACF782B0D14310D67CD4@HDXDSP12.us.lmco.com> <86299D4CFE2C1248AA41ACF782B0D14310D701FF@HDXDSP11.us.lmco.com> Message-ID: On Mon, Dec 19, 2011 at 10:24 PM, Davidson, Josh wrote: > Actually, it is using a source_reader_t by default. ?__parse_declarations invokes __parse_file_by_file, which uses a source_reader_t (line 236) to parse each file. ?It then bombs out after parsing all of the files when it calls _join_class_hierarchy. > > I continue to have this issue with various combinations of classes. ?In other words, I have headers that work fine with parsed in isolation, but when I try to build a module containing both, I get the KeyError. Can you create a single header file, which includes all others? HTH From josh.davidson at lmco.com Mon Dec 19 23:05:06 2011 From: josh.davidson at lmco.com (Davidson, Josh) Date: Mon, 19 Dec 2011 22:05:06 +0000 Subject: [C++-sig] EXTERNAL: Re: pygccxml KeyError In-Reply-To: References: <86299D4CFE2C1248AA41ACF782B0D14310D67CD4@HDXDSP12.us.lmco.com> <86299D4CFE2C1248AA41ACF782B0D14310D701FF@HDXDSP11.us.lmco.com> Message-ID: <86299D4CFE2C1248AA41ACF782B0D14310D7025B@HDXDSP11.us.lmco.com> Including everything into a single header does work, so it looks like there is a problem with the joining process. Well, it builds anyways. I still get compilation error W1050 telling me that I didn't specify a call policies (I did and they show up in the generated code). These are the Py++ settings I'm using for this minimal example: mb.code_creator.add_include("model_io/storage/SharedMemoryBuilder.hpp") mb.code_creator.add_include("boost/interprocess/managed_shared_memory.hpp") mb.code_creator.add_include("string") mb.class_("SpaceWireStore").member_functions(lambda decl: decl.name.startswith("getUrgent")).call_policies = \ call_policies.return_value_policy(call_policies.reference_existing_object) mb.class_("SpaceWireStore").member_functions(lambda decl: decl.name.startswith("getNormal")).call_policies = \ call_policies.return_value_policy(call_policies.reference_existing_object) Here are the 4 header files that when used together will reproduce the issue: SharedMemoryDeleter.hpp, SharedMemoryBuilder.hpp, DiscreteStore.hpp, & SpaceWireStore.hpp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #ifndef SHAREDMEMORYDELETER_HPP_ #define SHAREDMEMORYDELETER_HPP_ #include class SharedMemoryDeleter { public: SharedMemoryDeleter(const std::string& name); ~SharedMemoryDeleter(); protected: std::string mName; }; #endif /* SHAREDMEMORYDELETER_HPP_ */ --------------------------------------------------------------------------------------------------------------------- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #ifndef SHAREDMEMORYBUILDER_HPP_ #define SHAREDMEMORYBUILDER_HPP_ #include #include #include #include "SharedMemoryDeleter.hpp" class SharedMemoryBuilder { public: SharedMemoryBuilder(const std::string& name, size_t num_bytes); virtual ~SharedMemoryBuilder(); boost::shared_ptr getSegment(); protected: SharedMemoryDeleter mDeleter; boost::shared_ptr mSegment; }; #endif /* SHAREDMEMORYBUILDER_HPP_ */ --------------------------------------------------------------------------------------------------------------------- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #ifndef SHAREDMEMORYBUILDER_HPP_ #define SHAREDMEMORYBUILDER_HPP_ #include #include #include #include "SharedMemoryDeleter.hpp" class SharedMemoryBuilder { public: SharedMemoryBuilder(const std::string& name, size_t num_bytes); virtual ~SharedMemoryBuilder(); boost::shared_ptr getSegment(); protected: SharedMemoryDeleter mDeleter; boost::shared_ptr mSegment; }; #endif /* SHAREDMEMORYBUILDER_HPP_ */ --------------------------------------------------------------------------------------------------------------------- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #ifndef DISCRETESTORE_HPP_ #define DISCRETESTORE_HPP_ #include #include #include #include #include class DiscreteStore { public: enum { NUM_BUFFERS = 4 }; DiscreteStore(); ~DiscreteStore(); void frameTransition(); bool getSimicsInput(); void setSimicsOutput(bool isHigh); bool getSimInput(); void setSimOutput(bool isHigh); protected: bool mIsHigh[NUM_BUFFERS]; size_t mSimicsInIndex; size_t mSimicsOutIndex; size_t mSimInIndex; size_t mSimOutIndex; }; #endif /* DISCRETESTORE_HPP_ */ --------------------------------------------------------------------------------------------------------------------- -----Original Message----- From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On Behalf Of Roman Yakovenko Sent: Monday, December 19, 2011 1:35 PM To: Development of Python/C++ integration Subject: Re: [C++-sig] EXTERNAL: Re: pygccxml KeyError On Mon, Dec 19, 2011 at 10:24 PM, Davidson, Josh wrote: > Actually, it is using a source_reader_t by default. ?__parse_declarations invokes __parse_file_by_file, which uses a source_reader_t (line 236) to parse each file. ?It then bombs out after parsing all of the files when it calls _join_class_hierarchy. > > I continue to have this issue with various combinations of classes. ?In other words, I have headers that work fine with parsed in isolation, but when I try to build a module containing both, I get the KeyError. Can you create a single header file, which includes all others? HTH _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig at python.org http://mail.python.org/mailman/listinfo/cplusplus-sig From josh.davidson at lmco.com Mon Dec 19 20:01:31 2011 From: josh.davidson at lmco.com (Davidson, Josh) Date: Mon, 19 Dec 2011 19:01:31 +0000 Subject: [C++-sig] Complaint about missing call policies, when they are in fact specified Message-ID: <86299D4CFE2C1248AA41ACF782B0D14310D7017E@HDXDSP11.us.lmco.com> I'm adding return value call policies to methods of a class as follows: mb.class_("SerialStore").member_functions(lambda decl: decl.name.startswith("getSim")).call_policies = \ call_policies.return_internal_reference() -------------------------------------------------------------------------------------------------------------------------- During generation, I get the following warning: WARNING: boost::container::list, 0ull>, boost::interprocess::iset_index> > > * SerialStore::getSimicsInput() [member function] > compilation error W1050: The function returns > "boost::container::list char,boost::interprocess::allocator boost::interprocess::segment_manager _best_fit boost::interprocess::offset_ptr, 0ull>, > boost::interprocess::iset_index> > > *" type. You have to specify a > call policies.Be sure to take a look on `Py++` defined call policies -------------------------------------------------------------------------------------------------------------------------- Here is the generated code for that method that appears to have the call policy specified: { //::SerialStore::getSimicsInput typedef ::boost::container::list, 0ull>, boost::interprocess::iset_index> > > * ( ::SerialStore::*getSimicsInput_function_type )( ) ; SerialStore_exposer.def( "getSimicsInput" , getSimicsInput_function_type( &::SerialStore::getSimicsInput ) , bp::return_internal_reference< >() ); } From roman.yakovenko at gmail.com Tue Dec 20 08:40:51 2011 From: roman.yakovenko at gmail.com (Roman Yakovenko) Date: Tue, 20 Dec 2011 09:40:51 +0200 Subject: [C++-sig] Complaint about missing call policies, when they are in fact specified In-Reply-To: <86299D4CFE2C1248AA41ACF782B0D14310D7017E@HDXDSP11.us.lmco.com> References: <86299D4CFE2C1248AA41ACF782B0D14310D7017E@HDXDSP11.us.lmco.com> Message-ID: On Mon, Dec 19, 2011 at 9:01 PM, Davidson, Josh wrote: > I'm adding return value call policies to methods of a class as follows: > ? ? ? ?mb.class_("SerialStore").member_functions(lambda decl: decl.name.startswith("getSim")).call_policies = \ > ? ? ? ? ? ?call_policies.return_internal_reference() > > -------------------------------------------------------------------------------------------------------------------------- > > During generation, I get the following warning: > WARNING: boost::container::list, 0ull>, boost::interprocess::iset_index> > > * SerialStore::getSimicsInput() [member function] > >> compilation error W1050: The function returns > >> "boost::container::list >> char,boost::interprocess::allocator >> boost::interprocess::segment_manager >> _best_fit >> boost::interprocess::offset_ptr, 0ull>, > >> boost::interprocess::iset_index> > > *" type. You have to specify a > >> call policies.Be sure to take a look on `Py++` defined call policies > > -------------------------------------------------------------------------------------------------------------------------- > > Here is the generated code for that method that appears to have the call policy specified: > ? ? ? ?{ //::SerialStore::getSimicsInput > > ? ? ? ? ? ?typedef ::boost::container::list, 0ull>, boost::interprocess::iset_index> > > * ( ::SerialStore::*getSimicsInput_function_type )( ?) ; > > ? ? ? ? ? ?SerialStore_exposer.def( > ? ? ? ? ? ? ? ?"getSimicsInput" > ? ? ? ? ? ? ? ?, getSimicsInput_function_type( &::SerialStore::getSimicsInput ) > ? ? ? ? ? ? ? ?, bp::return_internal_reference< >() ); > > ? ? ? ?} Please open a bug on sorceforge with the source code to reproduce it. Meanwhile, py++ provides functionality to disable warnings ( for the concrete declaration ) - just use it. Roman From josh.davidson at lmco.com Wed Dec 21 01:44:31 2011 From: josh.davidson at lmco.com (Davidson, Josh) Date: Wed, 21 Dec 2011 00:44:31 +0000 Subject: [C++-sig] EXTERNAL: Re: pygccxml KeyError In-Reply-To: References: <86299D4CFE2C1248AA41ACF782B0D14310D67CD4@HDXDSP12.us.lmco.com> <86299D4CFE2C1248AA41ACF782B0D14310D701FF@HDXDSP11.us.lmco.com> Message-ID: <86299D4CFE2C1248AA41ACF782B0D14310D7082F@HDXDSP11.us.lmco.com> I did run into a couple subtle problems with this approach. Depending on where I put the header file, Py++ doesn't generate pypp.hpp/pypp.cpp files that actually register the data structures. Everything shows up in the exposed_decl.pypp.txt file, but there are no Py++ generated source files to actually get compiled into the extension. Just where the file can be placed and where it can't is quite puzzling. Initially, I wanted to build the fake header as a string using file_configuration_t and CONTENT_TYPE.TEXT as my files argument to module builder, but that didn't work. I then created a real fake header in the filesystem, and it initially didn't work either. After much trial and error, I found that it would work if placed in certain directories. This is all that is in the header that I'm generating: #include "LoggerInterface.h" #include "LogWriter.h" #include "SchedulerInterface.h" #include "SimLoggerInterface.h" #include "ThreadInterface.h" #include "TimeInterface.h" Here is a quick summary of some directories I've tried (source code for bindings is in: C:\Users\davidsj2\workspace\SimExternalInterfaces\src\C++\SimInterfaces\SimExecInterfaces) C:\ - Outlier. Spit out additional warnings and the build failed C:\temp - FAIL C:\Users - PASS - PASS \hello - FAIL \workspace - PASS \workspace\test - FAIL \workspace\SimExternalInterfaces - PASS \workspace\SimExternalInterfaces\build - FAIL And many more It seems like in order to work, the parent hierarchy of the fake header has to be an ancestor of the source directory. As you'll note above, any time I branched away from the path leading to the source files, I ran into a problem. Adding the parent directory for the fake header to the include_paths, does not resolve the problem. I believe the string based approach also fails because py++ ends up creating a temporary file in a directory that is not an ancestor of the source. Below, I'm including the build output for a build where the fake header is in a functioning directory, a non-functioning directory, and where it's included as in in-memory string using file_configuration_t. -------------------------------------- CORRECT OUTPUT WITH FAKE HEADER IN SOURCE DIRECTORY ---------------------------------- INFO Parsing source file "C:\Users\davidsj2\workspace\SimExternalInterfaces\src\C++\SimInterfaces\SimExecInterfaces\executivefake.hpp" ... INFO gccxml cmd: ""C:\MinGW\bin\gccxml.exe" -DBOOST_NO_RVALUE_REFERENCES -D__mode__(x)= -DMS_WIN64 -I"." -I"C:\Users\davidsj2\workspace\SimExternalInterfaces\src\C++\SimInterfaces\SimExecInterfaces" -I"C:\Users\davidsj2\workspace\SimExternalInterfaces\src\C++\SimInterfaces\SimExecInterfaces" -I"c:\Python26\include" -I"C:\Users\davidsj2\workspace\SimExternalInterfaces\src\C++\SimInterfaces\SimExecInterfaces" -I"C:\Users\davidsj2\workspace\SimExternalInterfaces\build\win64\sim\external" "C:\Users\davidsj2\workspace\SimExternalInterfaces\src\C++\SimInterfaces\SimExecInterfaces\executivefake.hpp" -fxml="c:\users\davidsj2\appdata\local\temp\tmpimmd0m.xml"" INFO GCCXML version - 0.9( 1.135 ) INFO: file "named_tuple.py" - updated( 0.007568 seconds ) INFO: file "LogWriter.pypp.hpp" - updated( 0.007633 seconds ) INFO: file "LogWriter.pypp.cpp" - updated( 0.007400 seconds ) INFO: file "SchedulerInterface.pypp.hpp" - updated( 0.008093 seconds ) INFO: file "SchedulerInterface.pypp.cpp" - updated( 0.007427 seconds ) INFO: file "SimLoggerInterface.pypp.hpp" - updated( 0.008928 seconds ) INFO: file "SimLoggerInterface.pypp.cpp" - updated( 0.008304 seconds ) INFO: file "ThreadInterface.pypp.hpp" - updated( 0.007347 seconds ) INFO: file "ThreadInterface.pypp.cpp" - updated( 0.009345 seconds ) INFO: file "TimeInterface.pypp.hpp" - updated( 0.008310 seconds ) INFO: file "TimeInterface.pypp.cpp" - updated( 0.009422 seconds ) INFO: file "executive_enumerations.pypp.hpp" - updated( 0.008549 seconds ) INFO: file "executive_enumerations.pypp.cpp" - updated( 0.009992 seconds ) INFO: file "executive.main.cpp" - updated( 0.009686 seconds -------------------------------------- INCORRECT OUTPUT WITH FAKE HEADER IN A DIFFERENT DIR ---------------------------------- python setup.py bdist_egg --plat-name=win64 build_ext --compiler=mingw32 build --build-platlib=build\win64 INFO Parsing source file "C:\Users\davidsj2\hello\executivefake.hpp" ... INFO gccxml cmd: ""C:\MinGW\bin\gccxml.exe" -DBOOST_NO_RVALUE_REFERENCES -D__mode__(x)= -DMS_WIN64 -I"." -I"C:\Users\davidsj2\workspace\SimExternalInterfaces\src\C++\SimInterfaces\SimExecInterfaces" -I"C:\Users\davidsj2\workspace\SimExternalInterfaces\src\C++\SimInterfaces\SimExecInterfaces" -I"c:\Python26\include" -I"C:\Users\davidsj2\workspace\SimExternalInterfaces\src\C++\SimInterfaces\SimExecInterfaces" "C:\Users\davidsj2\hello\executivefake.hpp" -fxml="c:\users\davidsj2\appdata\local\temp\tmppbg0jc.xml"" INFO GCCXML version - 0.9( 1.135 ) INFO: file "named_tuple.py" - updated( 0.007635 seconds ) INFO: file "executive.main.cpp" - updated( 0.050896 seconds ) -------------------------------------- INCORRECT OUTPUT WITH FAKE HEADER AS A STRING ---------------------------------- python setup.py bdist_egg --plat-name=win64 build_ext --compiler=mingw32 build --build-platlib=build\win64 INFO gccxml cmd: ""C:\MinGW\bin\gccxml.exe" -DBOOST_NO_RVALUE_REFERENCES -D__mode__(x)= -DMS_WIN64 -I"." -I"C:\Users\davidsj2\workspace\SimExternalInterfaces\src\C++\SimInterfaces\SimExecInterfaces" -I"C:\Users\davidsj2\workspace\SimExternalInterfaces\src\C++\SimInterfaces\SimExecInterfaces" -I"c:\Python26\include" -I"C:\Users\davidsj2\workspace\SimExternalInterfaces\src\C++\SimInterfaces\SimExecInterfaces" "c:\users\davidsj2\appdata\local\temp\tmpe3ooz9.h" -fxml="c:\users\davidsj2\appdata\local\temp\tmptogx_j.xml"" INFO GCCXML version - 0.9( 1.135 ) INFO: file "named_tuple.py" - updated( 0.003908 seconds ) INFO: file "executive.main.cpp" - updated( 0.008799 seconds ) -----Original Message----- From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On Behalf Of Roman Yakovenko Sent: Monday, December 19, 2011 1:35 PM To: Development of Python/C++ integration Subject: Re: [C++-sig] EXTERNAL: Re: pygccxml KeyError On Mon, Dec 19, 2011 at 10:24 PM, Davidson, Josh wrote: > Actually, it is using a source_reader_t by default. ?__parse_declarations invokes __parse_file_by_file, which uses a source_reader_t (line 236) to parse each file. ?It then bombs out after parsing all of the files when it calls _join_class_hierarchy. > > I continue to have this issue with various combinations of classes. ?In other words, I have headers that work fine with parsed in isolation, but when I try to build a module containing both, I get the KeyError. Can you create a single header file, which includes all others? HTH _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig at python.org http://mail.python.org/mailman/listinfo/cplusplus-sig From happybrowndog at hotmail.com Wed Dec 21 10:23:36 2011 From: happybrowndog at hotmail.com (hbd666) Date: Wed, 21 Dec 2011 01:23:36 -0800 Subject: [C++-sig] Building Boost Python problem Message-ID: Hi I hope someone can help me out... The object is to build boost python (boost-1.4.8, python 2.7 32bit, windows 7 64bit, mingw). I've been trying to fix this for a good 8 hours but can't figure it out. bjam --with-python --build-type=complete --toolset=gcc stage Looking at the resulting output below, I see the problem is probably that bjam can't find python27.lib. I just don't see how that is possible because it finds python.exe in C:\Python27 and indeed python27.lib exists in the C:\Python27\libs directory. Resulting output..... Component configuration: - chrono : not building - date_time : not building - exception : not building - filesystem : not building - graph : not building - graph_parallel : not building - iostreams : not building - locale : not building - math : not building - mpi : not building - program_options : not building - python : building - random : not building - regex : not building - serialization : not building - signals : not building - system : not building - test : not building - thread : not building - timer : not building - wave : not building ...patience... ...patience... ...found 1932 targets... ...updating 16 targets... gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a Creating library file: bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\module.o:module.cpp:(.text+0x165): undefined reference to `_imp__Py_InitModule4 ' collect2: ld returned 1 exit status "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R -Wl,"C:\Python27\libs" "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a" -o "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll" -shared -Wl,--start-group "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\numeric.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\list.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\long.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\dict.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\tuple.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\str.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\slice.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\from_python.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\registry.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\type_id.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\enum.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\class.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\function.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\inheritance.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\life_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\pickle_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\errors.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\module.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\builtin_converters.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\arg_to_python_base.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\stl_iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object_protocol.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object_operators.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\wrapper.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\import.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\exec.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\function_doc_signature.o" -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -mthreads ...failed gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll... ...removing bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a ...skipped libboost_python-mgw46-mt-1_48.dll.a for lack of libboost_python-mgw46-mt-1_48.dll.a... ...skipped libboost_python-mgw46-mt-1_48.dll for lack of libboost_python-mgw46-mt-1_48.dll... gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a Creating library file: bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\debug\module.o: In function `ZN5boost6python6detail11init_moduleEPKcPFvvE': D:\boost_1_48_0\libs\python\example\quickstart/../../../../libs/python/src/module.cpp:59: undefined reference to `_imp__Py_InitModule4 ' collect2: ld returned 1 exit status "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R -Wl,"C:\Python27\libs" "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a" -o "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll" -shared -Wl,--start-group "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\numeric.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\list.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\long.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\dict.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\tuple.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\str.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\slice.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\from_python.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\registry.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\type_id.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\enum.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\class.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\function.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\inheritance.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\life_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\pickle_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\errors.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\module.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\builtin_converters.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\arg_to_python_base.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\stl_iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object_protocol.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object_operators.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\wrapper.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\import.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\exec.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\function_doc_signature.o" -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -g ...failed gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll... ...removing bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a ...skipped libboost_python-mgw46-d-1_48.dll.a for lack of libboost_python-mgw46-d-1_48.dll.a... ...skipped libboost_python-mgw46-d-1_48.dll for lack of libboost_python-mgw46-d-1_48.dll... gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a Creating library file: bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\release\module.o:module.cpp:(.text+0x165): undefined reference to `_imp__Py_InitModule4 ' collect2: ld returned 1 exit status "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R -Wl,"C:\Python27\libs" "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a" -o "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll" -shared -Wl,--start-group "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\numeric.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\list.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\long.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\dict.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\tuple.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\str.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\slice.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\from_python.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\registry.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\type_id.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\enum.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\class.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\function.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\inheritance.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\life_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\pickle_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\errors.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\module.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\builtin_converters.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\arg_to_python_base.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\stl_iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object_protocol.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object_operators.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\wrapper.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\import.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\exec.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\function_doc_signature.o" -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group ...failed gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll... ...removing bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a ...skipped libboost_python-mgw46-1_48.dll.a for lack of libboost_python-mgw46-1_48.dll.a... ...skipped libboost_python-mgw46-1_48.dll for lack of libboost_python-mgw46-1_48.dll... gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a Creating library file: bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\module.o: In function `ZN5boost6python6detail11init_moduleEPKcPFvvE': D:\boost_1_48_0/libs/python/src/module.cpp:59: undefined reference to `_imp__Py_InitModule4 ' collect2: ld returned 1 exit status "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R -Wl,"C:\Python27\libs" "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a" -o "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll" -shared -Wl,--start-group "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\numeric.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\list.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\long.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\dict.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\tuple.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\str.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\slice.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\from_python.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\registry.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\type_id.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\enum.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\class.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\function.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\inheritance.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\life_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\pickle_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\errors.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\module.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\builtin_converters.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\arg_to_python_base.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\stl_iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object_protocol.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object_operators.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\wrapper.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\import.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\exec.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\function_doc_signature.o" -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -g -mthreads ...failed gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll... ...removing bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a ...skipped libboost_python-mgw46-mt-d-1_48.dll.a for lack of libboost_python-mgw46-mt-d-1_48.dll.a... ...skipped libboost_python-mgw46-mt-d-1_48.dll for lack of libboost_python-mgw46-mt-d-1_48.dll... ...failed updating 8 targets... ...skipped 8 targets... From josh.davidson at lmco.com Wed Dec 21 17:53:17 2011 From: josh.davidson at lmco.com (Davidson, Josh) Date: Wed, 21 Dec 2011 16:53:17 +0000 Subject: [C++-sig] EXTERNAL: Building Boost Python problem In-Reply-To: References: Message-ID: <86299D4CFE2C1248AA41ACF782B0D14310D708B5@HDXDSP11.us.lmco.com> I'm attaching my notes below. I will point out that while the directions reference 1.48, I've actually had problems with 1.48 and MinGW-W64. Specifically, I'm having problems with bjam building all libraries at once. Building individually appears to work, but I haven't bothered trying to build each one on its own yet. I've inquired on boost-build, but haven't heard anything back. Personally, I would recommend 1.47. If you'd like the def file referenced in the instructions, shoot me a personal email and I'll forward it to you. Keep in mind that you *cannot* use a 32-bit def file if you are using 64-bit Python. I will also forewarn you there are other issues with x64 Python and MinGW-W64 if you plan on building extensions. Take a look here: http://bugs.python.org/issue4709 ---Building Boost for MinGW----- h1. Building Boost Building Boost for MinGw is the opposite of fun. Here are some notes to get you through the misery. h2. x64 Windows *Directories* * C:\TEMP\boost_1_48_0 - Where Boost source code was extracted * c:\mingw64-i686-20110207 - 64-bit MinGw * C:\Python26 - 64-bit Python installation (2.6.6) * C:\TEMP\boost_build - Directory for storing build output *Steps* # Enter C:\TEMP\boost_1_48_0\tools\build\v2\engine # C:\TEMP\boost_1_48_0\tools\build\v2\engine>build.bat mingw --toolset-root=c:\mingw64-i686-20110207 # Copy bin./* to /bin # Change into C:\TEMP\boost_1_48_0 # C:\TEMP\boost_1_48_0>bootstrap.bat mingw --toolset-root=c:\mingw64-i686-20110207 --with-python-root=C:\Python26 # Make a temporary boost build directory, C:\TEMP\boost_build # Work through the following steps to workaround a bug that has been around for years, but seemingly will never get fixed:
1.	Open tools/build/v2/tools/python.jam
2.	There, locate the following code:
if [ version.check-jam-version 3 1 17 ] || ( [ os.name ] != NT )
{
    # Prior to version 3.1.17 Boost Jam's SHELL command did not support
    # quoted commands correctly on Windows. This means that on that
    # platform we do not support using a Python command interpreter
    # executable whose path contains a space character.
    python-cmd = \"$(python-cmd)\" ;
}
3.	Remove that code block completely. 
# Grab attachment:python26.def # Copy c:\windows\System32\python26.dll to the same location as attachment:python26.def # Execute: @dlltool --dllname python26.dll --def python26.def --output-lib libpython26.a@ # Copy libpython26.a to C:\Python26\libs # pre> bjam.exe --toolset=gcc --build-type=complete --build-dir=C:\TEMP\boost_build\build --stagedir=C:\TEMP\boost_build\stage -- address-model=64 define=BOOST_USE_WINDOWS_H threadapi=win32 target-os=windows stage # Copy all files under C:\temp\boost_build\stage\lib to c:\mingw64-i686-20110207\x86_64-w64-mingw32\lib64 # Copy C:\TEMP\boost_1_48_0\boost to c:\mingw64-i686-20110207\x86_64-w64-mingw32\inlcude -----Original Message----- From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On Behalf Of hbd666 Sent: Wednesday, December 21, 2011 2:24 AM To: cplusplus-sig at python.org Subject: EXTERNAL: [C++-sig] Building Boost Python problem Hi I hope someone can help me out... The object is to build boost python (boost-1.4.8, python 2.7 32bit, windows 7 64bit, mingw). I've been trying to fix this for a good 8 hours but can't figure it out. bjam --with-python --build-type=complete --toolset=gcc stage Looking at the resulting output below, I see the problem is probably that bjam can't find python27.lib. I just don't see how that is possible because it finds python.exe in C:\Python27 and indeed python27.lib exists in the C:\Python27\libs directory. Resulting output..... Component configuration: - chrono : not building - date_time : not building - exception : not building - filesystem : not building - graph : not building - graph_parallel : not building - iostreams : not building - locale : not building - math : not building - mpi : not building - program_options : not building - python : building - random : not building - regex : not building - serialization : not building - signals : not building - system : not building - test : not building - thread : not building - timer : not building - wave : not building ...patience... ...patience... ...found 1932 targets... ...updating 16 targets... gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a Creating library file: bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\module.o:module.cpp:(.text+0x165): undefined reference to `_imp__Py_InitModule4 ' collect2: ld returned 1 exit status "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R -Wl,"C:\Python27\libs" "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a" -o "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll" -shared -Wl,--start-group "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\numeric.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\list.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\long.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\dict.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\tuple.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\str.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\slice.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\from_python.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\registry.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\type_id.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\enum.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\class.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\function.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\inheritance.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\life_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\pickle_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\errors.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\module.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\builtin_converters.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\arg_to_python_base.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\stl_iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object_protocol.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object_operators.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\wrapper.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\import.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\exec.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\function_doc_signature.o" -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -mthreads ...failed gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll... ...removing bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a ...skipped libboost_python-mgw46-mt-1_48.dll.a for lack of libboost_python-mgw46-mt-1_48.dll.a... ...skipped libboost_python-mgw46-mt-1_48.dll for lack of libboost_python-mgw46-mt-1_48.dll... gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a Creating library file: bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\debug\module.o: In function `ZN5boost6python6detail11init_moduleEPKcPFvvE': D:\boost_1_48_0\libs\python\example\quickstart/../../../../libs/python/src/module.cpp:59: undefined reference to `_imp__Py_InitModule4 ' collect2: ld returned 1 exit status "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R -Wl,"C:\Python27\libs" "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a" -o "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll" -shared -Wl,--start-group "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\numeric.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\list.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\long.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\dict.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\tuple.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\str.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\slice.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\from_python.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\registry.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\type_id.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\enum.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\class.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\function.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\inheritance.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\life_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\pickle_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\errors.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\module.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\builtin_converters.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\arg_to_python_base.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\stl_iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object_protocol.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object_operators.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\wrapper.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\import.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\exec.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\function_doc_signature.o" -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -g ...failed gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll... ...removing bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a ...skipped libboost_python-mgw46-d-1_48.dll.a for lack of libboost_python-mgw46-d-1_48.dll.a... ...skipped libboost_python-mgw46-d-1_48.dll for lack of libboost_python-mgw46-d-1_48.dll... gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a Creating library file: bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\release\module.o:module.cpp:(.text+0x165): undefined reference to `_imp__Py_InitModule4 ' collect2: ld returned 1 exit status "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R -Wl,"C:\Python27\libs" "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a" -o "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll" -shared -Wl,--start-group "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\numeric.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\list.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\long.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\dict.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\tuple.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\str.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\slice.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\from_python.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\registry.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\type_id.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\enum.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\class.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\function.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\inheritance.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\life_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\pickle_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\errors.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\module.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\builtin_converters.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\arg_to_python_base.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\stl_iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object_protocol.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object_operators.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\wrapper.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\import.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\exec.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\function_doc_signature.o" -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group ...failed gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll... ...removing bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a ...skipped libboost_python-mgw46-1_48.dll.a for lack of libboost_python-mgw46-1_48.dll.a... ...skipped libboost_python-mgw46-1_48.dll for lack of libboost_python-mgw46-1_48.dll... gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a Creating library file: bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\module.o: In function `ZN5boost6python6detail11init_moduleEPKcPFvvE': D:\boost_1_48_0/libs/python/src/module.cpp:59: undefined reference to `_imp__Py_InitModule4 ' collect2: ld returned 1 exit status "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R -Wl,"C:\Python27\libs" "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a" -o "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll" -shared -Wl,--start-group "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\numeric.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\list.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\long.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\dict.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\tuple.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\str.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\slice.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\from_python.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\registry.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\type_id.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\enum.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\class.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\function.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\inheritance.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\life_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\pickle_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\errors.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\module.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\builtin_converters.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\arg_to_python_base.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\stl_iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object_protocol.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object_operators.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\wrapper.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\import.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\exec.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\function_doc_signature.o" -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -g -mthreads ...failed gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll... ...removing bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a ...skipped libboost_python-mgw46-mt-d-1_48.dll.a for lack of libboost_python-mgw46-mt-d-1_48.dll.a... ...skipped libboost_python-mgw46-mt-d-1_48.dll for lack of libboost_python-mgw46-mt-d-1_48.dll... ...failed updating 8 targets... ...skipped 8 targets... _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig at python.org http://mail.python.org/mailman/listinfo/cplusplus-sig From josh.davidson at lmco.com Wed Dec 21 17:58:07 2011 From: josh.davidson at lmco.com (Davidson, Josh) Date: Wed, 21 Dec 2011 16:58:07 +0000 Subject: [C++-sig] EXTERNAL: Building Boost Python problem References: Message-ID: <86299D4CFE2C1248AA41ACF782B0D14310D708CB@HDXDSP11.us.lmco.com> Whoops, just realized you're using Python 2.7, so my def file won't help you. You need to get a x64 def file for your version of Python (there are ways to generate these, google) and run it against dlltool (see notes in previous response) to generate a libpython27.a -----Original Message----- From: Davidson, Josh Sent: Wednesday, December 21, 2011 9:53 AM To: cplusplus-sig at python.org Subject: RE: EXTERNAL: [C++-sig] Building Boost Python problem I'm attaching my notes below. I will point out that while the directions reference 1.48, I've actually had problems with 1.48 and MinGW-W64. Specifically, I'm having problems with bjam building all libraries at once. Building individually appears to work, but I haven't bothered trying to build each one on its own yet. I've inquired on boost-build, but haven't heard anything back. Personally, I would recommend 1.47. If you'd like the def file referenced in the instructions, shoot me a personal email and I'll forward it to you. Keep in mind that you *cannot* use a 32-bit def file if you are using 64-bit Python. I will also forewarn you there are other issues with x64 Python and MinGW-W64 if you plan on building extensions. Take a look here: http://bugs.python.org/issue4709 ---Building Boost for MinGW----- h1. Building Boost Building Boost for MinGw is the opposite of fun. Here are some notes to get you through the misery. h2. x64 Windows *Directories* * C:\TEMP\boost_1_48_0 - Where Boost source code was extracted * c:\mingw64-i686-20110207 - 64-bit MinGw * C:\Python26 - 64-bit Python installation (2.6.6) * C:\TEMP\boost_build - Directory for storing build output *Steps* # Enter C:\TEMP\boost_1_48_0\tools\build\v2\engine # C:\TEMP\boost_1_48_0\tools\build\v2\engine>build.bat mingw --toolset-root=c:\mingw64-i686-20110207 # Copy bin./* to /bin # Change into C:\TEMP\boost_1_48_0 # C:\TEMP\boost_1_48_0>bootstrap.bat mingw --toolset-root=c:\mingw64-i686-20110207 --with-python-root=C:\Python26 # Make a temporary boost build directory, C:\TEMP\boost_build # Work through the following steps to workaround a bug that has been around for years, but seemingly will never get fixed:
1.	Open tools/build/v2/tools/python.jam
2.	There, locate the following code:
if [ version.check-jam-version 3 1 17 ] || ( [ os.name ] != NT ) {
    # Prior to version 3.1.17 Boost Jam's SHELL command did not support
    # quoted commands correctly on Windows. This means that on that
    # platform we do not support using a Python command interpreter
    # executable whose path contains a space character.
    python-cmd = \"$(python-cmd)\" ;
}
3.	Remove that code block completely. 
# Grab attachment:python26.def # Copy c:\windows\System32\python26.dll to the same location as attachment:python26.def # Execute: @dlltool --dllname python26.dll --def python26.def --output-lib libpython26.a@ # Copy libpython26.a to C:\Python26\libs # pre> bjam.exe --toolset=gcc --build-type=complete --build-dir=C:\TEMP\boost_build\build --stagedir=C:\TEMP\boost_build\stage -- address-model=64 define=BOOST_USE_WINDOWS_H threadapi=win32 target-os=windows stage # Copy all files under C:\temp\boost_build\stage\lib to c:\mingw64-i686-20110207\x86_64-w64-mingw32\lib64 # Copy C:\TEMP\boost_1_48_0\boost to c:\mingw64-i686-20110207\x86_64-w64-mingw32\inlcude -----Original Message----- From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On Behalf Of hbd666 Sent: Wednesday, December 21, 2011 2:24 AM To: cplusplus-sig at python.org Subject: EXTERNAL: [C++-sig] Building Boost Python problem Hi I hope someone can help me out... The object is to build boost python (boost-1.4.8, python 2.7 32bit, windows 7 64bit, mingw). I've been trying to fix this for a good 8 hours but can't figure it out. bjam --with-python --build-type=complete --toolset=gcc stage Looking at the resulting output below, I see the problem is probably that bjam can't find python27.lib. I just don't see how that is possible because it finds python.exe in C:\Python27 and indeed python27.lib exists in the C:\Python27\libs directory. Resulting output..... Component configuration: - chrono : not building - date_time : not building - exception : not building - filesystem : not building - graph : not building - graph_parallel : not building - iostreams : not building - locale : not building - math : not building - mpi : not building - program_options : not building - python : building - random : not building - regex : not building - serialization : not building - signals : not building - system : not building - test : not building - thread : not building - timer : not building - wave : not building ...patience... ...patience... ...found 1932 targets... ...updating 16 targets... gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a Creating library file: bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\module.o:module.cpp:(.text+0x165): undefined reference to `_imp__Py_InitModule4 ' collect2: ld returned 1 exit status "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R -Wl,"C:\Python27\libs" "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a" -o "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll" -shared -Wl,--start-group "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\numeric.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\list.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\long.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\dict.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\tuple.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\str.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\slice.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\from_python.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\registry.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\type_id.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\enum.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\class.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\function.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\inheritance.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\life_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\pickle_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\errors.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\module.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\builtin_converters.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\arg_to_python_base.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\stl_iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object_protocol.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object_operators.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\wrapper.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\import.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\exec.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\function_doc_signature.o" -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -mthreads ...failed gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll... ...removing bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a ...skipped libboost_python-mgw46-mt-1_48.dll.a for lack of libboost_python-mgw46-mt-1_48.dll.a... ...skipped libboost_python-mgw46-mt-1_48.dll for lack of libboost_python-mgw46-mt-1_48.dll... gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a Creating library file: bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\debug\module.o: In function `ZN5boost6python6detail11init_moduleEPKcPFvvE': D:\boost_1_48_0\libs\python\example\quickstart/../../../../libs/python/src/module.cpp:59: undefined reference to `_imp__Py_InitModule4 ' collect2: ld returned 1 exit status "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R -Wl,"C:\Python27\libs" "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a" -o "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll" -shared -Wl,--start-group "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\numeric.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\list.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\long.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\dict.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\tuple.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\str.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\slice.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\from_python.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\registry.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\type_id.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\enum.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\class.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\function.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\inheritance.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\life_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\pickle_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\errors.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\module.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\builtin_converters.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\arg_to_python_base.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\stl_iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object_protocol.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object_operators.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\wrapper.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\import.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\exec.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\function_doc_signature.o" -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -g ...failed gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll... ...removing bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a ...skipped libboost_python-mgw46-d-1_48.dll.a for lack of libboost_python-mgw46-d-1_48.dll.a... ...skipped libboost_python-mgw46-d-1_48.dll for lack of libboost_python-mgw46-d-1_48.dll... gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a Creating library file: bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\release\module.o:module.cpp:(.text+0x165): undefined reference to `_imp__Py_InitModule4 ' collect2: ld returned 1 exit status "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R -Wl,"C:\Python27\libs" "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a" -o "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll" -shared -Wl,--start-group "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\numeric.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\list.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\long.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\dict.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\tuple.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\str.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\slice.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\from_python.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\registry.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\type_id.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\enum.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\class.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\function.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\inheritance.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\life_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\pickle_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\errors.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\module.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\builtin_converters.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\arg_to_python_base.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\stl_iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object_protocol.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object_operators.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\wrapper.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\import.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\exec.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\function_doc_signature.o" -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group ...failed gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll... ...removing bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a ...skipped libboost_python-mgw46-1_48.dll.a for lack of libboost_python-mgw46-1_48.dll.a... ...skipped libboost_python-mgw46-1_48.dll for lack of libboost_python-mgw46-1_48.dll... gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a Creating library file: bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\module.o: In function `ZN5boost6python6detail11init_moduleEPKcPFvvE': D:\boost_1_48_0/libs/python/src/module.cpp:59: undefined reference to `_imp__Py_InitModule4 ' collect2: ld returned 1 exit status "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R -Wl,"C:\Python27\libs" "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a" -o "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll" -shared -Wl,--start-group "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\numeric.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\list.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\long.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\dict.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\tuple.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\str.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\slice.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\from_python.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\registry.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\type_id.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\enum.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\class.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\function.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\inheritance.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\life_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\pickle_support.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\errors.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\module.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\builtin_converters.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\arg_to_python_base.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\stl_iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object_protocol.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object_operators.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\wrapper.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\import.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\exec.o" "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\function_doc_signature.o" -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -g -mthreads ...failed gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll... ...removing bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a ...skipped libboost_python-mgw46-mt-d-1_48.dll.a for lack of libboost_python-mgw46-mt-d-1_48.dll.a... ...skipped libboost_python-mgw46-mt-d-1_48.dll for lack of libboost_python-mgw46-mt-d-1_48.dll... ...failed updating 8 targets... ...skipped 8 targets... _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig at python.org http://mail.python.org/mailman/listinfo/cplusplus-sig From happybrowndog at hotmail.com Wed Dec 21 18:53:04 2011 From: happybrowndog at hotmail.com (hbd666) Date: Wed, 21 Dec 2011 09:53:04 -0800 Subject: [C++-sig] EXTERNAL: Building Boost Python problem References: <86299D4CFE2C1248AA41ACF782B0D14310D708CB@HDXDSP11.us.lmco.com> Message-ID: Thanks so much for the help. In my original post, I did say I am using 32 bit python ver 2.7. Shall I still get a x64 def file? Is this because I am on Windows 7 64 bit? I just wanted to be clear. By the way, where does the def file go and how is it referenced? On Wed, 21 Dec 2011 08:58:07 -0800, Davidson, Josh wrote: > Whoops, just realized you're using Python 2.7, so my def file won't help > you. You need to get a x64 def file for your version of Python (there > are ways to generate these, google) and run it against dlltool (see > notes in previous response) to generate a libpython27.a > > -----Original Message----- > From: Davidson, Josh > Sent: Wednesday, December 21, 2011 9:53 AM > To: cplusplus-sig at python.org > Subject: RE: EXTERNAL: [C++-sig] Building Boost Python problem > > I'm attaching my notes below. I will point out that while the > directions reference 1.48, I've actually had problems with 1.48 and > MinGW-W64. Specifically, I'm having problems with bjam building all > libraries at once. Building individually appears to work, but I haven't > bothered trying to build each one on its own yet. I've inquired on > boost-build, but haven't heard anything back. Personally, I would > recommend 1.47. If you'd like the def file referenced in the > instructions, shoot me a personal email and I'll forward it to you. > Keep in mind that you *cannot* use a 32-bit def file if you are using > 64-bit Python. I will also forewarn you there are other issues with x64 > Python and MinGW-W64 if you plan on building extensions. Take a look > here: http://bugs.python.org/issue4709 > > > ---Building Boost for MinGW----- > > h1. Building Boost > > Building Boost for MinGw is the opposite of fun. Here are some notes to > get you through the misery. > > > h2. x64 Windows > > *Directories* > * C:\TEMP\boost_1_48_0 - Where Boost source code was extracted > * c:\mingw64-i686-20110207 - 64-bit MinGw > * C:\Python26 - 64-bit Python installation (2.6.6) > * C:\TEMP\boost_build - Directory for storing build output > > *Steps* > # Enter C:\TEMP\boost_1_48_0\tools\build\v2\engine > # C:\TEMP\boost_1_48_0\tools\build\v2\engine>build.bat mingw > --toolset-root=c:\mingw64-i686-20110207 > # Copy bin./* to /bin > # Change into C:\TEMP\boost_1_48_0 > # C:\TEMP\boost_1_48_0>bootstrap.bat mingw > --toolset-root=c:\mingw64-i686-20110207 --with-python-root=C:\Python26 # > Make a temporary boost build directory, C:\TEMP\boost_build # Work > through the following steps to workaround a bug that has been around for > years, but seemingly will never get fixed: >
1.	Open tools/build/v2/tools/python.jam
> 2.	There, locate the following code:
> if [ version.check-jam-version 3 1 17 ] || ( [ os.name ] != NT ) {
>     # Prior to version 3.1.17 Boost Jam's SHELL command did not support
>     # quoted commands correctly on Windows. This means that on that
>     # platform we do not support using a Python command interpreter
>     # executable whose path contains a space character.
>     python-cmd = \"$(python-cmd)\" ;
> }
> 3.	Remove that code block completely. 
> # Grab attachment:python26.def > # Copy c:\windows\System32\python26.dll to the same location as > attachment:python26.def # Execute: @dlltool --dllname python26.dll --def > python26.def --output-lib libpython26.a@ # Copy libpython26.a to > C:\Python26\libs # pre> bjam.exe --toolset=gcc --build-type=complete > --build-dir=C:\TEMP\boost_build\build > --stagedir=C:\TEMP\boost_build\stage -- address-model=64 > define=BOOST_USE_WINDOWS_H threadapi=win32 target-os=windows stage > # Copy all files under C:\temp\boost_build\stage\lib to > c:\mingw64-i686-20110207\x86_64-w64-mingw32\lib64 > # Copy C:\TEMP\boost_1_48_0\boost to > c:\mingw64-i686-20110207\x86_64-w64-mingw32\inlcude > > -----Original Message----- > From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org > [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On > Behalf Of hbd666 > Sent: Wednesday, December 21, 2011 2:24 AM > To: cplusplus-sig at python.org > Subject: EXTERNAL: [C++-sig] Building Boost Python problem > > Hi I hope someone can help me out... > The object is to build boost python (boost-1.4.8, python 2.7 32bit, > windows 7 64bit, mingw). > I've been trying to fix this for a good 8 hours but can't figure it out. > > bjam --with-python --build-type=complete --toolset=gcc stage > > Looking at the resulting output below, I see the problem is probably > that bjam can't find python27.lib. I just don't see how that is > possible because it finds python.exe in C:\Python27 and indeed > python27.lib exists in the C:\Python27\libs directory. > > Resulting output..... > > Component configuration: > > - chrono : not building > - date_time : not building > - exception : not building > - filesystem : not building > - graph : not building > - graph_parallel : not building > - iostreams : not building > - locale : not building > - math : not building > - mpi : not building > - program_options : not building > - python : building > - random : not building > - regex : not building > - serialization : not building > - signals : not building > - system : not building > - test : not building > - thread : not building > - timer : not building > - wave : not building > > ...patience... > ...patience... > ...found 1932 targets... > ...updating 16 targets... > gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a > Creating library file: > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\module.o:module.cpp:(.text+0x165): > undefined reference to `_imp__Py_InitModule4 ' > collect2: ld returned 1 exit status > > "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R > -Wl,"C:\Python27\libs" > "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a" > -o > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll" > -shared -Wl,--start-group > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\numeric.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\list.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\long.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\dict.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\tuple.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\str.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\slice.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\from_python.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\registry.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\type_id.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\enum.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\class.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\function.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\inheritance.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\life_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\pickle_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\errors.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\module.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\builtin_converters.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\arg_to_python_base.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\stl_iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object_protocol.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object_operators.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\wrapper.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\import.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\exec.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\function_doc_signature.o" > -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -mthreads > > ...failed gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll... > ...removing > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a > ...skipped libboost_python-mgw46-mt-1_48.dll.a for lack of > libboost_python-mgw46-mt-1_48.dll.a... > ...skipped libboost_python-mgw46-mt-1_48.dll for lack of > libboost_python-mgw46-mt-1_48.dll... > gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a > Creating library file: > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\debug\module.o: > In function `ZN5boost6python6detail11init_moduleEPKcPFvvE': > D:\boost_1_48_0\libs\python\example\quickstart/../../../../libs/python/src/module.cpp:59: > undefined reference to `_imp__Py_InitModule4 ' > collect2: ld returned 1 exit status > > "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R > -Wl,"C:\Python27\libs" > "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a" > -o > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll" > -shared -Wl,--start-group > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\numeric.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\list.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\long.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\dict.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\tuple.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\str.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\slice.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\from_python.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\registry.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\type_id.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\enum.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\class.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\function.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\inheritance.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\life_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\pickle_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\errors.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\module.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\builtin_converters.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\arg_to_python_base.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\stl_iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object_protocol.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object_operators.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\wrapper.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\import.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\exec.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\function_doc_signature.o" > -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -g > > ...failed gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll... > ...removing > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a > ...skipped libboost_python-mgw46-d-1_48.dll.a for lack of > libboost_python-mgw46-d-1_48.dll.a... > ...skipped libboost_python-mgw46-d-1_48.dll for lack of > libboost_python-mgw46-d-1_48.dll... > gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a > Creating library file: > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\release\module.o:module.cpp:(.text+0x165): > undefined reference to `_imp__Py_InitModule4 ' > collect2: ld returned 1 exit status > > "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R > -Wl,"C:\Python27\libs" > "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a" > -o > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll" > -shared -Wl,--start-group > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\numeric.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\list.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\long.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\dict.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\tuple.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\str.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\slice.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\from_python.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\registry.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\type_id.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\enum.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\class.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\function.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\inheritance.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\life_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\pickle_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\errors.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\module.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\builtin_converters.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\arg_to_python_base.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\stl_iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object_protocol.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object_operators.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\wrapper.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\import.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\exec.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\function_doc_signature.o" > -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group > > ...failed gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll... > ...removing > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a > ...skipped libboost_python-mgw46-1_48.dll.a for lack of > libboost_python-mgw46-1_48.dll.a... > ...skipped libboost_python-mgw46-1_48.dll for lack of > libboost_python-mgw46-1_48.dll... > gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a > Creating library file: > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\module.o: > In function `ZN5boost6python6detail11init_moduleEPKcPFvvE': > D:\boost_1_48_0/libs/python/src/module.cpp:59: undefined reference to > `_imp__Py_InitModule4 > ' > collect2: ld returned 1 exit status > > "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R > -Wl,"C:\Python27\libs" > "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a" > -o > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll" > -shared -Wl,--start-group > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\numeric.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\list.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\long.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\dict.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\tuple.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\str.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\slice.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\from_python.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\registry.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\type_id.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\enum.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\class.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\function.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\inheritance.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\life_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\pickle_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\errors.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\module.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\builtin_converters.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\arg_to_python_base.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\stl_iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object_protocol.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object_operators.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\wrapper.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\import.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\exec.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\function_doc_signature.o" > -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -g -mthreads > > ...failed gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll... > ...removing > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a > ...skipped libboost_python-mgw46-mt-d-1_48.dll.a for lack of > libboost_python-mgw46-mt-d-1_48.dll.a... > ...skipped libboost_python-mgw46-mt-d-1_48.dll for lack of > libboost_python-mgw46-mt-d-1_48.dll... > ...failed updating 8 targets... > ...skipped 8 targets... > > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig at python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig -- Using Opera's revolutionary email client: http://www.opera.com/mail/ From josh.davidson at lmco.com Wed Dec 21 19:34:14 2011 From: josh.davidson at lmco.com (Davidson, Josh) Date: Wed, 21 Dec 2011 18:34:14 +0000 Subject: [C++-sig] EXTERNAL: Building Boost Python problem In-Reply-To: References: <86299D4CFE2C1248AA41ACF782B0D14310D708CB@HDXDSP11.us.lmco.com> Message-ID: <86299D4CFE2C1248AA41ACF782B0D14310D70962@HDXDSP11.us.lmco.com> Looks like I had sudden onset of dyslexia while scanning your build output, read mgw46 as mgw64, and thought you were using 64-bit MinGW and therefore 64-bit Python. The def file exposes all of the exports for the Python dll, so you can create an import library that MinGW can interpret. You can grab a 32-bit def file for Pyton 2.7 here: http://wiki.cython.org/InstallingOnWindows (please note that the def files listed are 32-bit only even though there is no mention of that). Follow the instructions on their page for how to create the import library using dlltool (replacing their references to Python 2.4 and Python 2.5 with Python 2.7). -----Original Message----- From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On Behalf Of hbd666 Sent: Wednesday, December 21, 2011 10:53 AM To: cplusplus-sig at python.org Subject: Re: [C++-sig] EXTERNAL: Building Boost Python problem Thanks so much for the help. In my original post, I did say I am using 32 bit python ver 2.7. Shall I still get a x64 def file? Is this because I am on Windows 7 64 bit? I just wanted to be clear. By the way, where does the def file go and how is it referenced? On Wed, 21 Dec 2011 08:58:07 -0800, Davidson, Josh wrote: > Whoops, just realized you're using Python 2.7, so my def file won't > help you. You need to get a x64 def file for your version of Python > (there are ways to generate these, google) and run it against dlltool > (see notes in previous response) to generate a libpython27.a > > -----Original Message----- > From: Davidson, Josh > Sent: Wednesday, December 21, 2011 9:53 AM > To: cplusplus-sig at python.org > Subject: RE: EXTERNAL: [C++-sig] Building Boost Python problem > > I'm attaching my notes below. I will point out that while the > directions reference 1.48, I've actually had problems with 1.48 and > MinGW-W64. Specifically, I'm having problems with bjam building all > libraries at once. Building individually appears to work, but I haven't > bothered trying to build each one on its own yet. I've inquired on > boost-build, but haven't heard anything back. Personally, I would > recommend 1.47. If you'd like the def file referenced in the > instructions, shoot me a personal email and I'll forward it to you. > Keep in mind that you *cannot* use a 32-bit def file if you are using > 64-bit Python. I will also forewarn you there are other issues with > x64 Python and MinGW-W64 if you plan on building extensions. Take a > look > here: http://bugs.python.org/issue4709 > > > ---Building Boost for MinGW----- > > h1. Building Boost > > Building Boost for MinGw is the opposite of fun. Here are some notes > to get you through the misery. > > > h2. x64 Windows > > *Directories* > * C:\TEMP\boost_1_48_0 - Where Boost source code was extracted > * c:\mingw64-i686-20110207 - 64-bit MinGw > * C:\Python26 - 64-bit Python installation (2.6.6) > * C:\TEMP\boost_build - Directory for storing build output > > *Steps* > # Enter C:\TEMP\boost_1_48_0\tools\build\v2\engine > # C:\TEMP\boost_1_48_0\tools\build\v2\engine>build.bat mingw > --toolset-root=c:\mingw64-i686-20110207 > # Copy bin./* to /bin # Change into > C:\TEMP\boost_1_48_0 # C:\TEMP\boost_1_48_0>bootstrap.bat mingw > --toolset-root=c:\mingw64-i686-20110207 --with-python-root=C:\Python26 > # Make a temporary boost build directory, C:\TEMP\boost_build # Work > through the following steps to workaround a bug that has been around > for years, but seemingly will never get fixed: >
1.	Open tools/build/v2/tools/python.jam
> 2.	There, locate the following code:
> if [ version.check-jam-version 3 1 17 ] || ( [ os.name ] != NT ) {
>     # Prior to version 3.1.17 Boost Jam's SHELL command did not support
>     # quoted commands correctly on Windows. This means that on that
>     # platform we do not support using a Python command interpreter
>     # executable whose path contains a space character.
>     python-cmd = \"$(python-cmd)\" ;
> }
> 3.	Remove that code block completely. 
> # Grab attachment:python26.def > # Copy c:\windows\System32\python26.dll to the same location as > attachment:python26.def # Execute: @dlltool --dllname python26.dll > --def python26.def --output-lib libpython26.a@ # Copy libpython26.a to > C:\Python26\libs # pre> bjam.exe --toolset=gcc --build-type=complete > --build-dir=C:\TEMP\boost_build\build > --stagedir=C:\TEMP\boost_build\stage -- address-model=64 > define=BOOST_USE_WINDOWS_H threadapi=win32 target-os=windows stage > # Copy all files under C:\temp\boost_build\stage\lib to > c:\mingw64-i686-20110207\x86_64-w64-mingw32\lib64 > # Copy C:\TEMP\boost_1_48_0\boost to > c:\mingw64-i686-20110207\x86_64-w64-mingw32\inlcude > > -----Original Message----- > From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org > [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On > Behalf Of hbd666 > Sent: Wednesday, December 21, 2011 2:24 AM > To: cplusplus-sig at python.org > Subject: EXTERNAL: [C++-sig] Building Boost Python problem > > Hi I hope someone can help me out... > The object is to build boost python (boost-1.4.8, python 2.7 32bit, > windows 7 64bit, mingw). > I've been trying to fix this for a good 8 hours but can't figure it out. > > bjam --with-python --build-type=complete --toolset=gcc stage > > Looking at the resulting output below, I see the problem is probably > that bjam can't find python27.lib. I just don't see how that is > possible because it finds python.exe in C:\Python27 and indeed > python27.lib exists in the C:\Python27\libs directory. > > Resulting output..... > > Component configuration: > > - chrono : not building > - date_time : not building > - exception : not building > - filesystem : not building > - graph : not building > - graph_parallel : not building > - iostreams : not building > - locale : not building > - math : not building > - mpi : not building > - program_options : not building > - python : building > - random : not building > - regex : not building > - serialization : not building > - signals : not building > - system : not building > - test : not building > - thread : not building > - timer : not building > - wave : not building > > ...patience... > ...patience... > ...found 1932 targets... > ...updating 16 targets... > gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libbo > ost_python-mgw46-mt-1_48.dll.a > Creating library file: > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\module.o:module.cpp:(.text+0x165): > undefined reference to `_imp__Py_InitModule4 ' > collect2: ld returned 1 exit status > > "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R > -Wl,"C:\Python27\libs" > "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a" > -o > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll" > -shared -Wl,--start-group > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\numeric.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\list.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\long.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\dict.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\tuple.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\str.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\slice.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\from_python.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\registry.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\type_id.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\enum.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\class.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\function.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\inheritance.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\life_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\pickle_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\errors.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\module.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\builtin_converters.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\arg_to_python_base.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\stl_iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object_protocol.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object_operators.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\wrapper.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\import.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\exec.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\function_doc_signature.o" > -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -mthreads > > ...failed gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libbo > ost_python-mgw46-mt-1_48.dll.a > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll... > ...removing > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libbo > ost_python-mgw46-mt-1_48.dll.a ...skipped > libboost_python-mgw46-mt-1_48.dll.a for lack of > libboost_python-mgw46-mt-1_48.dll.a... > ...skipped libboost_python-mgw46-mt-1_48.dll for lack of > libboost_python-mgw46-mt-1_48.dll... > gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d > -1_48.dll.a > Creating library file: > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\debug\module.o: > In function `ZN5boost6python6detail11init_moduleEPKcPFvvE': > D:\boost_1_48_0\libs\python\example\quickstart/../../../../libs/python/src/module.cpp:59: > undefined reference to `_imp__Py_InitModule4 ' > collect2: ld returned 1 exit status > > "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R > -Wl,"C:\Python27\libs" > "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a" > -o > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll" > -shared -Wl,--start-group > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\numeric.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\list.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\long.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\dict.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\tuple.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\str.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\slice.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\from_python.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\registry.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\type_id.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\enum.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\class.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\function.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\inheritance.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\life_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\pickle_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\errors.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\module.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\builtin_converters.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\arg_to_python_base.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\stl_iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object_protocol.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object_operators.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\wrapper.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\import.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\exec.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\function_doc_signature.o" > -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -g > > ...failed gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d > -1_48.dll.a > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll... > ...removing > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d > -1_48.dll.a ...skipped libboost_python-mgw46-d-1_48.dll.a > for lack of > libboost_python-mgw46-d-1_48.dll.a... > ...skipped libboost_python-mgw46-d-1_48.dll for lack of > libboost_python-mgw46-d-1_48.dll... > gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46 > -1_48.dll.a > Creating library file: > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\release\module.o:module.cpp:(.text+0x165): > undefined reference to `_imp__Py_InitModule4 ' > collect2: ld returned 1 exit status > > "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R > -Wl,"C:\Python27\libs" > "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a" > -o > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll" > -shared -Wl,--start-group > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\numeric.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\list.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\long.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\dict.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\tuple.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\str.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\slice.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\from_python.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\registry.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\type_id.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\enum.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\class.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\function.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\inheritance.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\life_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\pickle_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\errors.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\module.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\builtin_converters.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\arg_to_python_base.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\stl_iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object_protocol.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object_operators.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\wrapper.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\import.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\exec.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\function_doc_signature.o" > -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group > > ...failed gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46 > -1_48.dll.a > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll... > ...removing > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46 > -1_48.dll.a ...skipped libboost_python-mgw46-1_48.dll.a > for lack of > libboost_python-mgw46-1_48.dll.a... > ...skipped libboost_python-mgw46-1_48.dll for lack of > libboost_python-mgw46-1_48.dll... > gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboos > t_python-mgw46-mt-d-1_48.dll.a > Creating library file: > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\module.o: > In function `ZN5boost6python6detail11init_moduleEPKcPFvvE': > D:\boost_1_48_0/libs/python/src/module.cpp:59: undefined reference to > `_imp__Py_InitModule4 > ' > collect2: ld returned 1 exit status > > "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R > -Wl,"C:\Python27\libs" > "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a" > -o > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll" > -shared -Wl,--start-group > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\numeric.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\list.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\long.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\dict.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\tuple.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\str.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\slice.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\from_python.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\registry.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\type_id.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\enum.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\class.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\function.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\inheritance.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\life_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\pickle_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\errors.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\module.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\builtin_converters.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\arg_to_python_base.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\stl_iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object_protocol.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object_operators.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\wrapper.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\import.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\exec.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\function_doc_signature.o" > -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -g -mthreads > > ...failed gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboos > t_python-mgw46-mt-d-1_48.dll.a > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll... > ...removing > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboos > t_python-mgw46-mt-d-1_48.dll.a ...skipped > libboost_python-mgw46-mt-d-1_48.dll.a for lack of > libboost_python-mgw46-mt-d-1_48.dll.a... > ...skipped libboost_python-mgw46-mt-d-1_48.dll for lack of > libboost_python-mgw46-mt-d-1_48.dll... > ...failed updating 8 targets... > ...skipped 8 targets... > > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig at python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig -- Using Opera's revolutionary email client: http://www.opera.com/mail/ _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig at python.org http://mail.python.org/mailman/listinfo/cplusplus-sig From josh.davidson at lmco.com Wed Dec 21 19:47:15 2011 From: josh.davidson at lmco.com (Davidson, Josh) Date: Wed, 21 Dec 2011 18:47:15 +0000 Subject: [C++-sig] EXTERNAL: Building Boost Python problem References: <86299D4CFE2C1248AA41ACF782B0D14310D708CB@HDXDSP11.us.lmco.com> Message-ID: <86299D4CFE2C1248AA41ACF782B0D14310D7097E@HDXDSP11.us.lmco.com> One other thing that jumps out at me from your build output is the undefined symbol is Py_InitModule4. That's a special guard symbol they add to their 32-bit libraries. 64-bit versions have Py_InitModule4_64. This is to prevent you from linking a 32 bit modules with 64-bit Python and vice-versa. I would have expected to see a bunch more undefined symbols. If generating the mport library doesn't work, make sure you add --address-model=32 when invoking bjam.exe and can you post the output from gcc -v. -----Original Message----- From: Davidson, Josh Sent: Wednesday, December 21, 2011 11:34 AM To: cplusplus-sig at python.org Subject: RE: [C++-sig] EXTERNAL: Building Boost Python problem Looks like I had sudden onset of dyslexia while scanning your build output, read mgw46 as mgw64, and thought you were using 64-bit MinGW and therefore 64-bit Python. The def file exposes all of the exports for the Python dll, so you can create an import library that MinGW can interpret. You can grab a 32-bit def file for Pyton 2.7 here: http://wiki.cython.org/InstallingOnWindows (please note that the def files listed are 32-bit only even though there is no mention of that). Follow the instructions on their page for how to create the import library using dlltool (replacing their references to Python 2.4 and Python 2.5 with Python 2.7). -----Original Message----- From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On Behalf Of hbd666 Sent: Wednesday, December 21, 2011 10:53 AM To: cplusplus-sig at python.org Subject: Re: [C++-sig] EXTERNAL: Building Boost Python problem Thanks so much for the help. In my original post, I did say I am using 32 bit python ver 2.7. Shall I still get a x64 def file? Is this because I am on Windows 7 64 bit? I just wanted to be clear. By the way, where does the def file go and how is it referenced? On Wed, 21 Dec 2011 08:58:07 -0800, Davidson, Josh wrote: > Whoops, just realized you're using Python 2.7, so my def file won't > help you. You need to get a x64 def file for your version of Python > (there are ways to generate these, google) and run it against dlltool > (see notes in previous response) to generate a libpython27.a > > -----Original Message----- > From: Davidson, Josh > Sent: Wednesday, December 21, 2011 9:53 AM > To: cplusplus-sig at python.org > Subject: RE: EXTERNAL: [C++-sig] Building Boost Python problem > > I'm attaching my notes below. I will point out that while the > directions reference 1.48, I've actually had problems with 1.48 and > MinGW-W64. Specifically, I'm having problems with bjam building all > libraries at once. Building individually appears to work, but I haven't > bothered trying to build each one on its own yet. I've inquired on > boost-build, but haven't heard anything back. Personally, I would > recommend 1.47. If you'd like the def file referenced in the > instructions, shoot me a personal email and I'll forward it to you. > Keep in mind that you *cannot* use a 32-bit def file if you are using > 64-bit Python. I will also forewarn you there are other issues with > x64 Python and MinGW-W64 if you plan on building extensions. Take a > look > here: http://bugs.python.org/issue4709 > > > ---Building Boost for MinGW----- > > h1. Building Boost > > Building Boost for MinGw is the opposite of fun. Here are some notes > to get you through the misery. > > > h2. x64 Windows > > *Directories* > * C:\TEMP\boost_1_48_0 - Where Boost source code was extracted > * c:\mingw64-i686-20110207 - 64-bit MinGw > * C:\Python26 - 64-bit Python installation (2.6.6) > * C:\TEMP\boost_build - Directory for storing build output > > *Steps* > # Enter C:\TEMP\boost_1_48_0\tools\build\v2\engine > # C:\TEMP\boost_1_48_0\tools\build\v2\engine>build.bat mingw > --toolset-root=c:\mingw64-i686-20110207 > # Copy bin./* to /bin # Change into > C:\TEMP\boost_1_48_0 # C:\TEMP\boost_1_48_0>bootstrap.bat mingw > --toolset-root=c:\mingw64-i686-20110207 --with-python-root=C:\Python26 > # Make a temporary boost build directory, C:\TEMP\boost_build # Work > through the following steps to workaround a bug that has been around > for years, but seemingly will never get fixed: >
1.	Open tools/build/v2/tools/python.jam
> 2.	There, locate the following code:
> if [ version.check-jam-version 3 1 17 ] || ( [ os.name ] != NT ) {
>     # Prior to version 3.1.17 Boost Jam's SHELL command did not support
>     # quoted commands correctly on Windows. This means that on that
>     # platform we do not support using a Python command interpreter
>     # executable whose path contains a space character.
>     python-cmd = \"$(python-cmd)\" ;
> }
> 3.	Remove that code block completely. 
> # Grab attachment:python26.def > # Copy c:\windows\System32\python26.dll to the same location as > attachment:python26.def # Execute: @dlltool --dllname python26.dll > --def python26.def --output-lib libpython26.a@ # Copy libpython26.a to > C:\Python26\libs # pre> bjam.exe --toolset=gcc --build-type=complete > --build-dir=C:\TEMP\boost_build\build > --stagedir=C:\TEMP\boost_build\stage -- address-model=64 > define=BOOST_USE_WINDOWS_H threadapi=win32 target-os=windows stage > # Copy all files under C:\temp\boost_build\stage\lib to > c:\mingw64-i686-20110207\x86_64-w64-mingw32\lib64 > # Copy C:\TEMP\boost_1_48_0\boost to > c:\mingw64-i686-20110207\x86_64-w64-mingw32\inlcude > > -----Original Message----- > From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org > [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On > Behalf Of hbd666 > Sent: Wednesday, December 21, 2011 2:24 AM > To: cplusplus-sig at python.org > Subject: EXTERNAL: [C++-sig] Building Boost Python problem > > Hi I hope someone can help me out... > The object is to build boost python (boost-1.4.8, python 2.7 32bit, > windows 7 64bit, mingw). > I've been trying to fix this for a good 8 hours but can't figure it out. > > bjam --with-python --build-type=complete --toolset=gcc stage > > Looking at the resulting output below, I see the problem is probably > that bjam can't find python27.lib. I just don't see how that is > possible because it finds python.exe in C:\Python27 and indeed > python27.lib exists in the C:\Python27\libs directory. > > Resulting output..... > > Component configuration: > > - chrono : not building > - date_time : not building > - exception : not building > - filesystem : not building > - graph : not building > - graph_parallel : not building > - iostreams : not building > - locale : not building > - math : not building > - mpi : not building > - program_options : not building > - python : building > - random : not building > - regex : not building > - serialization : not building > - signals : not building > - system : not building > - test : not building > - thread : not building > - timer : not building > - wave : not building > > ...patience... > ...patience... > ...found 1932 targets... > ...updating 16 targets... > gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libbo > ost_python-mgw46-mt-1_48.dll.a > Creating library file: > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\module.o:module.cpp:(.text+0x165): > undefined reference to `_imp__Py_InitModule4 ' > collect2: ld returned 1 exit status > > "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R > -Wl,"C:\Python27\libs" > "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a" > -o > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll" > -shared -Wl,--start-group > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\numeric.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\list.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\long.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\dict.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\tuple.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\str.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\slice.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\from_python.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\registry.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\type_id.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\enum.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\class.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\function.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\inheritance.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\life_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\pickle_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\errors.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\module.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\builtin_converters.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\arg_to_python_base.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\stl_iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object_protocol.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object_operators.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\wrapper.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\import.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\exec.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\function_doc_signature.o" > -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -mthreads > > ...failed gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libbo > ost_python-mgw46-mt-1_48.dll.a > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll... > ...removing > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libbo > ost_python-mgw46-mt-1_48.dll.a ...skipped > libboost_python-mgw46-mt-1_48.dll.a for lack of > libboost_python-mgw46-mt-1_48.dll.a... > ...skipped libboost_python-mgw46-mt-1_48.dll for lack of > libboost_python-mgw46-mt-1_48.dll... > gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d > -1_48.dll.a > Creating library file: > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\debug\module.o: > In function `ZN5boost6python6detail11init_moduleEPKcPFvvE': > D:\boost_1_48_0\libs\python\example\quickstart/../../../../libs/python/src/module.cpp:59: > undefined reference to `_imp__Py_InitModule4 ' > collect2: ld returned 1 exit status > > "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R > -Wl,"C:\Python27\libs" > "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a" > -o > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll" > -shared -Wl,--start-group > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\numeric.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\list.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\long.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\dict.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\tuple.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\str.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\slice.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\from_python.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\registry.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\type_id.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\enum.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\class.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\function.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\inheritance.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\life_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\pickle_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\errors.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\module.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\builtin_converters.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\arg_to_python_base.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\stl_iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object_protocol.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object_operators.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\wrapper.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\import.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\exec.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\function_doc_signature.o" > -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -g > > ...failed gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d > -1_48.dll.a > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll... > ...removing > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d > -1_48.dll.a ...skipped libboost_python-mgw46-d-1_48.dll.a > for lack of > libboost_python-mgw46-d-1_48.dll.a... > ...skipped libboost_python-mgw46-d-1_48.dll for lack of > libboost_python-mgw46-d-1_48.dll... > gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46 > -1_48.dll.a > Creating library file: > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\release\module.o:module.cpp:(.text+0x165): > undefined reference to `_imp__Py_InitModule4 ' > collect2: ld returned 1 exit status > > "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R > -Wl,"C:\Python27\libs" > "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a" > -o > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll" > -shared -Wl,--start-group > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\numeric.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\list.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\long.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\dict.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\tuple.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\str.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\slice.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\from_python.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\registry.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\type_id.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\enum.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\class.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\function.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\inheritance.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\life_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\pickle_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\errors.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\module.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\builtin_converters.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\arg_to_python_base.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\stl_iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object_protocol.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object_operators.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\wrapper.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\import.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\exec.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\function_doc_signature.o" > -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group > > ...failed gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46 > -1_48.dll.a > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll... > ...removing > bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46 > -1_48.dll.a ...skipped libboost_python-mgw46-1_48.dll.a > for lack of > libboost_python-mgw46-1_48.dll.a... > ...skipped libboost_python-mgw46-1_48.dll for lack of > libboost_python-mgw46-1_48.dll... > gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboos > t_python-mgw46-mt-d-1_48.dll.a > Creating library file: > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\module.o: > In function `ZN5boost6python6detail11init_moduleEPKcPFvvE': > D:\boost_1_48_0/libs/python/src/module.cpp:59: undefined reference to > `_imp__Py_InitModule4 > ' > collect2: ld returned 1 exit status > > "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R > -Wl,"C:\Python27\libs" > "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a" > -o > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll" > -shared -Wl,--start-group > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\numeric.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\list.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\long.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\dict.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\tuple.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\str.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\slice.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\from_python.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\registry.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\type_id.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\enum.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\class.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\function.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\inheritance.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\life_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\pickle_support.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\errors.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\module.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\builtin_converters.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\arg_to_python_base.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\stl_iterator.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object_protocol.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object_operators.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\wrapper.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\import.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\exec.o" > "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\function_doc_signature.o" > -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -g -mthreads > > ...failed gcc.link.dll > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboos > t_python-mgw46-mt-d-1_48.dll.a > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll... > ...removing > bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboos > t_python-mgw46-mt-d-1_48.dll.a ...skipped > libboost_python-mgw46-mt-d-1_48.dll.a for lack of > libboost_python-mgw46-mt-d-1_48.dll.a... > ...skipped libboost_python-mgw46-mt-d-1_48.dll for lack of > libboost_python-mgw46-mt-d-1_48.dll... > ...failed updating 8 targets... > ...skipped 8 targets... > > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig at python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig -- Using Opera's revolutionary email client: http://www.opera.com/mail/ _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig at python.org http://mail.python.org/mailman/listinfo/cplusplus-sig From happybrowndog at hotmail.com Wed Dec 21 20:37:24 2011 From: happybrowndog at hotmail.com (hbd666) Date: Wed, 21 Dec 2011 11:37:24 -0800 Subject: [C++-sig] EXTERNAL: Building Boost Python problem References: <86299D4CFE2C1248AA41ACF782B0D14310D708CB@HDXDSP11.us.lmco.com> <86299D4CFE2C1248AA41ACF782B0D14310D70962@HDXDSP11.us.lmco.com> Message-ID: Josh, Thank you so much. I got the def file and now I have success: I was able to build Boost-python in both static and dynamic libraries! I had generated a def file before with pexports and had a libpython27.a in c:\python27\libs but for whatever reason I still got those undefined symbol errors. So I downloaded the def file from that site and reran the dlltool, then did the build and it worked. I also did the python boost quickstart build and that also worked. You just gave me an early Christmas present... thanks so much and Merry Christmas to you! On Wed, 21 Dec 2011 10:34:14 -0800, Davidson, Josh wrote: > Looks like I had sudden onset of dyslexia while scanning your build > output, read mgw46 as mgw64, and thought you were using 64-bit MinGW and > therefore 64-bit Python. The def file exposes all of the exports for > the Python dll, so you can create an import library that MinGW can > interpret. You can grab a 32-bit def file for Pyton 2.7 here: > http://wiki.cython.org/InstallingOnWindows (please note that the def > files listed are 32-bit only even though there is no mention of that). > Follow the instructions on their page for how to create the import > library using dlltool (replacing their references to Python 2.4 and > Python 2.5 with Python 2.7). > > > > -----Original Message----- > From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org > [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On > Behalf Of hbd666 > Sent: Wednesday, December 21, 2011 10:53 AM > To: cplusplus-sig at python.org > Subject: Re: [C++-sig] EXTERNAL: Building Boost Python problem > > Thanks so much for the help. In my original post, I did say I am using > 32 bit python ver 2.7. > Shall I still get a x64 def file? Is this because I am on Windows 7 64 > bit? I just wanted to be clear. > By the way, where does the def file go and how is it referenced? > > On Wed, 21 Dec 2011 08:58:07 -0800, Davidson, Josh > wrote: > >> Whoops, just realized you're using Python 2.7, so my def file won't >> help you. You need to get a x64 def file for your version of Python >> (there are ways to generate these, google) and run it against dlltool >> (see notes in previous response) to generate a libpython27.a >> >> -----Original Message----- >> From: Davidson, Josh >> Sent: Wednesday, December 21, 2011 9:53 AM >> To: cplusplus-sig at python.org >> Subject: RE: EXTERNAL: [C++-sig] Building Boost Python problem >> >> I'm attaching my notes below. I will point out that while the >> directions reference 1.48, I've actually had problems with 1.48 and >> MinGW-W64. Specifically, I'm having problems with bjam building all >> libraries at once. Building individually appears to work, but I haven't >> bothered trying to build each one on its own yet. I've inquired on >> boost-build, but haven't heard anything back. Personally, I would >> recommend 1.47. If you'd like the def file referenced in the >> instructions, shoot me a personal email and I'll forward it to you. >> Keep in mind that you *cannot* use a 32-bit def file if you are using >> 64-bit Python. I will also forewarn you there are other issues with >> x64 Python and MinGW-W64 if you plan on building extensions. Take a >> look >> here: http://bugs.python.org/issue4709 >> >> >> ---Building Boost for MinGW----- >> >> h1. Building Boost >> >> Building Boost for MinGw is the opposite of fun. Here are some notes >> to get you through the misery. >> >> >> h2. x64 Windows >> >> *Directories* >> * C:\TEMP\boost_1_48_0 - Where Boost source code was extracted >> * c:\mingw64-i686-20110207 - 64-bit MinGw >> * C:\Python26 - 64-bit Python installation (2.6.6) >> * C:\TEMP\boost_build - Directory for storing build output >> >> *Steps* >> # Enter C:\TEMP\boost_1_48_0\tools\build\v2\engine >> # C:\TEMP\boost_1_48_0\tools\build\v2\engine>build.bat mingw >> --toolset-root=c:\mingw64-i686-20110207 >> # Copy bin./* to /bin # Change into >> C:\TEMP\boost_1_48_0 # C:\TEMP\boost_1_48_0>bootstrap.bat mingw >> --toolset-root=c:\mingw64-i686-20110207 --with-python-root=C:\Python26 >> # Make a temporary boost build directory, C:\TEMP\boost_build # Work >> through the following steps to workaround a bug that has been around >> for years, but seemingly will never get fixed: >>
1.	Open tools/build/v2/tools/python.jam
>> 2.	There, locate the following code:
>> if [ version.check-jam-version 3 1 17 ] || ( [ os.name ] != NT ) {
>>     # Prior to version 3.1.17 Boost Jam's SHELL command did not support
>>     # quoted commands correctly on Windows. This means that on that
>>     # platform we do not support using a Python command interpreter
>>     # executable whose path contains a space character.
>>     python-cmd = \"$(python-cmd)\" ;
>> }
>> 3.	Remove that code block completely. 
>> # Grab attachment:python26.def >> # Copy c:\windows\System32\python26.dll to the same location as >> attachment:python26.def # Execute: @dlltool --dllname python26.dll >> --def python26.def --output-lib libpython26.a@ # Copy libpython26.a to >> C:\Python26\libs # pre> bjam.exe --toolset=gcc --build-type=complete >> --build-dir=C:\TEMP\boost_build\build >> --stagedir=C:\TEMP\boost_build\stage -- address-model=64 >> define=BOOST_USE_WINDOWS_H threadapi=win32 target-os=windows stage >> # Copy all files under C:\temp\boost_build\stage\lib to >> c:\mingw64-i686-20110207\x86_64-w64-mingw32\lib64 >> # Copy C:\TEMP\boost_1_48_0\boost to >> c:\mingw64-i686-20110207\x86_64-w64-mingw32\inlcude >> >> -----Original Message----- >> From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org >> [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On >> Behalf Of hbd666 >> Sent: Wednesday, December 21, 2011 2:24 AM >> To: cplusplus-sig at python.org >> Subject: EXTERNAL: [C++-sig] Building Boost Python problem >> >> Hi I hope someone can help me out... >> The object is to build boost python (boost-1.4.8, python 2.7 32bit, >> windows 7 64bit, mingw). >> I've been trying to fix this for a good 8 hours but can't figure it out. >> >> bjam --with-python --build-type=complete --toolset=gcc stage >> >> Looking at the resulting output below, I see the problem is probably >> that bjam can't find python27.lib. I just don't see how that is >> possible because it finds python.exe in C:\Python27 and indeed >> python27.lib exists in the C:\Python27\libs directory. >> >> Resulting output..... >> >> Component configuration: >> >> - chrono : not building >> - date_time : not building >> - exception : not building >> - filesystem : not building >> - graph : not building >> - graph_parallel : not building >> - iostreams : not building >> - locale : not building >> - math : not building >> - mpi : not building >> - program_options : not building >> - python : building >> - random : not building >> - regex : not building >> - serialization : not building >> - signals : not building >> - system : not building >> - test : not building >> - thread : not building >> - timer : not building >> - wave : not building >> >> ...patience... >> ...patience... >> ...found 1932 targets... >> ...updating 16 targets... >> gcc.link.dll >> bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libbo >> ost_python-mgw46-mt-1_48.dll.a >> Creating library file: >> bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\module.o:module.cpp:(.text+0x165): >> undefined reference to `_imp__Py_InitModule4 ' >> collect2: ld returned 1 exit status >> >> "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R >> -Wl,"C:\Python27\libs" >> "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll.a" >> -o >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll" >> -shared -Wl,--start-group >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\numeric.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\list.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\long.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\dict.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\tuple.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\str.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\slice.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\from_python.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\registry.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\type_id.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\enum.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\class.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\function.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\inheritance.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\life_support.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\pickle_support.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\errors.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\module.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\builtin_converters.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\converter\arg_to_python_base.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\iterator.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\stl_iterator.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object_protocol.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object_operators.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\wrapper.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\import.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\exec.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\object\function_doc_signature.o" >> -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -mthreads >> >> ...failed gcc.link.dll >> bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libbo >> ost_python-mgw46-mt-1_48.dll.a >> bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libboost_python-mgw46-mt-1_48.dll... >> ...removing >> bin.v2\libs\python\build\gcc-mingw-4.6.1\release\threading-multi\libbo >> ost_python-mgw46-mt-1_48.dll.a ...skipped >> libboost_python-mgw46-mt-1_48.dll.a for lack of >> libboost_python-mgw46-mt-1_48.dll.a... >> ...skipped libboost_python-mgw46-mt-1_48.dll for lack of >> libboost_python-mgw46-mt-1_48.dll... >> gcc.link.dll >> bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d >> -1_48.dll.a >> Creating library file: >> bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\debug\module.o: >> In function `ZN5boost6python6detail11init_moduleEPKcPFvvE': >> D:\boost_1_48_0\libs\python\example\quickstart/../../../../libs/python/src/module.cpp:59: >> undefined reference to `_imp__Py_InitModule4 ' >> collect2: ld returned 1 exit status >> >> "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R >> -Wl,"C:\Python27\libs" >> "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll.a" >> -o >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll" >> -shared -Wl,--start-group >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\numeric.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\list.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\long.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\dict.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\tuple.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\str.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\slice.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\from_python.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\registry.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\type_id.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\enum.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\class.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\function.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\inheritance.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\life_support.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\pickle_support.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\errors.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\module.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\builtin_converters.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\converter\arg_to_python_base.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\iterator.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\stl_iterator.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object_protocol.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object_operators.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\wrapper.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\import.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\exec.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\object\function_doc_signature.o" >> -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -g >> >> ...failed gcc.link.dll >> bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d >> -1_48.dll.a >> bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d-1_48.dll... >> ...removing >> bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\libboost_python-mgw46-d >> -1_48.dll.a ...skipped libboost_python-mgw46-d-1_48.dll.a >> for lack of >> libboost_python-mgw46-d-1_48.dll.a... >> ...skipped libboost_python-mgw46-d-1_48.dll for lack of >> libboost_python-mgw46-d-1_48.dll... >> gcc.link.dll >> bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46 >> -1_48.dll.a >> Creating library file: >> bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\release\module.o:module.cpp:(.text+0x165): >> undefined reference to `_imp__Py_InitModule4 ' >> collect2: ld returned 1 exit status >> >> "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R >> -Wl,"C:\Python27\libs" >> "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll.a" >> -o >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll" >> -shared -Wl,--start-group >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\numeric.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\list.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\long.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\dict.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\tuple.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\str.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\slice.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\from_python.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\registry.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\type_id.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\enum.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\class.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\function.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\inheritance.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\life_support.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\pickle_support.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\errors.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\module.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\builtin_converters.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\converter\arg_to_python_base.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\iterator.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\stl_iterator.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object_protocol.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object_operators.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\wrapper.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\import.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\exec.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\release\object\function_doc_signature.o" >> -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group >> >> ...failed gcc.link.dll >> bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46 >> -1_48.dll.a >> bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46-1_48.dll... >> ...removing >> bin.v2\libs\python\build\gcc-mingw-4.6.1\release\libboost_python-mgw46 >> -1_48.dll.a ...skipped libboost_python-mgw46-1_48.dll.a >> for lack of >> libboost_python-mgw46-1_48.dll.a... >> ...skipped libboost_python-mgw46-1_48.dll for lack of >> libboost_python-mgw46-1_48.dll... >> gcc.link.dll >> bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboos >> t_python-mgw46-mt-d-1_48.dll.a >> Creating library file: >> bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.abin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\module.o: >> In function `ZN5boost6python6detail11init_moduleEPKcPFvvE': >> D:\boost_1_48_0/libs/python/src/module.cpp:59: undefined reference to >> `_imp__Py_InitModule4 >> ' >> collect2: ld returned 1 exit status >> >> "g++" -L"C:\Python27\libs" -Wl,-R -Wl,"C:\Python27" -Wl,-R >> -Wl,"C:\Python27\libs" >> "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll.a" >> -o >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll" >> -shared -Wl,--start-group >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\numeric.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\list.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\long.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\dict.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\tuple.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\str.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\slice.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\from_python.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\registry.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\type_id.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\enum.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\class.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\function.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\inheritance.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\life_support.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\pickle_support.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\errors.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\module.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\builtin_converters.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\converter\arg_to_python_base.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\iterator.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\stl_iterator.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object_protocol.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object_operators.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\wrapper.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\import.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\exec.o" >> "bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\object\function_doc_signature.o" >> -Wl,-Bstatic -Wl,-Bdynamic -lpython27 -Wl,--end-group -g -mthreads >> >> ...failed gcc.link.dll >> bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboos >> t_python-mgw46-mt-d-1_48.dll.a >> bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboost_python-mgw46-mt-d-1_48.dll... >> ...removing >> bin.v2\libs\python\build\gcc-mingw-4.6.1\debug\threading-multi\libboos >> t_python-mgw46-mt-d-1_48.dll.a ...skipped >> libboost_python-mgw46-mt-d-1_48.dll.a for lack of >> libboost_python-mgw46-mt-d-1_48.dll.a... >> ...skipped libboost_python-mgw46-mt-d-1_48.dll for lack of >> libboost_python-mgw46-mt-d-1_48.dll... >> ...failed updating 8 targets... >> ...skipped 8 targets... >> >> _______________________________________________ >> Cplusplus-sig mailing list >> Cplusplus-sig at python.org >> http://mail.python.org/mailman/listinfo/cplusplus-sig > > > -- > Using Opera's revolutionary email client: http://www.opera.com/mail/ > > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig at python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig -- Using Opera's revolutionary email client: http://www.opera.com/mail/ From roman.yakovenko at gmail.com Thu Dec 22 08:32:29 2011 From: roman.yakovenko at gmail.com (Roman Yakovenko) Date: Thu, 22 Dec 2011 09:32:29 +0200 Subject: [C++-sig] EXTERNAL: Re: pygccxml KeyError In-Reply-To: <86299D4CFE2C1248AA41ACF782B0D14310D7082F@HDXDSP11.us.lmco.com> References: <86299D4CFE2C1248AA41ACF782B0D14310D67CD4@HDXDSP12.us.lmco.com> <86299D4CFE2C1248AA41ACF782B0D14310D701FF@HDXDSP11.us.lmco.com> <86299D4CFE2C1248AA41ACF782B0D14310D7082F@HDXDSP11.us.lmco.com> Message-ID: On Wed, Dec 21, 2011 at 2:44 AM, Davidson, Josh wrote: > I did run into a couple subtle problems with this approach. ?Depending on where I put the header file, Py++ doesn't generate pypp.hpp/pypp.cpp files that actually register the data structures. ?Everything shows up in the exposed_decl.pypp.txt file, but there are no Py++ generated source files to actually get compiled into the extension. ? Just where the file can be placed and where it can't is quite puzzling. ?Initially, I wanted to build the fake header as a string using file_configuration_t and CONTENT_TYPE.TEXT as my files argument to module builder, but that didn't work. ?I then created a real fake header in the filesystem, and it initially didn't work either. ?After much trial and error, I found that it would work if placed in certain directories. This is a long standing issue with Py++. It can't be solved without breaking backward compatibility to the existing code. You will have to use "include/exclude" functionality to select the desired set of to be exported declarations. Roman From josh.davidson at lmco.com Fri Dec 23 22:47:38 2011 From: josh.davidson at lmco.com (Davidson, Josh) Date: Fri, 23 Dec 2011 21:47:38 +0000 Subject: [C++-sig] EXTERNAL: Re: pygccxml KeyError In-Reply-To: References: <86299D4CFE2C1248AA41ACF782B0D14310D67CD4@HDXDSP12.us.lmco.com> <86299D4CFE2C1248AA41ACF782B0D14310D701FF@HDXDSP11.us.lmco.com> <86299D4CFE2C1248AA41ACF782B0D14310D7082F@HDXDSP11.us.lmco.com> Message-ID: <86299D4CFE2C1248AA41ACF782B0D14310D70DDC@HDXDSP11.us.lmco.com> Roman, Is this a difficult issue to fix? If not, could it be fixed in a branch release? Having to manually include/exclude every declaration adds a bit of overhead and the current erroneous behavior goes against the documentation: docs-Mar-17-2011/docs-Mar-17-2011/pyplusplus/documentation/tutorials/module_builder/module_builder.html#declarations-customization Thanks, Josh -----Original Message----- From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On Behalf Of Roman Yakovenko Sent: Thursday, December 22, 2011 12:32 AM To: Development of Python/C++ integration Subject: Re: [C++-sig] EXTERNAL: Re: pygccxml KeyError On Wed, Dec 21, 2011 at 2:44 AM, Davidson, Josh wrote: > I did run into a couple subtle problems with this approach. ?Depending on where I put the header file, Py++ doesn't generate pypp.hpp/pypp.cpp files that actually register the data structures. ?Everything shows up in the exposed_decl.pypp.txt file, but there are no Py++ generated source files to actually get compiled into the extension. ? Just where the file can be placed and where it can't is quite puzzling. ?Initially, I wanted to build the fake header as a string using file_configuration_t and CONTENT_TYPE.TEXT as my files argument to module builder, but that didn't work. ?I then created a real fake header in the filesystem, and it initially didn't work either. ?After much trial and error, I found that it would work if placed in certain directories. This is a long standing issue with Py++. It can't be solved without breaking backward compatibility to the existing code. You will have to use "include/exclude" functionality to select the desired set of to be exported declarations. Roman _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig at python.org http://mail.python.org/mailman/listinfo/cplusplus-sig From dave at boostpro.com Tue Dec 27 23:01:47 2011 From: dave at boostpro.com (Dave Abrahams) Date: Tue, 27 Dec 2011 17:01:47 -0500 Subject: [C++-sig] [Python] Wrapping Visitor Pattern and Object Slicing In-Reply-To: <4EFA36EF.5020509@icecube.umd.edu> (Alex Olivas's message of "Tue, 27 Dec 2011 14:21:51 -0700") References: <4EFA36EF.5020509@icecube.umd.edu> Message-ID: The following message is a courtesy copy of an article that has been posted to gmane.comp.lib.boost.user as well. on Tue Dec 27 2011, Alex Olivas wrote: > Hey All, > I'm trying to wrap a third party lib that uses the visitor > pattern and their own smart pointers ('ref_ptr' below), which > manages objects that inherit from 'Referenced'. I've put > together a simple example that illustrates the problem. > > Code for python bindings : http://codepad.org/wq47m5CI > Simple test script : http://codepad.org/Jfme3U6U > Output for two cases : http://codepad.org/gbFBxy04 > Case 1) 'apply' override is commented out in the python class > Case 2) 'apply' override exists > > The problem that I'm having is that the 'apply' method > ( lines 83 - 86 ) slices everything to base unless I use > boost::ref(). However this only works for wrapped classes > and in this lib several classes use derived visitors that > are not part of the public API ( which I modeled as HelperVisitor > in the above example ). > > Is there anyway to prevent object slicing for both wrapped > and unwrapped objects in this scenario? > > I'm building against boost 1.47 and if anyone's interested in > digging deeper the 3rd party lib is Open Scene Graph 3.0.1. Just a wild guess, but it looks like you're copying and slicing the VisitorBase object here: VisitorBase_wrapper( PyObject* o , const VisitorBase& b) : self( o ), VisitorBase(b) {}; Also, you could try using & (address-of) instead of boost::ref. Also, I suggest following this post up on the C++-sig instead of here; you'll get better help. Cheers, -- Dave Abrahams BoostPro Computing http://www.boostpro.com