help installing libpcap on cygwin - cygwin

i was trying to install libpcap under cygwin on windows 7 but i had this error:
$ ./configure
.
.
.
.
.
configure: error: see the INSTALL for more info
how can i solve this?
i am using libpcap-1.0.0 which is the latest version.

http://mathieu.carbou.free.fr/wiki/index.php?title=How_to_install_Winpcap_/_Libpcap_under_Cygwin
libpcap develop pack can be found from
http://www.winpcap.org/devel.htm
steps in detail as follows:
Setup Winpcap
Download and unzip the pack. We will use for this example WpdPack_4_0_1.zip.
Copy libraries like this:
WpdPack\Lib\libpacket.a to cygwin\lib\
WpdPack\Lib\libwpcap.a to cygwin\lib\
Create a folder cygwin\usr\include\pcap\
Copy all headers from WpdPack\Include to cygwin\usr\include\winpcap\
Be sure you have installed Winpcap libraries and that they are in your path by typing:
which packet.dll
which wpcap.dll
For me they are in /cygdrive/c/WINDOWS/system32/
Building example using Cygwin
Open a cygwin prompt to WpdPack\Examples-pcap\basic_dump\ and execute:
basic_dump:
CFLAGS="-g -Wall -mno-cygwin -I /usr/include/pcap"
LIBS="-lwpcap"
PROG="basic_dump"
gcc $CFLAGS -c $PROG.c
gcc $CFLAGS -o $PROG.exe $PROG.o $LIBS
./$PROG.exe
basic_dump_ex:
CFLAGS="-g -Wall -mno-cygwin -I /usr/include/pcap"
LIBS="-lwpcap"
PROG="basic_dump_ex"
gcc $CFLAGS -c $PROG.c
gcc $CFLAGS -o $PROG.exe $PROG.o $LIBS
./$PROG.exe
iflist:
CFLAGS="-g -Wall -mno-cygwin -I /usr/include/pcap"
LIBS="-lwpcap"
PROG="iflist"
gcc $CFLAGS -c $PROG.c
gcc $CFLAGS -o $PROG.exe $PROG.o $LIBS
./$PROG.exe
pcap_filter (and others):
I think you can catch the pattern ;) Only replace PROG=... by the program name and it should compile.
UDPdump:
CFLAGS="-g -Wall -mno-cygwin -I /usr/include/pcap"
LIBS="-lwpcap -lwsock32"
PROG="UDPdump"
gcc $CFLAGS -c $PROG.c
gcc $CFLAGS -o $PROG.exe $PROG.o $LIBS
./$PROG.exe
You can test by doing a Time Synchronization with pool.ntp.org for
example.

The libpcap source includes part, but not all, of the Windows support. The mechanisms used to capture network traffic are very OS-dependent (which is why libpcap exists - to hide that detail from applications).
On UN*Xes, the mechanism is part of the OS, so libpcap doesn't have to provide that mechanism.
On Windows, there's no such mechanism in the OS, so WinPcap combines a kernel-mode driver, a low-level library that talks to the driver, and a module for libpcap that uses the low-level library.
The libpcap source doesn't include the driver or the low-level library, so it's not sufficient to build a version of libpcap for Windows.
As the other answers indicate, you need WinPcap.

I know this is a late reply, but I just went through the same install issues on Windows 7.
On Windows, you should use Winpcap: http://www.winpcap.org/

Related

threading.h:10:24: fatal error installation error

Fairly unknowledgable linux (ubuntu 14.04) user here. I'm trying to install a bioinformatics program called Bowtie2 - I get this error and not sure where it's coming from. They did quote this on their website which might have something to do with it, but didn't mention it as a dependency.
TBB is now the default threading library. We consistently found TBB to
give superior thread scaling. It is widely available and widely
installed. That said, we are also preserving a "legacy" version of
Bowtie that, like previous releases, does not use TBB. To compile
Bowtie source in legacy mode use NO_TBB=1. To use legacy binaries,
download the appropriate binary archive with "legacy" in the name.
sam#SumnerLab-Computer:~/Program_Files/bowtie-1.2$ make
g++ -w -O3 -m64 -DCOMPILER_OPTIONS="\"-O3 -m64 -Wl,--hash-style=both -DWITH_TBB -DPOPCNT_CAPABILITY -DNO_SPINLOCK -DWITH_QUEUELOCK=1 \"" -Wl,--hash-style=both -DWITH_TBB -DPOPCNT_CAPABILITY -DNO_SPINLOCK -DWITH_QUEUELOCK=1 \
-fno-strict-aliasing -DBOWTIE_VERSION="\"`cat VERSION`\"" -DBUILD_HOST="\"`hostname`\"" -DBUILD_TIME="\"`date`\"" -DCOMPILER_VERSION="\"`g++ -w -v 2>&1 | tail -1`\"" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DPREFETCH_LOCALITY=2 -DBOWTIE_MM -DBOWTIE_SHARED_MEM -DNDEBUG -Wall \
-I SeqAn-1.1 -I third_party -I third_party \
-o bowtie-build-s ebwt_build.cpp \
ccnt_lut.cpp ref_read.cpp alphabet.cpp shmem.cpp edit.cpp ebwt.cpp bowtie_build_main.cpp \
-lpthread -ltbb -ltbbmalloc_proxy
In file included from pat.h:17:0,
from sequence_io.h:12,
from multikey_qsort.h:8,
from diff_sample.h:8,
from blockwise_sa.h:13,
from ebwt.h:27,
from ebwt_build.cpp:11:
threading.h:10:24: fatal error: tbb/mutex.h: No such file or directory
compilation terminated.
Makefile:259: recipe for target 'bowtie-build-s' failed
make: *** [bowtie-build-s] Error 1
Any ideas what the issue might be?
thanks
You'll probably need to install the package TBB development package, e.g. libtbb-dev.
On Ubuntu, run sudo apt-get install libtbb-dev
​sudo apt-get install libtbb-dev
​make

Compiling program with Open Source libFTDI

I use Asus router (based on ARMv7 proc) with Advanced Tomato installed
on it as my ARMv7 developer platform. I install compiler (gcc - 5.4.0-1)
plus dependencies and libFTDI (libftdi1 - 1.3-1) from OpenWRT Linux
repo. OpenWRT does not provide libftdi-dev so I copied ftdi.h file from libFTDI download page to /opt/include directly. I try to compile program taken directly from libFTDI samples. The
compiler command is:
gcc -v -Wl,-rpath=/opt/usr/local/lib -Wl,--dynamic-linker=/opt/lib/ld-linux.so.3 -L/opt/lib -O2 -pipe -march=armv7-a -mtune=cortex-a9-fno-caller-saves -mfloat-abi=soft -l ftdi1 d.c -o d
But compilation fails because:
/opt/bin/ld: cannot find -lftdi1
But there is /opt/usr/local/lib/libftdi1.so linked to libftdi1.so.2
My LD_LIBRARY_PATH looks like this:
/lib:/usr/lib:/usr/local/lib:/opt/lib:/opt/usr/lib:/opt/include:/opt/usr/local/lib:/opt/usr/include
So what the problem is?
I dont know why (probably bug) but for compiler taken from OpenWRT repo, MUST have wanted library in /opt/lib. So simply copy libftdi1.so.2.3.0 file and linking it to libftdi1.so resolved problem. That means that it does not use correctly LD_LIBRARY_PATH variable. Finally compilation command looks like this:
gcc -v -Wl,-rpath=/opt/usr/local/lib -Wl,--dynamic-linker=/opt/lib/ld-linux.so.3 -L/opt/lib -O2 -pipe -march=armv7-a -mtune=cortex-a9 -fno-caller-saves -mfloat-abi=soft -l ftdi1 arco.c -o arco
From my point of view - topic closed

Preparing GNU toolchain for bare metal ARM on Linux

I would like to prepare GNU toolchain for bare metal ARM to use it with Geany IDE. There are some tutorials like this one: Building the GNU ARM Toolchain for Bare Metal but I do not understand few steps.
First of all, everyone who uses Linux OS implicitly has gcc, binutils and gdb so why to download others? Secondly all tutorials tell me to configure gcc with something like that: *./configure --target=arm-elf. What does it even do ? Does it just force me to call gcc in command line using arm-elf-gcc instead of gcc or does it change some internal options of my gcc ?
So far I have prepared makefile but I am still not sure about compiler options. I have not changed any gcc configure options and I call compiler with such flags:
CFLAGS = -Wall -std=c99 -march=armv7-m -mtune=cortex-m0
Can I prepare toolchain just with calling gcc with proper arguments or do I need to make some changes in gcc configuration ?
GCC and its target
GCC is always configured to emit binaries for a specific target. So normally the gcc which is already available on Linux has the target "i486-linux-gnu". You can't cross-compile to an ARM target using this compiler.
So you need to install another GCC configured for that target; then GCC and the other programs normally have a prefix indicating the target: In your case the prefix is arm-none-eabi, and then you call that GCC using arm-none-eabi-gcc. You can have multiple GCC installations, they do not interact (if they interact, you have probably screwed up something - always install in separate directories, if you do it manually).
Installing
If your Linux distribution provides a package, you could just install that one (on Debian this is "gcc-arm-none-eabi").
You can download a pre-compiled package: GNU Tools for ARM Embedded Processors.
You can try to compile one. Not really easy, if you want correct multi-libs.
If your Linux distribution provides a package > 4.8.0, you should try that one.
If you want to have multiple versions installed (and be able to switch between them easily), the second option is possibly better. I stopped compiling a GCC for ARM when the second option was available.
Cross-compiling
In your Makefile you have to make sure that the cross-compiler is used. You could use $(CC) in your Makefile, and assign it like this:
TOOLCHAIN = arm-none-eabi-
CC = $(TOOLCHAIN)gcc
Compiler flags for Cortex-M0 are -mcpu=cortex-m0 -mthumb -mfloat-abi=soft which is by convention assigned to CFLAGS
CFLAGS += -mcpu=cortex-m0 -mthumb -mfloat-abi=soft
Then a (simple) rule to compile .c to .o looks like
%.o: %.c
$(CC) $(CFLAGS) -o $# -c $<
Tutorials which use the arm-elf- prefix are out-dated. Currently arm-none-eabi- is in use.

why uboot used arm-linux-gcc for default arm CROSS_COMPILE?

i am very strange about the toolchains, arm-eabi-gcc, arm-linux-gcc, and arm-elf-gcc.
For arm-linux-gcc and arm-elf-gcc, in my opinion, just used the different the libc.
But what's the difference between arm-eabi-gcc and arm-linux-gcc ?
i regard that arm-eabi-gcc dont built in the libc. Am i right ?
if not, could you help to correct me ?
And also why uboot used arm-linux-gcc for the default arm cross compiler ?
As i know, the uboot dont need that libc for dependency.
so that is my problem.
thx!
It's called the target alias or the target-triplet of the toolchain what it's for, basically, is to identify that toolchain from other toolchains and from the native one you have. It tells you what architecture, ABI and target host the toolchain is built for, example:
arm-none-gnueabi: bare metal (no operating system) gnu ABI
arm-linux-eabi: produces binaries for a hosted system (running a Linux environment)
The GCC compiler *gcc is a driver program running other programs. So run
arm-linux-gcc -v -O -Wall helloworld.c -o hellworld-linux-gcc
arm-elf-gcc -v -O -Wall helloworld.c -o hellworld-elf-gcc
arm-eabi-gcc -v -O -Wall helloworld.c -o helloworld-eabi-gcc
and you'll understand the differences. They probably all run some cc1 program doing the translation to assembly code, some as program doing the assembling of assembler code to object code, some ld program doing the linking with some standard libraries. They may also run some collect2 wrapping some linking etc etc.
You may also want to run simply arm-linux-gcc -v or arm-elf-gcc -v or arm-eabi-gcc -v to understand how your compilers have been configured, and their precise version.

build android adb for arm processor

I want to use Android ADB tool on ARM platform. One of the commands in the build script is:
arm-eabi-g++
-I build/libs/host/include/host
-I build/libs/host/include
-I build/libs/host
-I out/host/linux-arm/obj/STATIC_LIBRARIES/libhost_intermediates
-I dalvik/libnativehelper/include/nativehelper
-I system/core/include
-I hardware/libhardware/include
-I hardware/libhardware_legacy/include
-I hardware/ril/include
-I dalvik/libnativehelper/include
-I frameworks/base/include
-I frameworks/base/opengl/include
-I frameworks/base/native/include
-I external/skia/include
-I tools/include
-I out/host/linux-arm/obj/include
-I prebuilt/ndk/android-ndk-r5b/platforms/android-9/arch-arm/usr/include
-c -fno-exceptions -Wno-multichar -fPIC
-include system/core/include/arch/linux-arm/AndroidConfig.h
-D_FORTIFY_SOURCE=0
-DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -O2 -g -fno-strict-aliasing -DNDEBUG -UDEBUG
-DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -Wsign-promo -DNDEBUG -UDEBUG
-MD -o out/host/linux-arm/obj/STATIC_LIBRARIES/libhost_intermediates/pseudolocalize.o
build/libs/host/pseudolocalize.cpp
I have made sure I have the latest ndk-r5b installed, which is supposed to resolve the STL problem. However, I am still getting the following error:
In file included from build/libs/host/pseudolocalize.cpp:1:
build/libs/host/include/host/pseudolocalize.h:4:18: error: string: No such file or directory
In file included from build/libs/host/pseudolocalize.cpp:1:
build/libs/host/include/host/pseudolocalize.h:6: error: 'string' in namespace 'std' does not name a type
build/libs/host/pseudolocalize.cpp: In function 'const char* pseudolocalize_char(char)':
build/libs/host/pseudolocalize.cpp:61: error: 'NULL' was not declared in this scope
build/libs/host/pseudolocalize.cpp: At global scope:
build/libs/host/pseudolocalize.cpp:71: error: 'string' does not name a type
Does anyone know how to fix this problem? BTW the building of the intel version of adb works fine by following this link:
http://lackingrhoticity.blogspot.com/2010/02/how-to-build-adb-android-debugger.html
pseudolocalize.cpp is not needed for adb. And NDK toolchain is intended to build with bionic(Android libc). adb requires glibc(GNU libc) to build.
I created a Makefile to compile adb for Linux/ARM. This Makefile makes statically linked adb executable binary for Linux/ARM, thus it works on Android/ARM as well.
standalone Makefile for adb
How to make.
Install Sourcery G++ Lite for ARM and GNU Make.
Download "Android source code".
Save Makefile as system/core/adb/Makefile.
cd system/core/adb; make.
If you need to build the ADB (version 1.0.31) for ARM take a look here.
The repository contains an all-in-one build script and also a pre-compiled binary for ARM.
I see the post is quite old, anyway it helped me.
I did not found
"Sourcery G++ Lite for ARM and GNU Make."
But manage to build/run on/for my ARMv7, following the other steps with gcc 4:4.6.3-1ubuntu5
N/A
Download "Android source code".
Save Makefile as system/core/adb/Makefile.
3b. Edit Makefile to CC= gcc and LD= gcc
cd system/core/adb; make.
You can simply run the command
sudo apt install adb
it can handle ARM architecture

Resources