I am trying to compile a FirmwareProject which has both C and C++ code using LLVM/Clang. But, I get the following error which I am not able to get rid of:
Description Resource Path Location
expected top-level entity Bx000484 line 1, external location: C:\Program Files (x86)\msys64\mingw64\bin\llvm-as.exe: obj\rel\LibStm32f10x\LibStm32f10x\src\cortexm3_macro.s.o.s
I tried trying the different LLVM compiler and linker flags. But nothing seems to work:
### Global complier and linker settings
INCLUDES_APP := -I$(GLOBALS_DIR)/inc -I$(LIBGLOBALS_DIR)/inc -I$(LIBSTM32F10X_DIR)/inc
AFLAGS :=
CFLAGS := -Wall -Wextra -Wmissing-field-initializers -Wstrict-prototypes -mcpu=cortex-m3 -mthumb -fsigned-char -ffunction-sections -mlittle-endian -D_FLASH_PROG
CXXFLAGS := -Wall -Wnarrowing -Wextra -Wmissing-field-initializers -mcpu=cortex-m3 -mthumb -fno-rtti -fno-exceptions -fsigned-char -ffunction-sections -mlittle-endian -D_FLASH_PROG
LINKER_FILE := $(LD_DIR)/STM32F101_64K_10K_FLASH.ld
LFLAGS := --specs=rdimon.specs -Wl,--start-group -lgcc -lc -lm -lrdimon -Wl,--end-group \
-mcpu=cortex-m3 -mthumb -Wl,-L$(LD_DIR) -Wl,-static -Wl,--gc-sections -nostartfiles --specs=nosys.specs -specs=nano.specs
### TOOLCHAIN
COMMAND_DIR := "$(PROGRAMFILES)\msys64\mingw64\bin"
COMMAND_PREFIX := arm-none-eabi-
CMD_PREFIX := arm-none-eabi-
CC := $(COMMAND_DIR)/clang
CPPC := $(COMMAND_DIR)/clang++
ASM := $(COMMAND_DIR)/llvm-as
LINK := $(COMMAND_DIR)/clang++
ELFBIN := $(COMMAND_DIR)/objcopy
AR := $(COMMAND_DIR)/llvm-ar
SIZE := $(COMMAND_DIR)/llvm-size
llvm-as command assembles LLVM IR sources, not assembler ones. Try using clang as ASM, or llvm-mc -assemble.
Related
I would like to add compiler flags to build my Postgres C/C++ extension. I have tried standard Makefile practices but pg_config does not pick up any of the compiler flags I add.
The Makefile is as follows:
1 # the extensions name
2 EXTENSION = extension_one
3 DATA = $(wildcard *--*.sql) # script files to install
4 TESTS = $(wildcard test/sql/*.sql) # use appropriate testfiles
5
6 CFLAGS = -std=c99
7 CPPFLAGS = -std=c++17
8
9 # find the sql and expected directories under test
10 # load plpgsql into test db
11 # load extension into test db
12 # dbname
13 REGRESS_OPTS = --inputdir=test \
14 --load-extension=extension_one \
15 --load-language=plpgsql
16 REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
17 OBJS = $(patsubst %.c,%.o,$(wildcard src/*.c)) # object files
18 # final shared library to be build from multiple source files (OBJS)
19 MODULE_big = $(EXTENSION)
20
21
22 # postgres build stuff
23 PG_CONFIG = pg_config
24 PGXS := $(shell $(PG_CONFIG) --pgxs)
25 include $(PGXS)
The pg_config environment variables are set as follows:
>pg_config
BINDIR = /usr/lib/postgresql/12/bin
DOCDIR = /usr/share/doc/postgresql-doc-12
HTMLDIR = /usr/share/doc/postgresql-doc-12
INCLUDEDIR = /usr/include/postgresql
PKGINCLUDEDIR = /usr/include/postgresql
INCLUDEDIR-SERVER = /usr/include/postgresql/12/server
LIBDIR = /usr/lib/x86_64-linux-gnu
PKGLIBDIR = /usr/lib/postgresql/12/lib
LOCALEDIR = /usr/share/locale
MANDIR = /usr/share/postgresql/12/man
SHAREDIR = /usr/share/postgresql/12
SYSCONFDIR = /etc/postgresql-common
PGXS = /usr/lib/postgresql/12/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=/usr/include' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--disable-silent-rules' '--libdir=/usr/lib/x86_64-linux-gnu' '--libexecdir=/usr/lib/x86_64-linux-gnu' '--disable-maintainer-mode' '--disable-dependency-tracking' '--with-icu' '--with-tcl' '--with-perl' '--with-python' '--with-pam' '--with-openssl' '--with-libxml' '--with-libxslt' 'PYTHON=/usr/bin/python3' '--mandir=/usr/share/postgresql/12/man' '--docdir=/usr/share/doc/postgresql-doc-12' '--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share/' '--datadir=/usr/share/postgresql/12' '--bindir=/usr/lib/postgresql/12/bin' '--libdir=/usr/lib/x86_64-linux-gnu/' '--libexecdir=/usr/lib/postgresql/' '--includedir=/usr/include/postgresql/' '--with-extra-version= (Ubuntu 12.4-0ubuntu0.20.04.1)' '--enable-nls' '--enable-integer-datetimes' '--enable-thread-safety' '--enable-tap-tests' '--enable-debug' '--enable-dtrace' '--disable-rpath' '--with-uuid=e2fs' '--with-gnu-ld' '--with-pgport=5432' '--with-system-tzdata=/usr/share/zoneinfo' '--with-llvm' 'LLVM_CONFIG=/usr/bin/llvm-config-10' 'CLANG=/usr/bin/clang-10' '--with-systemd' '--with-selinux' 'MKDIR_P=/bin/mkdir -p' 'TAR=/bin/tar' 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now' '--with-gssapi' '--with-ldap' '--with-includes=/usr/include/mit-krb5' '--with-libs=/usr/lib/mit-krb5' '--with-libs=/usr/lib/x86_64-linux-gnu/mit-krb5' 'build_alias=x86_64-linux-gnu' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security'
CC = gcc
CPPFLAGS = -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/mit-krb5
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer
CFLAGS_SL = -fPIC
LDFLAGS = -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -L/usr/lib/llvm-10/lib -L/usr/lib/x86_64-linux-gnu/mit-krb5 -Wl,--as-needed
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lpthread -lselinux -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -ledit -lrt -lcrypt -ldl -lm
VERSION = PostgreSQL 12.4 (Ubuntu 12.4-0ubuntu0.20.04.1)
Since pg_config displays "CFLAGS" and "CPPFLAGS" and the official documentation (https://www.postgresql.org/docs/12/libpq-build.html) says to use these flags that is what I have tried, but when I run make it does not pick them up. Note: I have tried both "=" as normal, and "+=" as it suggests in the docs linked above. And nothing.
When I run make I get:
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/mit-krb5 -c -o src/extension_one.o src/extension_one.c
Note: I asked this question in the "Database Administrator" stack exchange, but now realize it might be more appropriate to ask it here.
Note: Here is a nice example of a Postgresql C extention ready to go if you need an example to work with: Postgres_c_extension_demo
I'm not a DB guy, but have had my share of compiling days with Gentoo. And this caught my curiosity.
So here are my 2 cents:
Long story short, you should use PG_CFLAGS or PG_CPPFLAGS(only if working with c++), in your Makefile
How I found out?
$ pg_config --help
pg_config provides information about the installed version of PostgreSQL.
Keyword being provides info about the installed version. So your extra CFLAGS will not show up there.
However I noticed the Makefile pulls the output of pg_config --pgxs to extend the Makefile. The output of that in my distro is:
/usr/lib64/pgsql/pgxs/src/makefiles/pgxs.mk
So I opened that in my editor and here is a snippet:
# PG_CPPFLAGS -- will be prepended to CPPFLAGS
# PG_CFLAGS -- will be appended to CFLAGS
# PG_CXXFLAGS -- will be appended to CXXFLAGS
# PG_LDFLAGS -- will be prepended to LDFLAGS
I am trying to write a script that uses a library compiled with clang and another library compiled with G++, I get the following error:
ld.lld: error: undefined symbol: myFunction()
Which (according to this Difference between string and char[] types in C++) is apparently due to std::string meaning different things in different versions of G++ and clang.
Does this mean I have to rewrite the Makefile of my target library to use the same version of G++/Clang? Because that seems like an awful amount of effort just to link a prewritten library, and I think I must be missing something here.
More info
I am compiling v8_shell using ninja -C out/debug
defines = -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_X11=1 -DNO_TCMALLOC -DMEMORY_TOOL_REPLACES_ALLOCATOR -DMEMORY_SANITIZER_INITIAL_SIZE -DADDRESS_SANITIZER -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DCR_CLANG_REVISION=\"353250-1\" -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DCOMPONENT_BUILD -D_LIBCPP_ABI_UNSTABLE -D_LIBCPP_ABI_VERSION=Cr -DCR_LIBCXX_REVISION=349080 -DCR_LIBCXXABI_REVISION=347903 -D_LIBCPP_ENABLE_NODISCARD -DCR_SYSROOT_HASH=e7c53f04bd88d29d075bfd1f62b073aeb69cbe09 -D_DEBUG -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1 -DENABLE_DISASSEMBLER -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 -DENABLE_GDB_JIT_INTERFACE -DENABLE_MINOR_MC -DOBJECT_PRINT -DVERIFY_HEAP -DV8_TRACE_MAPS -DV8_ENABLE_ALLOCATION_TIMEOUT -DV8_ENABLE_FORCE_SLOW_PATH -DV8_INTL_SUPPORT -DENABLE_HANDLE_ZAPPING -DV8_USE_SNAPSHOT -DV8_USE_EXTERNAL_STARTUP_DATA -DV8_CONCURRENT_MARKING -DV8_CHECK_MICROTASKS_SCOPES_CONSISTENCY -DV8_EMBEDDED_BUILTINS -DV8_ENABLE_CHECKS -DV8_DEPRECATION_WARNINGS -DV8_IMMINENT_DEPRECATION_WARNINGS -DV8_TARGET_ARCH_X64 -DDEBUG -DDISABLE_UNTRUSTED_CODE_MITIGATIONS -DUSING_V8_SHARED -DV8_ENABLE_CHECKS -DV8_DEPRECATION_WARNINGS -DV8_IMMINENT_DEPRECATION_WARNINGS -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DUCHAR_TYPE=uint16_t -DUSING_V8_BASE_SHARED -DUSING_V8_PLATFORM_SHARED
include_dirs = -I../.. -Igen -I../.. -Igen -I../../include -Igen/include -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n -I../../include
cflags = -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -funwind-tables -fPIC -B../../third_party/binutils/Linux_x64/Release/bin -pthread -fcolor-diagnostics -fmerge-all-constants -Xclang -mllvm -Xclang -instcombine-lower-dbg-declare=0 -no-canonical-prefixes -fcomplete-member-pointers -m64 -march=x86-64 -Wall -Werror -Wextra -Wimplicit-fallthrough -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-unneeded-internal-declaration -Wno-undefined-var-template -Wno-ignored-pragma-optimize -fno-omit-frame-pointer -g2 -gsplit-dwarf -ggnu-pubnames -gcolumn-info -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-blacklist=../../tools/memory/asan/blacklist.txt -fvisibility=hidden -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wmissing-field-initializers -Wextra-semi -Winconsistent-missing-override -Wunreachable-code -Wshorten-64-to-32 -O2 -fno-ident -fdata-sections -ffunction-sections
cflags_cc = -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare -std=c++14 -fno-exceptions -fno-rtti -nostdinc++ -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include --sysroot=../../build/linux/debian_sid_amd64-sysroot -fvisibility-inlines-hidden
label_name = v8_shell
target_out_dir = obj
target_output_name = v8_shell
build obj/v8_shell/shell.o: cxx ../../samples/shell.cc || obj/generate_bytecode_builtins_list.stamp obj/run_torque.stamp obj/v8_dump_build_config.stamp obj/src/inspector/protocol_generated_sources.stamp obj/third_party/icu/icudata.stamp
build ./v8_shell: link obj/v8_shell/shell.o obj/build/config/sanitizers/liboptions_sources.a | ./libv8.so.TOC ./libv8_libbase.so.TOC ./libv8_libplatform.so.TOC ./libicui18n.so.TOC ./libicuuc.so.TOC ./libc++.so.TOC || obj/build/win/default_exe_manifest.stamp obj/v8_dump_build_config.stamp obj/build/config/executable_deps.stamp
ldflags = -pie -Wl,--fatal-warnings -fPIC -Wl,-z,noexecstack -Wl,-z,relro -fuse-ld=lld -Wl,--color-diagnostics -m64 -Werror -Wl,--gdb-index -rdynamic -nostdlib++ --sysroot=../../build/linux/debian_sid_amd64-sysroot -L../../build/linux/debian_sid_amd64-sysroot/usr/local/lib/x86_64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_sid_amd64-sysroot/usr/local/lib/x86_64-linux-gnu -L../../build/linux/debian_sid_amd64-sysroot/lib/x86_64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_sid_amd64-sysroot/lib/x86_64-linux-gnu -L../../build/linux/debian_sid_amd64-sysroot/usr/lib/x86_64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_sid_amd64-sysroot/usr/lib/x86_64-linux-gnu -fsanitize=address -fsanitize-address-use-after-scope -pie -Wl,-rpath-link=. -Wl,--disable-new-dtags -Wl,-rpath=\$$ORIGIN/. -Wl,-rpath-link=. -Wl,-O2 -Wl,--gc-sections -Wl,-u_sanitizer_options_link_helper -fsanitize=address -fsanitize-address-use-after-scope
libs = -L . -ldl -lpthread -lrt
output_extension =
output_dir = .
solibs = ./libtester.so ./libv8.so ./libv8_libbase.so ./libv8_libplatform.so ./libicui18n.so ./libicuuc.so ./libc++.so
Link to code is here:
https://github.com/v8/v8/blob/master/samples/shell.cc
All I have done is add a test library that returns a std::string and this is called from shell.cc.
This test library is compiled with
clang++ -shared -o libtester tester.cpp -fPIC -L . -lpthread
Which yields undefined symbol errors.
I can get it to compile by forcing libc++ that v8 seems to use, but then I get a whole host of core dumps and other errors at runtime, so I don't think thats a legitimate fix.
clang++ -shared -o libtester.so tester.cpp -fPIC -std=c++11 -L . -stdlib=libc++ -lpthread
Example code snippet:
tester.cpp
std::string myFunction() {
std::string newstring;
// do something
return newstring;
}
shell.cc
std::string test = myFunction();
cout << test;
Update please see these posts that document it further C++ Undefined symbol related to std::string in static lib
Can't link libFuzzer.a using clang with libc++
Theres no real answer apart from use libstdc++ rather than libc++ for everything, but thats not really an option to convert an entire project like v8 to libstdc++
The build recipe you use for V8 builds it with -D_LIBCPP_ABI_UNSTABLE -D_LIBCPP_ABI_VERSION=Cr -DCR_LIBCXX_REVISION=349080 -DCR_LIBCXXABI_REVISION=347903. According to libc++ ABI stability, these macros affect the library ABI. Your separate compilation uses just -stdlib=libc++, so it does not enable the incompatible ABI.
You might get better results if you use a different recipe for building V8, something that uses the system C++ standard library with its default (stable) ABI.
This is the solution for compiling v8 with libstdc++.
Type the following command
gn args out/stdc
Add the following arguments to the args file:
is_clang = true
use_custom_libcxx_for_host=false
use_custom_libcxx=false
libcxx_abi_unstable=false
Build with
ninja -C out/stdc
I am compiling an example application from the SDK repository of a third party vendor. I receive an error that one of the C++ header's (algorithm) cannot be found:
if [ ! -d .deps/ ]; then mkdir -p .deps/; fi
/opt/llvm-3.8.0/bin/clang++ -M -isystem/opt/tbricks/sdk/include64 -I../../.. -I../../../.. -I./../../../.. -DLINUX -DLINUX64 -DTB_USE_RCU -DURCU_INLINE_SMALL_FUNCTIONS -DU_USING_ICU_NAMESPACE=0 -DNDEBUG -D_POSIX_PTHREAD_SEMANTICS -fPIC -D_GNU_SOURCE -DTB_USE_RCU -DTB_USE_RCU -D_GLIBCXX_USE_CXX11_ABI=0 -m64 --gcc-toolchain=/opt/gcc-5.2.0 -flto=full -std=gnu++14 -D_GLIBCXX_DEPRECATED= -pipe -fno-omit-frame-pointer -ffast-math -fno-finite-math-only -pthread -march=core2 -mtune=corei7 -g -O3 -Qunused-arguments -fnon-call-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -Wshadow -Wpointer-arith -Wno-self-assign -Wno-unused-function -Wno-gnu-empty-initializer -Wno-unused-parameter -Wno-ignored-qualifiers -Wno-mismatched-tags -Wno-unused-local-typedef -Wno-parentheses-equality -Wno-unused-private-field -Wno-missing-field-initializers -Wno-missing-braces -Werror=return-type -Werror=overloaded-virtual -DSTRATEGY_BUILD_PROFILE=\"release\" ../../../../shared/Helpers.cpp > .deps/Helpers.o.d
../../../../shared/Helpers.cpp:14:10: fatal error: 'algorithm' file not found
#include <algorithm>
What sets the location path to search for C++ header files, such as algorithm? Is there anything I can grep for within makefiles?
Either install g++ alongside (you need libstdc++) or use LLVM libc++ and specify it with -stdlib=libc++
I'm trying to use Freetype with Android NDK + Eclipse, but I got an error when I include this in my project:
#include <ft2build.h>
#include FT_FREETYPE_H
Error message:
fatal error: ft2build.h: No such file or directory
Here is the Android.mk in jni/freetype2:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := freetype
LOCAL_SRC_FILES := freetype/lib/libfreetype.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/freetype/include/freetype2 $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)
Here is the project's Android.mk (in jni folder):
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := CNSD_CPP
...
LOCAL_LDLIBS := -landroid -lGLESv2 -lEGL -llog
LOCAL_STATIC_LIBRARIES := freetype android_native_app_glue
include $(BUILD_SHARED_LIBRARY)
$(call import-module,android/native_app_glue)
And I have that header file in the dir:
jni/freetype2/freetype/include/freetype2
and when I CTRL+Click on it, the Eclipse shows me the file. What am I doing wrong?
#Alex: I ran ndk-build V=1 and the end of the result is this:
[armeabi] Compile++ thumb: CNSD_CPP <= Log.cpp
d:/Development/Android/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -MMD -MP -MF D:/Development/Projects/workspace/CNSD_CPP//obj/local/armeabi/objs/CNSD_CPP/Log
.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector
-no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing
-finline-limit=64 -Id:/Development/Android/android-ndk-r9c/sources/android/native_app_glue
-Id:/Development/Android/android-ndk-r9c/sources/cxx-stl/gnu-libstdc++/4.8/include
-Id:/Development/Android/android-ndk-r9c/sources /cxx-stl/gnu-libstdc++/4.8/libs/armeabi/include
-Id:/Development/Android/android-ndk-r9c/sources/cxx-stl/gnu-libstdc++/4.8/include/backward
-ID:/Development/Projects/workspace/CNSD_CPP//jni -DANDROID -Wa,--noexecstack -Wf ormat -Werror=format-security -std=c++11 -Id:/Development/Android/android-ndk-r9c/platforms/android-15/arch-arm/usr/include
-c D:/Development/Projects/workspace/CNSD_CPP//jni/Log.cpp -o D:/Development/Projects/workspa
ce/CNSD_CPP//obj/local/armeabi/objs/CNSD_CPP/Log.o [armeabi] Compile++
thumb: CNSD_CPP <= Main.cpp
d:/Development/Android/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -MMD -MP -MF D:/Development/Projects/workspace/CNSD_CPP//obj/local/armeabi/objs/CNSD_CPP/Mai
n.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector
-no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Id:/Development/Android/android-ndk-r9c/sources/android/native_app_glue
-Id:/Development/Android/android-ndk-r9c/sources/cxx-stl/gnu-libstdc++/4.8/include
-Id:/Development/Android/android-ndk-r9c/source s/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/include
-Id:/Development/Android/android-ndk-r9c/sources/cxx-stl/gnu-libstdc++/4.8/include/backward
-ID:/Development/Projects/workspace/CNSD_CPP//jni -DANDROID -Wa,--noexecstack -W format -Werror=format-security -std=c++11 -Id:/Development/Android/android-ndk-r9c/platforms/android-15/arch-arm/usr/include
-c D:/Development/Projects/workspace/CNSD_CPP//jni/Main.cpp -o D:/Development/Projects/works
pace/CNSD_CPP//obj/local/armeabi/objs/CNSD_CPP/Main.o
D:/Development/Projects/workspace/CNSD_CPP//jni/Main.cpp:3:22: fatal
error: ft2build.h: No such file or directory #include
^ compilation terminated. make.exe: *** [D:/Development/Projects/workspace/CNSD_CPP//obj/local/armeabi/objs/CNSD_CPP/Main.o]
Error 1
Don't use cygwin shell to build with NDK toolchain. Open normal Windows command line, and use ndk-build.cmd instead. Make sure that all paths are specified in so-called mixed format, e.g
d:/Development/Projects/workspace/CNSD_CPP
Update: now I see that
include $(LOCAL_PATH)/freespace2/Android.mk
is missing. It should be placed after BUILD_SHARED_LIBRARY and before include-module.
My goal is to get rid of some types of compiler warnings. I found out that I can do that by adding compiler flags in my .pro file:
QMAKE_CXXFLAGS += -Wno-unused-variable -Wno-reorder
The problem is that they are added before flags that are generated by Qt build system. I've examined my compiler output:
g++-4.2 -c -pipe -Wno-unused-variable -Wno-reorder -g -gdwarf-2 -arch
x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W
-DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB
So as you can see -Wall goes after my flags and discards them. What should I do to add those flags after ?
Don't use QMAKE_CXXFLAGS but rather override QMAKE_CXXFLAGS_WARN_ON with your own warnings:
QMAKE_CXXFLAGS_WARN_ON = -Wno-unused-variable -Wno-reorder