Struggling to get PortAudio to Work with MinGW - c

I have the MinGW install previously working fine with MSYS. They are installed properly and functioning just well.
I installed the PortAudio library and did the install and got the success message after:
./configure
make
make install
When I try to compile samples:
c:\c>gcc patest_mono.c -o pa.exe
patest_mono.c:50:23: fatal error: portaudio.h: No such file or directory
#include "portaudio.h"
^
compilation terminated.
I'm new. I have a feeling I might be doing something fundamentally wrong with the way I'm trying to create the exe from compiling. It's been somewhat of a puzzle quest so far, but I've tried to figure it out and think I am close but completely missing something.
PATH variable ?
In the PortAudio MinGW build instructions I noticed
"The above should create a working version though you might want to
provide '–prefix=<path-to-install-dir>' to configure. "
I've tried adding C:\MingW\PortAudio into the user path. Doesn't work.
I've also tried running the commands in Bash and they come back with an error message "No Rule to make target 'paexpink'" either with the make command, and with gcc .c -o .exe I just get the same error message as compiling straight from the cmd prompt.
I found another source on stack overflow thread with no answers, but the user had commented that http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio provided them a solution but I tried installing the 5 cpython binaries and under the assumption I did it right, it didn't work either.
Thanks for your help,
Julian

To build and install portaudio, you need to add -prefix=/c/<"path to base of the MinGW directory"> to the ./configure line.
For example: ./configure -prefix=/c/MinGW/
then continue the installation by doing
make
After that, do the
make install
and that should install the portaudio files into MinGW.
After it has finished installing, you need to add -lportaudio to the compile command whenever you compile any programs that you want to use PortAudio in.
For example: gcc -o test test.c -lportaudio
I just figured out how to do this today, so I may have accidentally forgotten a few steps.

Related

Why can my C program run in "git bash", but not in "cmd"?

I wrote a demo using libpq to connect to a PostgreSQL database.
I tried to connect the C file to PostgreSQL by including
#include <libpq-fe.h>
after I added the paths into system variables I:\Program Files\PostgreSQL\12\lib as well as to I:\Program Files\PostgreSQL\12\include and compiled with this command:
gcc -Wall -Wextra -m64 -I "I:\Program Files\PostgreSQL\12\include" -L "I:\Program Files\PostgreSQL\12\lib" testpsql.c -lpq -o testpsql
It first raised three errors, like
libssl-1_1-x64.dll is missing
libintl-8.dll was missing
libcrypto-1_1-x64.dll was missing
After I downloaded these three files and put them into I:\Program Files\PostgreSQL\12\lib, and compiled it again, it shows the error
The application was unable to start correctly (0xc0150002)
when I type testpsql. But if I type ./testpsql on git bash, it works. Anyone can please tell me why?
The code that I used was the first example from here.
Environment: PostgreSQL 12, Windows 10, MinGW64
“Download the DLL files” sounds dangerous. From where?
I would get rid of these files again. Since you probably don't reference these libraries from your code, it must be the dependencies of libpq.dll and are probably found in I:\Program Files\PostgreSQL\12\bin (if you used the EDB installer).
The problem is probably that you the PATH environment variable is different in git bash and in cmd.exe, and in the latter case not all required shared libraries can be found on the PATH. The solution is to change the PATH so that it includes all DLL files the executable requires, not to start copying around files.
It is probably enough to include I:\Program Files\PostgreSQL\12\bin in the PATH. To resolve missing dependencies, use a tool like dependency walker or this replacement.

FFmpeg: building example C codes

I have configured and compiled the FFmpeg library using this link:
https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
Now, I am trying to build example C codes provided by FFmpeg from here:
https://github.com/FFmpeg/FFmpeg/tree/master/doc/examples
However, when I run make install-examples or make install (suggested by /example/README), I receive this kind of message:
make: *** No rule to make target '/doc/examples/README', needed by
'install-examples'. Stop.
I thought this may be due to the rules not being in the correct MakeFile format (I am not sure why they refers to README). How should I go about in fixing this and compiling the example codes? I have tried to find solutions about this, but there doesn't seem to be much information online.
Thank you.
Run ./configure && make -j4 examples in the FFmpeg source directory, then look in doc/examples for the compiled examples.
Requires make and pkg-config.
To remove the compiled examples use make examplesclean in the FFmpeg source directory.
nasm/yasm not found or too old. Use --disable-x86asm for a crippled build. If you think to configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to theffmpeg-user#ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.Include the log file "ffbuild/config.log" produced by configure as this will help solve the problem.
If you see this when you execute the above command then do this
macOS:
brew install yasm
Ubuntu:
sudo apt-get install yasm

bsd-finger won't Make correctly

I ran across an interesting issue. My system is Arch Linux (latest) on an ASUS laptop. Now, the really weird issue:
finger is not automatically installed with Arch. I attempted to use pacman to install it, and it's not in the repositories. It IS in the AUR.
I downloaded the AUR file, un-tarred the tar with tar -xvf bsd-finger0.17.tar.gz. This created the directory folder with the same name. I ran ./configure which gave the expected output:
` /usr/man
Looking for a C compiler... gcc
Checking if gcc accepts gcc warnings... yes
Checking if gcc accepts -O2... yes
Checking for socklen_t... yes
Checking for snprintf declaration... ok
Checking for snprintf implementation... ok
Generating MCONFIG...`
Then I tried to make, and got this weird tidbit: http://pastebin.com/0qACttCu
So, it looks like it's having weird compiling issues. Any ideas on what's up here?
I have no idea what AUR is, but it seems you are not using it the way it is supposed to be used.
https://wiki.archlinux.org/index.php/Arch_User_Repository#Build_and_install_the_package
That wiki says that you should build an AUR package with "makepkg"
But anyway looking at
https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=netkit-bsd-finger
It seems you just need to add time.h as include to two files and it should compile.

Compile C code on Mac

I am trying to compile this interesting program on my mac. The program can make your terminal looks like the one in Matrix movie. Here is the link.
But when I type "make" and press enter in the upzipped source code folder, here is the error:
make: *** No targets specified and no makefile found. Stop.
I am not very familiar with things that need to compile. I know the concept of compilation and c/c++, but have little practical experience. Is it possible to compile this code on mac? If it is easy, can you tell me how I can compile this code from the above link?
Go to the folder of your source code with terminal and type ./configure and hit enter. Then call make.
The package uses the autoconf tools to generate the Makefile(s) required to build the cmatrix application.
In order to generate the makefiles, you need to run the configure script:
$ ./configure
If you have a look at the INSTALL file, it should provide some additional information, such as additional arguments that you may need to pass into the configure script for your platform.
Once the configure script has run, you can run make as normal, and it should compile the application.

How to fix C program error for Openmpi with netbeans running on ubuntu 12.04

I am trying to run a MPI program with C language.
I have installed GCC compiler and the openmpi libraries. I am running ubuntu Linux and Netbeans IDE. My challenge is that after including ‘mpi.h’ in my header file and compiling the application, I still get ‘fatal error : cannot find file mpi.c’. I have the files in home/user/lib/openmpi/include, but I cant get it too work.
Can anyone help?
You could try to change the compiler to /path/mpicc and the debugger to mpirun. This should work, although I did not test it, but probably the best way to compile MPI code is via terminal.
If you really depend on the IDE you cound try writing your code with it (to take advantage of auto-completion and such) and compile it in terminal using mpicc -o main.exe main.cpp [other .cpp files] and run it with mpirun -np number_of_processes_to_use ./main.exe [args]. You could write a small script or a Makefile to do it all in one command.
Good luck!
to save yourself some sanity, I'd recommend opening up a terminal and going from there (at least until you figure out what's what).
Also, using the mpi compiler to do things would simplify your life. (and likely automatically solve the missing source issue, as it should know where they are by default).
If you still can't locate them during compile then I'd look at adding the location where mpi.c & mpi.h are located to your C Include Path: How to add a default include path for gcc in linux?

Resources