X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: RoBoard Lab Newsgroups: comp.os.msdos.djgpp Subject: Cygwin-to-DJGPP cross compiler Date: Wed, 02 Oct 2013 11:39:32 +0800 Organization: Netfront http://www.netfront.net/ Lines: 97 Message-ID: NNTP-Posting-Host: 114.34.144.113 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: adenine.netfront.net 1380685151 34454 114.34.144.113 (2 Oct 2013 03:39:11 GMT) X-Complaints-To: news AT netfront DOT net NNTP-Posting-Date: Wed, 2 Oct 2013 03:39:11 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 Bytes: 4788 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com We successfully built DJGPP cross compiler in Cygwin last night using Andris Pavenis's SRPM packages. We use it to compile several sample programs (such as a hello world program and a 100-line I/O program hooking the 08h interrupt) and it seems that no problem occurs (but more tests should be done). I briefly mention our process in the following: 1. djcross-binutils-2.22-1ap.src.rpm This is a package with less problems. We just added _smp_mflags to .rpmmacros and removed BuildRequires from the spec file. Then the build progress basically succeeded under Cygwin. 2. djcrx-2.04pre_20130306-15ap.src.rpm This package needs DJGPP cross compiler to build, but we has no such compiler under Cygwin:( And if we want to build Cygwin-to-DJGPP cross compiler, we must build this package first... (like a contradiction) On the other hand, the makefile of DJGPP source in this package uses the environment variable "COMSPEC" to determine whether the cross compiling should run. And in my Cygwin (running on WinXP), COMSPEC is always defined, and hence the makefile don't run cross compiling correctly. To solve the above problems, we modify that makefile to force cross compiling and remove the compilation of all DOS binaries. The DOS binaries (djcrx204.zip) are downloaded from internet instead and added into this package. We then modify the spec file correspondingly to build this package. 3. djcross-gcc-4.8.1-1ap.src.rpm Because we need only c,c++ compilers, we modify the spec file to remove the compilation of f95, objc/objc++, ada. The original spec file uses the following line to make gcc binaries: make %{_smp_mflags} PATH=$RPM_BUILD_DIR/%{name}-%{version}/tmpinst/bin:$PATH || exit 1 The $PATH variable has problems in Cygwin due to some path names with spaces (such as "/Program Files"). So we change $PATH to '/usr/local/bin:/usr/bin' in our spec file. The original spec file has two bugs as follows: sh unpack-gcc.sh --no-djgpp-sources gcc-%{gcc_source_name}.tar.bz2 || exit 1 '--no-djgpp-sources' should be changed to '--no-djgpp-source' and %{_libdir}/gcc/%{target}/%{gcc_version}/finclude 'finclude' should be changed to 'include' With the above modification, the binaries of gcc cross compilers can then be built successfully. But the RPM building progress fails due to the lack of some paths/files specified in the original spec file: %{_libdir}/gcc/%{target}/%{gcc_version}/libcaf_single.* %{_libdir}/gcc/%{target}/%{gcc_version}/plugin/gtype.state %{_libdir}/gcc/%{target}/%{gcc_version}/plugin/include/* %{_libexecdir}/gcc/%{target}/%{gcc_version}/plugin/gengtype %doc COPYING* README readme.DJGPP This is possibly because we skip the compilation of gcc fortran. And we remove the above lines and rebuild, and then every step is passed but rpmbuild still reports errors after the last step as follows: error: Installed (but unpackaged) file(s) found: /usr/bin/i586-pc-msdosdjgpp-c++.exe /usr/bin/i586-pc-msdosdjgpp-cpp.exe /usr/bin/i586-pc-msdosdjgpp-g++.exe /usr/bin/i586-pc-msdosdjgpp-gcov.exe /usr/libexec/gcc/i586-pc-msdosdjgpp/4.8.1/cc1.exe /usr/libexec/gcc/i586-pc-msdosdjgpp/4.8.1/cc1plus.exe /usr/libexec/gcc/i586-pc-msdosdjgpp/4.8.1/collect2.exe /usr/libexec/gcc/i586-pc-msdosdjgpp/4.8.1/lto-wrapper.exe RPM build errors: File listed twice: /usr/lib/gcc/i586-pc-msdosdjgpp/4.8.1/include/adxintrin.h File listed twice: /usr/lib/gcc/i586-pc-msdosdjgpp/4.8.1/include/ammintrin.h File listed twice: /usr/lib/gcc/i586-pc-msdosdjgpp/4.8.1/include/avx2intrin.h ...... So we then manually copy and install the generated i586-pc-msdosdjgpp-xxx binaries to the Cygwin system, and with some tests, they seems to work normally. --- news://freenews.netfront.net/ - complaints: news AT netfront DOT net ---