Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

./libpcap/version:1:1: error: expected unqualified-id #1586

Open
eakteam opened this issue May 6, 2019 · 12 comments

Comments

Projects
None yet
2 participants
@eakteam
Copy link

commented May 6, 2019

Everytime i trying to compile it throws this error :
./libpcap/version:1:1: error: expected unqualified-id

I think is something wrong with /libpcap/VERSION file

@guyharris

This comment has been minimized.

Copy link

commented May 10, 2019

Everytime i trying to compile it

"It" meaning libpcap?

Do you really mean

./libpcap/version:1:1: error: expected unqualified-id

or do you mean

./libpcap/version.h:1:1: error: expected unqualified-id

because libpcap never includes a file named just "version".

Presumably you're compiling this as part of Npcap; the only place where libpcap includes a version.h file is if you're building as part of WinPcap or Npcap.

If I do a Google search for "error: expected unqualified-id", most of the hits I get on the first page are for C++ compilers; are you getting that error from a C compiler?

@eakteam

This comment has been minimized.

Copy link
Author

commented May 10, 2019

@guyharris
Yes i really mean : ./libpcap/version:1:1: error: expected unqualified-id

I am trying to configure & make with Android NDK and in Nmap source after download as full zip if you take a look at /libcap folder inside root folder there is a file "VERSION". I am sure that something wrongs there because when i change this file contents it it throws different error...

So something, is reading (parsing) it but fails. I can't explain with more details, but i can share full error log.

@guyharris

This comment has been minimized.

Copy link

commented May 10, 2019

I am trying to configure & make with Android NDK

So you're building for Bionic/Linux (:-)), not for Windows?

Are you trying to build this on Windows or macOS? If you're building on Linux, "VERSION" and "version" should be different files.

@eakteam

This comment has been minimized.

Copy link
Author

commented May 10, 2019

@guyharris

This comment has been minimized.

Copy link

commented May 10, 2019

Why are you trying to build a Windows version of libpcap (Npcap) for Android?

Npcap is standard libpcap plus the Npcap driver for Windows (which won't work on Android or any other flavor of UN*X) plus the Npcap DLL for that driver (which also won't work on Android, because the driver won't work on Android).

If you want libpcap for Android, download libpcap and try to build that.

@eakteam

This comment has been minimized.

Copy link
Author

commented May 13, 2019

@guyharris thanks for your explanation, i will try that and get back here. i just tried to compile for Android (linux) what is inside the zip project downloaded from Github

@guyharris

This comment has been minimized.

Copy link

commented May 13, 2019

@guyharris thanks for your explanation, i will try that and get back here. i just tried to compile for Android (linux) what is inside the zip project downloaded from Github

There is no reason whatsoever to try to compile Npcap for Linux. Try downloading libpcap from the tcpdump.org Web site.

If you have issues with libpcap, do NOT reply here; this is not a site for libpcap, it's a site for Nmap and related projects such as Npcap. Issues with libpcap should be filed on libpcap's issue page on GitHub.

@eakteam

This comment has been minimized.

Copy link
Author

commented May 13, 2019

@guyharris hi again , i think this is not problem with Npcap. Please look at the errors generated after trying to make (configure completes successfully) :

arm-linux-androideabi-clang++ -c -I./liblinear -DNOLUA -I./libdnet-stripped/include -I./libpcre  -I./libpcap -I./nbase -I./nsock/include -DHAVE_CONFIG_H -DNMAP_NAME=\"Nmap\" -DNMAP_URL=\"https://nmap.org\" -DNMAP_PLATFORM=\"aarch64-unknown-linux-android\" -DNMAPDATADIR=\"/data/opt/share/nmap\" -D_FORTIFY_SOURCE=2 -fvisibility=default -Wall -fno-strict-aliasing   charpool.cc -o charpool.o
arm-linux-androideabi-clang++ -c -I./liblinear -DNOLUA -I./libdnet-stripped/include -I./libpcre  -I./libpcap -I./nbase -I./nsock/include -DHAVE_CONFIG_H -DNMAP_NAME=\"Nmap\" -DNMAP_URL=\"https://nmap.org\" -DNMAP_PLATFORM=\"aarch64-unknown-linux-android\" -DNMAPDATADIR=\"/data/opt/share/nmap\" -D_FORTIFY_SOURCE=2 -fvisibility=default -Wall -fno-strict-aliasing   FingerPrintResults.cc -o FingerPrintResults.o
In file included from FingerPrintResults.cc:133:
In file included from ./FingerPrintResults.h:138:
In file included from ./FPEngine.h:138:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/vector:270:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/__bit_reference:15:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/bit:24:
./libpcap/version:1:1: error: expected unqualified-id
1.7.3
^
In file included from FingerPrintResults.cc:133:
In file included from ./FingerPrintResults.h:138:
In file included from ./FPEngine.h:138:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/vector:270:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/__bit_reference:16:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/algorithm:640:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/initializer_list:47:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/cstddef:38:
./libpcap/version:1:1: error: expected unqualified-id
1.7.3
^
In file included from FingerPrintResults.cc:133:
In file included from ./FingerPrintResults.h:138:
In file included from ./FPEngine.h:138:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/vector:270:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/__bit_reference:16:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/algorithm:641:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/type_traits:407:
./libpcap/version:1:1: error: expected unqualified-id
1.7.3
^
In file included from FingerPrintResults.cc:133:
In file included from ./FingerPrintResults.h:138:
In file included from ./FPEngine.h:138:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/vector:270:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/__bit_reference:16:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/algorithm:643:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/utility:206:
./libpcap/version:1:1: error: expected unqualified-id
1.7.3
^
In file included from FingerPrintResults.cc:133:
In file included from ./FingerPrintResults.h:138:
In file included from ./FPEngine.h:138:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/vector:270:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/__bit_reference:16:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/algorithm:644:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/memory:654:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/typeinfo:61:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/exception:84:
./libpcap/version:1:1: error: expected unqualified-id
1.7.3
^
In file included from FingerPrintResults.cc:133:
In file included from ./FingerPrintResults.h:138:
In file included from ./FPEngine.h:138:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/vector:270:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/__bit_reference:16:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/algorithm:644:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/memory:657:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/new:94:
./libpcap/version:1:1: error: expected unqualified-id
1.7.3
^
In file included from FingerPrintResults.cc:133:
In file included from ./FingerPrintResults.h:138:
In file included from ./FPEngine.h:138:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/vector:270:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/__bit_reference:16:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/algorithm:644:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/memory:660:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/iterator:421:
./libpcap/version:1:1: error: expected unqualified-id
1.7.3
^
In file included from FingerPrintResults.cc:133:
In file included from ./FingerPrintResults.h:138:
In file included from ./FPEngine.h:138:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/vector:270:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/__bit_reference:16:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/algorithm:644:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/memory:663:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/tuple:144:
./libpcap/version:1:1: error: expected unqualified-id
1.7.3
^
In file included from FingerPrintResults.cc:133:
In file included from ./FingerPrintResults.h:138:
In file included from ./FPEngine.h:138:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/vector:270:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/__bit_reference:16:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/algorithm:644:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/memory:668:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/atomic:547:
./libpcap/version:1:1: error: expected unqualified-id
1.7.3
^
In file included from FingerPrintResults.cc:133:
In file included from ./FingerPrintResults.h:138:
In file included from ./FPEngine.h:138:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/vector:270:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/__bit_reference:16:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/algorithm:644:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/memory:670:
./libpcap/version:1:1: error: expected unqualified-id
1.7.3
^
In file included from FingerPrintResults.cc:133:
In file included from ./FingerPrintResults.h:138:
In file included from ./FPEngine.h:138:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/vector:270:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/__bit_reference:16:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/algorithm:645:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/functional:492:
./libpcap/version:1:1: error: expected unqualified-id
1.7.3
^
In file included from FingerPrintResults.cc:133:
In file included from ./FingerPrintResults.h:138:
In file included from ./FPEngine.h:138:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/vector:270:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/__bit_reference:16:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/algorithm:649:
./libpcap/version:1:1: error: expected unqualified-id
1.7.3
^
In file included from FingerPrintResults.cc:133:
In file included from ./FingerPrintResults.h:138:
In file included from ./FPEngine.h:138:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/vector:279:
./libpcap/version:1:1: error: expected unqualified-id
1.7.3
^
In file included from FingerPrintResults.cc:135:
In file included from ./NmapOps.h:138:
In file included from ./output.h:181:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/string:500:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/string_view:181:
./libpcap/version:1:1: error: expected unqualified-id
1.7.3
^
In file included from FingerPrintResults.cc:135:
In file included from ./NmapOps.h:138:
In file included from ./output.h:181:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/string:513:
./libpcap/version:1:1: error: expected unqualified-id
1.7.3
^
In file included from FingerPrintResults.cc:135:
In file included from ./NmapOps.h:141:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/map:474:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/__node_handle:16:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/optional:159:
./libpcap/version:1:1: error: expected unqualified-id
1.7.3
^
In file included from FingerPrintResults.cc:135:
In file included from ./NmapOps.h:141:
In file included from /mnt/c/android/libs/nmap/nmap-arm/toolchain_armeabi/bin/../sysroot/usr/include/c++/v1/map:481:
./libpcap/version:1:1: error: expected unqualified-id
1.7.3
^
17 errors generated.
make: *** [FingerPrintResults.o] Error 1
@guyharris

This comment has been minimized.

Copy link

commented May 14, 2019

OK, you're not compiling libpcap, you're compiling Nmap. Unfortunately, Npcap doesn't have its own issue site (why not?).

Unless the C++ language dictates that there must not be a file named "version" anywhere in any search path of the program being built, there is something broken in either the Nmap build procedure, the compiler, or in the C++ library, as the library appears to be including a file named "version", which is presumably intended to be a version file in the C++ library itself, but it's picking up the one from libpcap. It should be perfectly permissible for the libpcap source to include a file named "version" - or even "VERSION" - in its source directory, without compiling with a -I flag pointing to that directory causing anything from the C++ library to include stuff from that directory.

@eakteam

This comment has been minimized.

Copy link
Author

commented May 14, 2019

@guyharris thanks for you good explanation, so you are saying that if i rename this file "version", everything should works OK ?

Or how do you recommend as workaround for this ? How to include -I flag in this case ?

this is my build script :

    chmod +x configure
    ./configure --host=aarch64-linux-android --without-openssl --without-zenmap --without-liblua --without-nping --without-ncat --without-ndiff --with-libpcap=included --with-pcap=linux --enable-static --disable-rpath --prefix=/data/opt


export PATH=`pwd`/$toolchain_dir/bin:$PATH
    SYSROOT=${toolchain_dir}/sysroot
    target_host=arm-linux-androideabi
    export AR=$target_host-ar
    export AS=$target_host-clang
    export CC=$target_host-clang
    export CXX=$target_host-clang++
    export LD=$target_host-ld
    export STRIP=$target_host-strip
    export RANLIB=$target_host-ranlib
    export STRIP=$target_host-strip
    export CFLAGS="-static -Os -fPIE -fPIC -march=armv7-a -ffunction-sections -fdata-sections -fvisibility=default"
    export LDFLAGS="-static -pie -static-libstdc++"
	export CXXFLAGS="-fvisibility=default"
@eakteam

This comment has been minimized.

Copy link
Author

commented May 14, 2019

Solved by executing perl -pi -w -e 's/<version>/"version"/g;' $( grep -rl '<version>' ) to prebuilt toolchain include dir

@guyharris

This comment has been minimized.

Copy link

commented May 14, 2019

Solved by executing perl -pi -w -e 's/<version>/"version"/g;' $( grep -rl '<version>' ) to prebuilt toolchain include dir

As I suspected. Please file a bug against the toolchain; the C++ standard says that the way that both #include <XXX> and #include "XXX" search for a header is implementation defined, but those headers are part of the implementation, so they should choose whatever form will not find "version" outside the toolchain's headers - a quick scan of C++ 17 didn't show any <version> header that's provided by C++ implementations as part of the standard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.