[Porting] Dash configure scripts parameters
[Porting] Dash configure scripts parameters
Hello,
I have built a toolchain for my OS according to the tutorial on the Wiki : it works well, including Newlib. Now I'd like to port dash. However, I could not find how to set the compiler to be used to compile the program. For other configure scripts, I could configure it with options such as "target" or "cc". But concerning dash, I have not found such options in the help of the configure script (I'm dealing with dash 0.5.5.1).
If anyone has successfully ported any version of dash to their OS, could they tell me how they configured ?
Thanks in advance.
P.S: Sorry for my English.
I have built a toolchain for my OS according to the tutorial on the Wiki : it works well, including Newlib. Now I'd like to port dash. However, I could not find how to set the compiler to be used to compile the program. For other configure scripts, I could configure it with options such as "target" or "cc". But concerning dash, I have not found such options in the help of the configure script (I'm dealing with dash 0.5.5.1).
If anyone has successfully ported any version of dash to their OS, could they tell me how they configured ?
Thanks in advance.
P.S: Sorry for my English.
Re: [Porting] Dash configure scripts parameters
To cross-compile dash and most tools that run on my OS I use thisIf you need to pass some CFLAGS you can do this This method requires modifying the config files for the package slightly to 'register' your OS as being a supported HOST but it's pretty simple. Let me know if you need more info.
I always try make bend my OS and clib to run the packages with absolutely no modifications at all. I succeeded to do that with dash.
Code: Select all
export PREFIX=/Users/gerryg/anvilos/cross-tools/
export HOST=x86_64-anvil
./configure --host=$HOST --prefix=$PREFIX
make all
mak install
Code: Select all
CFLAGS="-mcmodel=large -m64" ./configure --host=$HOST --prefix=$PREFIX
I always try make bend my OS and clib to run the packages with absolutely no modifications at all. I succeeded to do that with dash.
If a trainstation is where trains stop, what is a workstation ?
Re: [Porting] Dash configure scripts parameters
Thanks for your reply.
Which version did you use ? Mine is 0.5.5.1. I have token a look at the files configure.ac and config.h.in but couldn't find here a list of supported hosts. Could you please give me more info ?
Which version did you use ? Mine is 0.5.5.1. I have token a look at the files configure.ac and config.h.in but couldn't find here a list of supported hosts. Could you please give me more info ?
Re: [Porting] Dash configure scripts parameters
I've used 0.5.6 and 0.5.7. Also, I just checked and actually I didn't need to make any changes to the config files at all. Sorry for misleading you.
If a trainstation is where trains stop, what is a workstation ?
Re: [Porting] Dash configure scripts parameters
Now I have switched to 0.5.7. I have followed your instructions but the configure script blocks on "checking whether we are cross compiling...". I have also added $PREFIX/bin to the PATH (I guess that otherwise, dash could not detect my cross-compiler).
Note that for me, PREFIX=/usr/local/cross and TARGET=i586-pc-myos
Here is the complete output :
Note that for me, PREFIX=/usr/local/cross and TARGET=i586-pc-myos
Here is the complete output :
Code: Select all
configure: WARNING: if you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for i586-pc-myos-strip... i586-pc-myos-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for i586-pc-myos-gcc... i586-pc-myos-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling...
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: [Porting] Dash configure scripts parameters
According to the Autotools manual, due to changes going on with autoconf at the moment, if you are cross compiling you need to specify both --build (the machine you're running the compiler on) and --host (the machine you're building for). Specifying only one will not enable cross compilation mode
You can get the target triple from GCC or Clang by invoking '$CC -dumpmachine'
(--target configures the machine that the program you're building is to build for)
You can get the target triple from GCC or Clang by invoking '$CC -dumpmachine'
(--target configures the machine that the program you're building is to build for)
Re: [Porting] Dash configure scripts parameters
Thanks, it is working now.
Re: [Porting] Dash configure scripts parameters
Well, after trying to make, I came to realize that there is still a problem. Indeed now, when making mkinit, I get multiple definitions of struct stat in header /usr/include/i386-pc-linux-gnu/bits/stat.h. On the one hand you have a definition of struct stat and on the other hand a definition of struct stat64, but the compiler seems to consider these types as synonyms (maybe due to some typedef or define). I use gcc 4.4.3 and newlib 1.20.0.
Re: [Porting] Dash configure scripts parameters
Code: Select all
/usr/include/i386-pc-linux-gnu/bits/stat.h
If a trainstation is where trains stop, what is a workstation ?
Re: [Porting] Dash configure scripts parameters
Yes it is.
P.S: In fact the path is /usr/include/i386-linux-gnu/bits/stat.h and not /usr/include/i386-pc-linux-gnu/bits/stat.h.
P.S: In fact the path is /usr/include/i386-linux-gnu/bits/stat.h and not /usr/include/i386-pc-linux-gnu/bits/stat.h.
Re: [Porting] Dash configure scripts parameters
Your cross compiler should not include any files from Linux. It should only include the stat.h for your OS.
If a trainstation is where trains stop, what is a workstation ?
Re: [Porting] Dash configure scripts parameters
Some files such as mkinit need to be built using cc (which is a synonym of gcc in my case) and not with the cross-compiler. Here is the problematical command :
The problem does not happen with mknodes :
Note that my cross-compiler is used for the files that need to be built with it :
Maybe the configure output could be of some help :
Code: Select all
cc -I. -I.. -include ../config.h -DBSD=1 -DSHELL -DIFS_BROKEN -g -O2 -Wall -o mkinit mkinit.c
Code: Select all
cc -I. -I.. -include ../config.h -DBSD=1 -DSHELL -DIFS_BROKEN -g -O2 -Wall -o mknodes mknodes.c
Code: Select all
i586-pc-myos-gcc -DHAVE_CONFIG_H -I. -I.. -include ../config.h -DBSD=1 -DSHELL -DIFS_BROKEN -Wall -g -O2 -MT arith_yacc.o -MD -MP -MF .deps/arith_yacc.Tpo -c -o arith_yacc.o arith_yacc.c
Code: Select all
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for i586-pc-myos-strip... i586-pc-myos-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for i586-pc-myos-gcc... i586-pc-myos-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether i586-pc-myos-gcc accepts -g... yes
checking for i586-pc-myos-gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of i586-pc-myos-gcc... gcc3
checking how to run the C preprocessor... i586-pc-myos-gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... no
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for bison... no
checking for byacc... no
checking for build system compiler... cc
checking for __attribute__((__alias__()))... yes
checking alloca.h usability... yes
checking alloca.h presence... yes
checking for alloca.h... yes
checking paths.h usability... yes
checking paths.h presence... yes
checking for paths.h... yes
checking whether _PATH_BSHELL is declared... yes
checking whether _PATH_DEVNULL is declared... no
checking whether _PATH_TTY is declared... no
checking whether isblank is declared... yes
checking size of intmax_t... 8
checking size of long long int... 8
checking whether PRIdMAX is declared... yes
checking for bsearch... yes
checking for faccessat... no
checking for getpwnam... no
checking for getrlimit... no
checking for imaxdiv... no
checking for isalpha... yes
checking for killpg... yes
checking for mempcpy... yes
checking for sigsetmask... no
checking for stpcpy... yes
checking for strchrnul... yes
checking for strsignal... yes
checking for strtod... yes
checking for strtoimax... no
checking for strtoumax... no
checking for sysconf... no
checking for signal... yes
checking for stat64... no
checking for open64... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
Re: [Porting] Dash configure scripts parameters
Try debugging it. If it's a simple double inclusion error you should be able to find out where and why easily from the compiler error messages with a basic understanding of C.
Re: [Porting] Dash configure scripts parameters
I have solved the problem. In fact, in my stat.h file, you had both a definition of stat and stat64 structures :
Now, as my system does not provide open64 etc., the config.h file generated by the configure script contained the following defines :
Moreover __USE_LARGEFILE64 was defined because _LARGEFILE64_SOURCE was defined because _GNU_SOURCE was defined.
I simply added #undef _GNU_SOURCE at the end of my config.h file and it worked.
Code: Select all
...
struct stat
{
...
}
...
#ifdef __USE_LARGEFILE64
...
struct stat64
{
...
}
...
#endif
...
Code: Select all
#define stat64 stat
#define open64 open
#define fstat64 fstat
I simply added #undef _GNU_SOURCE at the end of my config.h file and it worked.