Allegro 5 and FreeBASIC - windows

I cannot find a way to make Allegro5 work with FreeBasic on Windows.
I downloaded and installed FreeBASIC-1.05.0-win32.exe.
I downloaded Allegro binaries allegro-5.0.10-mingw-4.7.0.
The version of fbc installed is the standalone one.
I created allegrolibs folder and copied these libraries from the Allegro distribution to allegrolibs:
liballegro_5.0.10-md.a
liballegro_font-5.0.10-md.a
liballegro_ttf-5.0.10-md.a
I added the necessary allegro dlls from the Allegro distribution to examples/graphics/allegro:
allegro_font-5.0.10-md.dll
allegro_ttf-5.0.10-md.dll
allegro-5.0.10-md.dll
I run fbc from the command line, trying to compile hello.bas from examples/graphics/allegro5:
fbc -s gui -p allegrolibs examples/graphics/allegro5/hello.bas
The program compiled just fine.
However, at runtime hello.exe shows me this error:
The program can't start because libgcc_s_dw2_1.dll is missing from your computer.
Copy libgcc_s_dw2_1.dll from FreeBASIC\bin\win32 to the folder where hello.exe resides, then run:
The program can't start because libstdc++-6.dll is missing from your computer.
Add libstdc++-6.dll from a ming4.7.0 binary distribution then run:
The program can't start because libgcc_s_sjlj-1.dll is missing from your computer.
Add libgcc_s_sjlj-1.dll from ming4.7.0 binary distribution then run:
The program can't start because libwinpthread-1.dll is missing from your computer.
Add libwinpthread-1.dll from ming4.7.0 binary distribution then run:
The procedure entry point __gxx_personality_v0 could not be located
in the dynamic link library libstd++-6.dll.
At this point I'm stuck. What is it that I'm doing wrong? Anybody who tried the same and was able to solved it is willing to help with the issue?

allegro-5.0.10-mingw-4.7.0 binary for Windows was compiled with mingw-4.7.0 compiler.
freeBASIC was compiled with a mingw-w64 compiler.
But as far as dynamic linking, they can work together.
The binary package for Windows allegro-5.0.10-mingw-4.7.0 contains among many other things two files:
allegro-5.0.10-monolith-mt.dll
liballegro-5.0.10-monolith-mt.a
Either of them can be used to link Allegro 5 library to the exe:
Copy allegro-5.0.10-monolith-mt.dll or liballegro-5.0.10-monolith-mt.a in allegrolib folder.
Modify allegro.bi, allegro_font.bi, allegro_ttf.bi replacing line 35 with:
#inclib "allegro-5.0.10-monolith-mt"
Run from the console:
fbc -s gui -p allegrolib examples/graphics/allegro5/hello.bas
allegro-5.0.10-monolith-mt.dll needs to be placed in the same folder with hello.exe.

Related

How to generate .lib files using dlltool on Windows 10?

I want to install the FFTW library in my system which is running on Windows 10. My compiler is minGW GCC 10.1 and I am using Code Blocks.
I have downloaded the 64-bit version fftw-3.3.5-dll64.zip from http://www.fftw.org/install/windows.html and then opened the command window as adminstrator and set my directory to the bin folder of the mingw64 so that I can run dlltool.
However, when I type the command dlltool -d libfftw3-3.def I am getting the error dlltool: Can't open def file: libfftw3-3.def
I guess this is happening because the libfftw3-3.def file is inside the FFTW folder and cannot be seen by the dlltool. Is that right? What should I do?
Actually the reason seems to be rather obvious. As I wrote in my question the files libfftw3-3.def, libfftw3f-3.def and libfftw3l-3.def are located inside the FFTW folder (wherever might that be in your case). I copied an pasted them inside the bin folder of the mingw64 compiler and then executed the following commands:
dlltool -d libfftw3-3.def
dlltool -l libfftw3-3.lib
Then repeated the process for the other two .def files.

compile gopacket on windows 64bit

I am trying to use gopacket on my windows 10.
I'm using it to sniff and inject packets directly to/from the NIC.
I can easily compile and run my code with GOARCH=386 but can't in GOARCH=amd64.
Worth noticing: I am NOT trying to cross-compile.
I'm using go1.6.windows-386 to compile the 32bit version and when I try to compile with GOARCH=amd64 I use go1.6.windows-amd64.
I used TDM-GCC as linux like compile tools.
The error isn't indicative. it just says
c:/WpdPack/Lib/x64/wpcap.lib: error adding symbols: File in wrong format
collect2.exe: error ld returned 1 exit status
Did anyone manage to build this, if it's even possible?
OK so I have figured it out.
In order to compile gopacket 64bit on windows you need to do the following:
Install go_amd64 (add go binaries to your PATH)
Install TDM GCC x64 (add TDM-GCC binaries to your PATH)
Also add TDM-GCC\x86_64-w64-mingw32\bin to your PATH
Install Winpcap
Download Winpcap developer's pack and extract it to C:\
Now the point is that there are missing linux static libraries files
(libwpcap.a and libpacket.a) from lib/x64 folder. I don't know why they weren't
included in the developers pack but anyway that's how we can generate them:
find wpcap.dll and packet.dll in your PC (typically in c:\windows\system32
copy them to some other temp folder or else you'll have to supply Admin privs to the following commands
run gendef on those files gendef wpcap.dll and gendef packet.dll (obtainable with MinGW Installation Manager, package mingw32-gendef)
this will generate .def files
Now we'll generate the static libraries files:
run dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib libwpcap.a --input-def wpcap.def
and dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib libpacket.a --input-def packet.def
Now just copy both libwpcap.a and libpacket.a to c:\WpdPack\Lib\x64
That's it.
Now gopacket should compile with no problems.
Thank you so much for the solution, it saved me a lot of time!
Just wanted to add that you can do the same with Npcap, modify the gopacket source code to point to Npcap and it will work too.
In case you don't know Npcap:
https://nmap.org/npcap/vs-winpcap.html
https://nmap.org/npcap/
I installed Npcap on Windows in "Wpcap API Compatibility Mode" and gopacket now works fine.

Gstreamer on windows

I'd like to build application using Gstreamer 1.0 and GTK+-3.0 on Windows 8 (64bit).
I have sucessfully install and build GTK+-3.0, 32 bit version using Dev-C++ and Mingw 32-bit (there is no 64 bit version of GTK+). Everything works perferkt. It also installed pkg-config, I addeded it in %PATH% and it works.
I have installed gstreamer-1.0-devel-x86-1.4.4.msi and gstreamer-1.0-x86-1.4.4.msi from here
1) First problem: it installed itself into I:\gstreamer\ without asking me. I am very unhappy about it, I'd like have it on C:. But its not the biggest problem.
2) pkg-config do not know about gstreamer. I have found in I:\gstreamer\1.0\x86\lib\pkgconfig\ *.pc files, so I looked into gstreamer-1.0.pc and added to my projekt this options:
C compiler:
-I"I:/gstreamer/1.0/x86/include/gstreamer-1.0/"
Linker:
-L"I:/gstreamer/1.0/x86/lib" -lgstreamer-1.0
3) Now the program was compiled, but when I run it, it was not able to find gstreamer-1.0-0.dll. So i tried copy I:\gstreamer\1.0\x86\bin\gstreamer-1.0-0.dll into to the same directory as is my compiled file. Then it was not able to find libwinptread-1.dll. So I copied it also.
Then te program run, but it faild with some error like "cannot find entry point to windows thread ..." (I do not remember it exactly). So I copied ALL dll files from I:\gstreamer\1.0\x86\bin\ and then finally the program run.
But now it is not able to create elements:
source = gst_element_factory_make ("videotestsrc", "source");
//source is null
So, my question is, how to install gstreamer, that my program will find all dll files and will be able to create elements?
installing -- choose "custom install", there you can change the installation path.
for vs you can use *.props (gstreamer\1.0\x86\share\vs\2010\libs)
you need set Environment variable - GST_PLUGIN_SYSTEM_PATH_1_0 to plug-ins. For more details see http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gst-running.html

Is it possible to set up GStreamer for use in MinGW, similar to how it's done in Linux?

Apologies for the tardy title, I'm not quite sure how to phrase this question. At its most basic, I'm attempting to compile a program with GStreamer. When running the configure script for said program I get the following error:
0:20.39 configure: checking for gstreamer-1.0 >= 1.0
0:20.39 gstreamer-app-1.0
0:20.39 gstreamer-plugins-base-1.0
0:20.39 configure: error: gstreamer and gstreamer-plugins-base development pack
ages are needed to build gstreamer backend. Install them or disable gstreamer su
pport with --disable-gstreamer
The build environment I'm compiling in:
Windows 7 (64-Bit)
MINGW & MSYS
Visual C/C++ 2010 SP1 (command line)
Now if this error occurred on a Linux distro, - say Ubuntu - it could be remedied by running the following commands:
apt-get install libgstreamer-plugins-base1.0-dev
apt-get install libgstreamer1.0-dev
What is the equivalent for Windows? I've found two type of versions that can be used: The gstreamer bin from the developer website, which has the following structure:
bin
include
lib
share
And a dynamic library of gstreamer for mingw with the following structure:
bin
lib
How am I supposed to let mingw/msys know that the gstreamer library is installed? Do I place the folders above in the relevant MSYS directories? Then, how does the configure know that it's installed and ready to be used?
I hope what I'm asking makes sense, please let me know if anything is confused. Cheers!
Using the first solution (official binaries from GStreamer), you need to tell the configure script where everything is located.
The simplest way is to set the environment variable PKG_CONFIG_PATH to where the .pc files are located. Generally it's in
$install_directory/lib/pkgconfig/
Replace $install_directory with the actual location, ex if it's installed in /c/GStreamer :
PKG_CONFIG_PATH=/c/GStreamer/lib/pkgconfig ./configure
That should make configure figure out everything

How do I run a program linked against a DLL in MSYS?

I've successfully built a demo app using opencv on windows with the MSYS shell environment.
I did NOT use the prebuilt opencv installer, I downloaded and compiled the source locally (this is the recommended method).
After building opencv and running make install, all the files are happily in:
/e/deps/libopencv/build/install/
I can successfully build a sample application against this using cmake directives along the lines of:
find_package(OPENCV REQUIRED)
link_directory(${OpenCV_LIB_DIR})
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(target ${OpenCV_LIBS})
To be completely clear here: building the binary is successful.
Now, when I run it from the shell I get the message:
The program can't start because libopencv_core231.dll is missing from your computer.
Try reinstalling the program to fix this problem.
So... I know where the libraries are:
$ ls /e/deps/libopencv/build/install/lib/
libopencv_calib3d231.dll.a libopencv_features2d231.dll.a libopencv_highgui231.dll.a libopencv_ml231.dll.a libopencv_video231.dll.a
libopencv_contrib231.dll.a libopencv_flann231.dll.a libopencv_imgproc231.dll.a libopencv_objdetect231.dll.a
libopencv_core231.dll.a libopencv_gpu231.dll.a libopencv_legacy231.dll.a libopencv_ts231.a
What now?
I guess I could try to make cmake build a static binary, but that seems pretty extreme.
How can I somehow make either 1) windows, or 2) the MSYS environment happy. Something like LD_LIBRARY_PATH on windows?
Or is this not the problem, and I've actually (despite appearances) somehow messed up the way the binary was compiled?
Edit:
NB. For whatever reason it seems that my libraries are .dll.a files, not .dlls (see the ls result) if that's remotely relevant.
windows searches the same directory as the exe, any directory in the %PATH% (Windows) or $PATH (msys) directories, as well as a few special ones in the windows folder
You could add /e/deps/libopencv/build/install/lib to your $PATH. I am not sure if this will work for msys, you may need to add E:\deps\libopencv\build\install\lib to %PATH% in windows instead.
The typical solution for this if you are giving the program to others is to include a copy of the DLL in the same directory as the EXE. you can get this same effect by making a symbolic link to it with the command
ln -s /e/deps/libopencv/build/install/lib/libopencv_core231.dll libopencv_core231.dll
while in the /e/deps/libopencv/build/install/ directory

Resources