stdint.h and inttypes.h missing - c

I am calling for any GCC/MinGW master out there. I try to install a library in Windows 8.1 using MinGW, and configure says stdint.h and inttypes.h are missing :
$ ./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for ranlib... ranlib
checking how to run the C preprocessor... 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... yes
checking for strings.h... yes
checking for inttypes.h... no
checking for stdint.h... no
This is my MinGW setup after downloading the current version from http://www.mingw.org/category/wiki/download:
MINGWBASEDIR=C:\MinGW
gcc version 4.9.3 (GCC)
gcc version 4.8.1 (GCC)
GNU gdb (GDB) 7.6.1
GNU ld (GNU Binutils) 2.25.1
GNU windres (GNU Binutils) 2.25.1
GNU dlltool (GNU Binutils) 2.25.1
libtool (GNU libtool) 2.4
PExports 0.47; Originally written 1998, Anders Norlander
GNU Make 3.82.90
#define __MINGW32_VERSION 3.20
#define __W32API_VERSION 3.17
$ echo $MSYSTEM
MINGW32
$ locate stdint.h
reports nothing (updatedb is up to date)
How I can get those headers in my box?

I just ran into a similar problem when trying to build libx264. I found the solution on the Msys wiki, though it was not explicitly stated that it was tied to this problem. The solution for me was to mount C:/MinGW inside of the Msys shell. The Msys shell being started from C:/MinGW/msys/1.0/msys.bat, then running:
mount c:/MinGW /mingw
As best I can tell, this exposes both the Msys and MinGW include directories when building. Since stdint.h and inttypes.h were only present in the MinGW include and could not be simply copied over, this was the only way to compile. Afterwards, libx264 compiled without error. Hope this fix will also help you with your issue.
MinGW version: mingw-get version 0.6.2-beta-20131004-1

Related

Mac OS Sierra: checking whether the C compiler works... no

I want to compile a C library on my MacOS Sierra system, but I am getting the following error:
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... clang
checking whether the C compiler works... no
configure: error: in `/Users/macuser/Downloads/libr':
configure: error: C compiler cannot create executables
I tried setting the symlink as suggested in OS X 10.9.2: checking whether the C compiler works... no :
sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeD‌​efault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.‌​11.xctoolchain
I tried setting the CC path and install xcode as in https://apple.stackexchange.com/questions/216573/cant-compile-source-code-on-mac :
export CC=clang
xcode-select --install
and accept the license. But nothing worked. Are there any new steps to consider on Sierra to get the command line tools running properly?
Start Xcode, select 'Preferences', then 'Locations'. You'll notice a dropdown control at 'Command Line Tools'. Select the newest version, close the dialog window, then call brew again. Restart your computer and run it again.

Getting Valgrind on Windows 7

I'm learning C and want to install Valgrind on my system, however when I attempt to install Valgrin I get an error saying Valgrind is OS specific. Sorry I'm running Windows 7, with Mingw64 GIT installed. I've done some research and found this. According to that I need to run sh ./configure --host x86_64 w64-mingw32 However when I run this I get the following output:
$ sh ./configure --host x86_64-w64-mingw32
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for x86_64-w64-mingw64-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether ln -s works... no, using cp -pR
checking for x86_64-w64-mingw64-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for x86_64-w64-mingw64-g++... no
checking for x86_64-w64-mingw64-c++... no
checking for x86_64-w64-mingw64-gpp... no
checking for x86_64-w64-mingw64-aCC... no
checking for x86_64-w64-mingw64-CC... no
checking for x86_64-w64-mingw64-cxx... no
checking for x86_64-w64-mingw64-cc++... no
checking for x86_64-w64-mingw64-cl.exe... no
checking for x86_64-w64-mingw64-FCC... no
checking for x86_64-w64-mingw64-KCC... no
checking for x86_64-w64-mingw64-RCC... no
checking for x86_64-w64-mingw64-xlC_r... no
checking for x86_64-w64-mingw64-xlC... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for x86_64-w64-mingw64-ranlib... no
checking for ranlib... ranlib
checking for a sed that does not truncate output... /usr/bin/sed
checking for ar... /c/mingw/bin/ar
checking for perl... /usr/bin/perl
checking for gdb... /c/mingw/bin/gdb
checking dependency style of gcc... gcc3
checking for diff -u... yes
checking for a supported version of gcc... ok (4.7.2)
checking build system type... x86_64-pc-mingw64
checking host system type... x86_64-w64-mingw64
checking for a supported CPU... ok (x86_64)
checking for a 64-bit only build... no
checking for a 32-bit only build... no
checking for a supported OS... no (mingw64)
configure: error: Valgrind is operating system specific. Sorry.
So I thought, well I have I Mingw64, so may I should try that, same thing. Why is throwing the exception that I don't have Mingw, and how do I fix this?
The error is saying that your OS is not supported and it found Mingw on your system which is not supported.
In general valgrind is not supported on Windows. Microsoft have their own version of glibc and their own kernel. Making a version of valgrind that can run on Windows would require a lot of porting work which no one is willing to make at the moment.
Valgrind compiled only for: {x86,amd64,arm32,arm64,ppc32,ppc64le,ppc64be,s390x,mips32,mips64}-linux, {arm32,arm64,x86,mips32}-android, {x86,amd64}-solaris and {x86,amd64}-darwin (Mac OS X 10.13
Is there a good Valgrind substitute for Windows? Read more this
You can try download Code::Blocks IDE with MinGW for Windows7 32/64 bit
Official site here

trying to install valgrind but stuck at make valgrind, how?

This might be a silly question, actually I have just started with it.
I am following a tutorial to LCTHW
and I am trying to install valgrind, the author specifies steps:
1) Download it (use wget if you don't have curl)
curl -O http://valgrind.org/downloads/valgrind-3.6.1.tar.bz2
use md5sum to make sure it matches the one on the site
md5sum valgrind-3.6.1.tar.bz2
2) Unpack it.
tar -xjvf valgrind-3.6.1.tar.bz2
cd into the newly created directory
cd valgrind-3.6.1
3) configure it
./configure
4) make it
make
5) install it (need root)
sudo make install
I am stuck at step 4, what to make here? What should the command look like? I have made c programs before but which specific file in here do I need to specify?
This is what I get when I run make:
Blackbeard#PC-DEV-A179:~/valgrind-3.6.1$ make
make: *** No targets specified and no makefile found. Stop.
Edit:
As pinted out by user43250937, ./configure is not working properly, I get the following:
$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether ln -s works... yes
checking for gcc... 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... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking whether gcc and cc understand -c and -o together... yes
checking how to run the C preprocessor... gcc -E
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for ranlib... ranlib
checking for a sed that does not truncate output... /bin/sed
checking for ar... /usr/bin/ar
checking for perl... /usr/bin/perl
checking for gdb... /usr/bin/gdb
checking dependency style of gcc... gcc3
checking for diff -u... yes
checking for a supported version of gcc... ok (4.8.2)
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a supported CPU... ok (x86_64)
checking for a 64-bit only build... no
checking for a 32-bit only build... no
checking for a supported OS... ok (linux-gnu)
checking for the kernel version... unsupported (3.13.0-49-generic)
configure: error: Valgrind works on kernels 2.4, 2.6
I am running Ubuntu 14.04 LTS
Step 3 (configure), likely didn't complete correctly due to missing dependecies/libraries, check the output of that command.
Edit: You need a newer version of Valgrind that supports kernel 3.x, now they are at valgrind-3.10.1, that will work.
From your output:
configure: error: Valgrind works on kernels 2.4, 2.6
Did you download a ridiculously old copy of valgrind? Also, on Ubuntu, you can just
sudo apt-get install valgrind

Autoconf ignores compiler flags

I'm trying to build a C library with a non-native architecture. I'm running OSX 10.6 (which is x86_64) but I need the library compiled for i386. Normally, you can just add the compiler flag: -arch i386. But I'm using Autoconf and it ignores this in the configure file and it also ignores it if I try running: ./configure CC="gcc -arch i386".
I know its building x86_64 object files because I've looked at the header using otool. The real kicker is that when autoconf writes out the configuration summary, it lists -arch i386 in the cc flags. What's going on here??
specs:
OSX 10.6.2
gcc 4.2.1
autoconf 2.64
make 3.81
Assuming that "CFLAGS='-arch i386' is what you meant when you said "normally, you can just add the compiler flag", my best guess is that the maintainer of the code has done something wrong in the configure.ac and overwritten CFLAGS. Check through the configure.ac (or configure.in if the project is old) and see if they've explicitly assigned to CC or CFLAGS. Also check the Makefile.am for assignments. Chances are something is wrong. What you've done should work.
You want to set it in the CFLAGS environmental variable, autoconf should append it to whatever it decides CFLAGS should be. If you type ./configure --help, you should get a list of all influential environmental variables.

C compiler cannot create executables when trying to build Binutils

I am trying to build Linux From Scratch, and now I am at chapter 5.4, which tells me how to build Binutils. I have binutils 2.20's source code, but when I try to build it:
time { ./binutils-2.20/configure --target=$LFS_TGT --prefix=/tools --disable-nls --disable-werror ; }
it gives me an error:
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-lfs-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... gawk
checking for gcc... GCC
checking for C compiler default output file name...
configure: error: in `/media/LFS':
configure: error: C compiler cannot create executables
See `config.log' for more details.
You can see my config.log at pastebin.com: http://pastebin.com/hX7v5KLn
I have just installed Ubuntu 10.04, and reinstalled GCC and installed G++. Also, the build is done by a non-root, non-admin user called 'lfs' (which is also described in Linux From Scratch), and on a different partition than where the system is installed.
Can anyone help me? Thanks
The /tools directory didn't exist. I created it and now it compiles fine.
Try:
export CC=/usr/bin/gcc
before running configure.

Resources