Eclipse Makefile Error - eclipse

I need some help with solving an error. I was trying to create a simple bluetooth server using the library bluez-5.31 . I am using eclipse on Raspbian Jessie which is similar to Debian but I have little to no experience with either one. I tried fixing it for a couple days now and nothing seems to be working so i really need some help...
This is the error description:
error 1: make:*** [Bluetooth Server 2]Error 1 Resource: Bluetooth Server 2
error 2: recipe for target 'Bluetooth Server 2' failed Resource: makefile Path: /Bluetooth Server 2/Debug Location: line 45
where "Bluetooth Server 2" is the name of the project[/code]
This is main:
#include "/usr/include/stdint.h"
#include "/usr/include/bluez-5.31/lib/bluetooth.h"
#include "/usr/include/bluez-5.31/lib/hci.h"
#include "/usr/include/bluez-5.31/lib/hci_lib.h"
#include "/usr/include/bluez-5.31/lib/rfcomm.h"
int main(int argc, char **argv)
{
struct sockaddr_rc loc_addr = { 0 }, rem_addr = { 0 };
char buf[1024] = { 0 };
int s, client, bytes_read;
unsigned int opt = sizeof(rem_addr);
//allocate socket
s = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
//bind socket to port 1 of the first available adapter
bdaddr_t tmp = {0,0,0,0,0,0};
loc_addr.rc_family = AF_BLUETOOTH;
loc_addr.rc_bdaddr = tmp;
loc_addr.rc_channel = 1;
bind(s, (struct sockaddr* )&loc_addr, sizeof(loc_addr));
//put socket into listening mode
listen(s, 1);
//accept one connection
client = accept(s, (struct sockaddr *)&rem_addr, &opt);
ba2str( &rem_addr.rc_bdaddr, buf );
fprintf( stderr, "accepter connection from %s\n", buf);
memset( buf, 0, sizeof(buf));
//read data from the client
bytes_read = recv(client, buf, sizeof(buf), 0);
if( bytes_read > 0 )
{
printf("received [%s]\n", buf);
}
//close connection
//close(client);
//close(s);
return 0;
}
This is the make file:
-include ../makefile.init
RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include src/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
endif
-include ../makefile.defs
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: Bluetooth\ Server\ 2
# Tool invocations
Bluetooth\ Server\ 2: $(OBJS) $(USER_OBJS)
#echo 'Building target: $#'
#echo 'Invoking: GCC C++ Linker'
g++ -L/usr/include/ -bluez-5.31 -o "Bluetooth Server 2" $(OBJS) $(USER_OBJS) $(LIBS)
#echo 'Finished building target: $#'
#echo ' '
# Other Targets
clean:
-$(RM) $(OBJS)$(C++_DEPS)$(C_DEPS)$(CC_DEPS)$(CPP_DEPS)$(EXECUTABLES)$(CXX_DEPS)$(C_U PPER_DEPS) "Bluetooth Server 2"
-#echo ' '
.PHONY: all clean dependents
.SECONDARY:
-include ../makefile.targets
And this is what changes i made to project properties:
- C/C++ Build >> Settings >> Tool Settings >> GCC C++ Linker >> Miscellaneous: In the linker flags box i wrote: "-bluez-5.31"
- C/C++ Build >> Settings >> Tool Settings >> GCC C++ Linker >> Libraries: Added " "bluez-5.31" " in -l
- C/C++ Build >> Settings >> Tool Settings >> GCC C++ Linker >> Libraries: Added " /usr/include " in -L

Related

boot.img too large when I compile AOSP11 source code for OTA

I trying to enable AB OTA in AOSP11 source code.
Followed below steps:
Step 1:
BOARD_USES_AB_IMAGE := true
Step 2 : CONFIG_ANDROID_AB=y in u boot source code.
Getting below compilation error :
libcameradevice curr board is yy356x
[ 91% 48807/53497] Target boot image from recovery: out/target/product/xx/boot.img
FAILED: out/target/product/xx/boot.img
/bin/bash -c "(out/host/linux-x86/bin/mkbootimg --kernel out/target/product/xx/kernel --ramdis
k out/target/product/xx/ramdisk-recovery.img --cmdline "console=ttyFIQ0 androidboot.baseband=N/
A androidboot.wificountrycode=CN androidboot.veritymode=enforcing androidboot.hardware=yy30board andro
idboot.console=ttyFIQ0 androidboot.verifiedbootstate=orange firmware_class.path=/vendor/etc/firmware i
nit=/init rootwait ro init=/init androidboot.selinux=permissive buildvariant=userdebug" --recovery_dt
bo out/target/product/xx/rebuild-dtbo.img --dtb out/target/product/xx/dtb.img --os_version
11 --os_patch_level 2021-08-05 --second kernel/resource.img --header_version 2 --output out/target/
product/xx/boot.img ) && (size=$(for i in out/target/product/xx/boot.img; do stat -c "%s" "$i" | tr -d '\n'; echo +; done; echo 0); total=$(( $( echo "$size" ) )); printname=$(ec
ho -n " out/target/product/xx/boot.img" | tr " " +); maxsize=$(( 100663296-0)); if [ "
$total" -gt "$maxsize" ]; then echo "error: $printname too large ($total > $maxsize)"; false;
elif [ "$total" -gt $((maxsize - 32768)) ]; then echo "WARNING: $printname approaching size li
mit ($total now; limit $maxsize)"; fi )"
error: +out/target/product/xx/boot.img too large (103485440 > 100663296)
[ 91% 48808/53497] //libcore/mmodules/intracoreapi:art-module-intra-core-api-stubs-source metalava mer
metalava detected access to files that are not explicitly specified. See /home/test/aosp/aa_android/
out/soong/.intermediates/libcore/mmodules/intracoreapi/art-module-intra-core-api-stubs-source/android_
common/art-module-intra-core-api-stubs-source-violations.txt for details.
01:25:09 ninja failed with: exit status 1
failed to build some targets (02:42:20 (hh:mm:ss))

Compile a static version of pngquant

I'm trying to create a statically linked version of pngquant in Oracle Linux Server release 7.1. I've compiled the static version of zlib and the static version of libpng.
Then, when I configure pngquant, I always get the information that it will be linked with a shared version of zlib.
$ ./configure --with-libpng=../libpng-1.6.21 --extra-cflags="-I../zlib-1.2.8" --extra-ldflags="../zlib-1.2.8/libz.a"
Compiler: gcc
Debug: no
SSE: yes
OpenMP: no
libpng: static (1.6.21)
zlib: shared (1.2.7)
lcms2: no
If I execute make, in the output it seems that the options are correctly passed to the compiler. However, the resulting binary requires libz.so to be executed. It seems that my directives are ignored or that the installed version always takes precedence.
Is there any way of forcing pngquant to be compiled with the static version of zlib?
I'm not sure, if I got it right, but here's a patch to pngquant's configure that worked for me. configure now accepts --with-zlib=<dir> as parameter. Store it to pngquant.patch and apply it with patch -uN -p1 -i pngquant.patch.
diff -ur pngquant-2.9.0/configure pngquant-2.9.0.fixed/configure
--- pngquant-2.9.0/configure 2017-03-06 09:37:30.000000000 +0100
+++ pngquant-2.9.0.fixed/configure 2017-03-07 09:57:20.246012152 +0100
## -48,6 +48,7 ##
help "--with-cocoa/--without-cocoa use Cocoa framework to read images"
fi
help "--with-libpng=<dir> search for libpng in directory"
+ help "--with-zlib=<dir> search for zlib in directory"
echo
help "CC=<compiler> use given compiler command"
help "CFLAGS=<flags> pass options to the compiler"
## -97,6 +98,9 ##
--with-libpng=*)
LIBPNG_DIR=${i#*=}
;;
+ --with-zlib=*)
+ ZLIB_DIR=${i#*=}
+ ;;
--prefix=*)
PREFIX=${i#*=}
;;
## -238,6 +242,19 ##
echo "${MAJ}${MIN}"
}
+# returns full zlib.h version string
+zlibh_string() {
+ echo "$(grep -m1 "define ZLIB_VERSION" "$1" | \
+ grep -Eo '"[^"]+"' | grep -Eo '[^"]+')"
+}
+
+# returns major minor version numbers from png.h
+zlibh_majmin() {
+ local MAJ=$(grep -m1 "define ZLIB_VER_MAJOR" "$1" | grep -Eo "[0-9]+")
+ local MIN=$(grep -m1 "define ZLIB_VER_MINOR" "$1" | grep -Eo "[0-9]+")
+ echo "${MAJ}${MIN}"
+}
+
error() {
status "$1" "error ... $2"
echo
## -420,11 +437,42 ##
error "libpng" "not found (try: $LIBPNG_CMD)"
fi
-# zlib
-if ! find_library "zlib" "z" "zlib.h" "libz.a" "libz.$SOLIBSUFFIX*"; then
- error "zlib" "not found (please install zlib-devel package)"
+# try if given flags are enough for zlib
+HAS_ZLIB=0
+if echo "#include \"zlib.h\"
+ int main(){
+ uLong test = zlibCompileFlags();
+ return 0;
+}" | "$CC" -xc -std=c99 -o /dev/null $CFLAGS $LDFLAGS - &> /dev/null; then
+ status "zlib" "custom flags"
+ HAS_ZLIB=1
fi
+if [ "$HAS_ZLIB" -eq 0 ]; then
+ # try static in the given directory
+ ZLIBH=$(find_h "$ZLIB_DIR" "zlib.h")
+ if [ -n "$ZLIBH" ]; then
+ ZLIBH_STRING=$(zlibh_string "$ZLIBH")
+ ZLIBH_MAJMIN=$(zlibh_majmin "$ZLIBH")
+ if [[ -n "$ZLIBH_STRING" && -n "$ZLIBH_MAJMIN" ]]; then
+ ZLIBA=$(find_f "$ZLIB_DIR" "libz${ZLIBH_MAJMIN}.a")
+ if [ -z "$ZLIBA" ]; then
+ ZLIBA=$(find_f "$ZLIB_DIR" "libz.a")
+ fi
+ if [ -n "$ZLIBA" ]; then
+ cflags "-I${ZLIBH%/*}"
+ lflags "${ZLIBA}"
+ status "zlib" "static (${ZLIBH_STRING})"
+ HAS_ZLIB=1
+ fi
+ fi
+ fi
+fi
+# zlib
+if ! find_library "zlib" "z" "zlib.h" "libz.a" "zlib.$SOLIBSUFFIX*"; then
+ error "zlib" "not found (please install zlib-devel package)"
+fi
+
# lcms2
if [ "$LCMS2" != 0 ]; then
if find_library "lcms2" "lcms2" "lcms2.h" "liblcms2.a" "liblcms2.$SOLIBSUFFIX*"; then
Sorry, the configure script does not support it. It shouldn't be too hard to modify configure to pass appropriate flags to pkg-config or do the same workaround it does for libpng.

How to compile uefi application using gnu-efi?

I tried to compile uefi code using gnu-efi. But I don't understand how to compile my uefi application code.
I get gnu-efi 3.0.2, decompress and type make && make install. I write hello world code:
#include <efi.h>
#include <efilib.h>
EFI_STATUS efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
InitializeLib(ImageHandle, SystemTable);
Print(L"Hello, world!\n");
return EFI_SUCCESS;
}
My OS is Ubuntu 15.04.
Include the gnu-efi files
#include <efi.h>
#include <efilib.h>
it looks like your includes where removed by SO
create the make file;
If you were building a "Hello, World" program for Linux in a Linux
environment, you could compile it without a Makefile. Building the
program in Linux for EFI, though, is essentially a cross-compilation
operation. As such, it necessitates using unusual compilation and
linker options, as well as a post-linking operation to convert the
program into a form that the EFI will accept. Although you could type
all the relevant commands by hand, a Makefile helps a lot.
ARCH = $(shell uname -m | sed s,i[3456789]86,ia32,)
OBJS = main.o
TARGET = hello.efi
EFIINC = /usr/include/efi
EFIINCS = -I$(EFIINC) -I$(EFIINC)/$(ARCH) -I$(EFIINC)/protocol
LIB = /usr/lib64
EFILIB = /usr/lib64/gnuefi
EFI_CRT_OBJS = $(EFILIB)/crt0-efi-$(ARCH).o
EFI_LDS = $(EFILIB)/elf_$(ARCH)_efi.lds
CFLAGS = $(EFIINCS) -fno-stack-protector -fpic \
-fshort-wchar -mno-red-zone -Wall
ifeq ($(ARCH),x86_64)
CFLAGS += -DEFI_FUNCTION_WRAPPER
endif
LDFLAGS = -nostdlib -znocombreloc -T $(EFI_LDS) -shared \
-Bsymbolic -L $(EFILIB) -L $(LIB) $(EFI_CRT_OBJS)
all: $(TARGET)
hello.so: $(OBJS)
ld $(LDFLAGS) $(OBJS) -o $# -lefi -lgnuefi
%.efi: %.so
objcopy -j .text -j .sdata -j .data -j .dynamic \
-j .dynsym -j .rel -j .rela -j .reloc \
--target=efi-app-$(ARCH) $^ $#
reference:
http://www.rodsbooks.com/efi-programming/hello.html
In Ubuntu 18.04, these two lines:
LIB = /usr/lib64
EFILIB = /usr/lib64/gnuefi
need to be changed to:
LIB = /usr/lib
EFILIB = /usr/lib

error: no multiboot header found

This day found something that caught my attention. is build a simple bare OS
i read how to make multiboot compliant, I'm using NASM and GCC, i need make a loader that has the multiboot header and call the main point of my system for that i have two files loader.asm and loader.ld
loader.asm
[BITS 32]
global start
start:
mov esp, _sys_stack
jmp stublet
ALIGN 4
mboot:
MBOOT_PAGE_ALIGN equ 1<<0
MBOOT_MEMORY_INFO equ 1<<1
MBOOT_HEADER_MAGIC equ 0x1BADB002
MBOOT_HEADER_FLAGS equ MBOOT_PAGE_ALIGN | MBOOT_MEMORY_INFO
MBOOT_CHECKSUM equ -(MBOOT_HEADER_MAGIC + MBOOT_HEADER_FLAGS)
; This is the GRUB Multiboot header. A boot signature
dd MBOOT_HEADER_MAGIC
dd MBOOT_HEADER_FLAGS
dd MBOOT_CHECKSUM
stublet:
EXTERN cmain
call cmain
jmp $
SECTION .bss
resb 8192
_sys_stack:
loader.ld
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
*(.rodata)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
main.c
int GenyKernel_Main()
{
char *str = "Hello world!", *ch;
unsigned short *vidmem = (unsigned short*) VIDEO_MEMORY;
unsigned i;
for (ch = str, i = 0; *ch; ch++, i++) {
vidmem[i] = (unsigned char) *ch | 0x0700;
}
return 0;
}
for build i'm using
# loader.o
nasm -f elf64 -o loader.o loader.asm
# main.o
gcc -fno-stack-protector -fno-builtin -nostdinc -O -g -Wall -I. -c -o main.o main.c
and the finally link
ld -T loader.ld -o kernel loader.o main.o
I've built a simple iso with grub-mkrescue and run with qemu but always I get
I think the problem is in the file loader.ld but i can't found where
After read lots about the same .asm file i finally understood the problem, the following snippet
align 4
multiboot_header:
dd MBOOT_MAGIC
dd MBOOT_FLAGS
dd MBOOT_CHECKSUM
must exist below a section to include appropriately with the linker
section .text ; .multiboot o whatever
align 4
multiboot_header:
dd MBOOT_MAGIC
dd MBOOT_FLAGS
dd MBOOT_CHECKSUM
and in the linker script
ENTRY(your_entry_point)
SECTIONS
{
. = 0x00100000;
.text ALIGN(0x1000) :
{
*(.multiboot)
*(.text)
}
// rest of sections
}

How to resolve make: *** [sdram] Error 1 at Eclipse

I'm trying to make a new project at Eclipse to my AT91sam9260 board.
This project is based on two atmel examples: basic-ssc-i2s and basic-emac-uip-telnet.
But when I'm working with these examples together, appear the error below:
make: * [sdram] Error 1
I don't know why, I've been thinking about and I think that is because has some error at Makefile file!
Anyone could help me?
Thank
The makefile:
CHIP = at91sam9260
BOARD = at91sam9260-ek
# Trace level used for compilation
# (can be overriden by adding TRACE_LEVEL=#number to the command-line)
TRACE_LEVEL = 4
# Optimization level, put in comment for debugging
#OPTIMIZATION = -Os
# AT91 library directory
AT91LIB = ../at91lib
# Output file basename
OUTPUT = basic-ssc-i2s-at73c213-project-$(BOARD)-$(CHIP)
# Compile for all memories available on the board (this sets $(MEMORIES))
include $(AT91LIB)/boards/$(BOARD)/board.mak
# Output directories
BIN = bin
OBJ = obj
#-------------------------------------------------------------------------------
# Tools
#-------------------------------------------------------------------------------
# Tool suffix when cross-compiling
CROSS_COMPILE = arm-none-eabi-
# Compilation tools
CC = $(CROSS_COMPILE)gcc
SIZE = $(CROSS_COMPILE)size
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy
# Flags
INCLUDES = -I$(AT91LIB)/boards/$(BOARD) -I$(AT91LIB)/peripherals
INCLUDES += -I$(AT91LIB)/components -I$(AT91LIB) -I.
CFLAGS = -Wall -mlong-calls -mstructure-size-boundary=8 -ffunction-sections
CFLAGS += -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -DTRACE_LEVEL=$(TRACE_LEVEL)
ASFLAGS = -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D__ASSEMBLY__
LDFLAGS = -g $(OPTIMIZATION) -nostartfiles -Wl,--gc-sections
#-------------------------------------------------------------------------------
# Files
#-------------------------------------------------------------------------------
# Directories where source files can be found
PERIPH = $(AT91LIB)/peripherals
BOARDS = $(AT91LIB)/boards
UTILITY = $(AT91LIB)/utility
COMP = $(AT91LIB)/components
# uIP library directory
UIPLIB = ../external_libs/ethernet/uip
VPATH += $(COMP)/dac-at73c213
VPATH += $(COMP)/ethernet/dm9161
VPATH += $(UTILITY)
VPATH += $(PERIPH)/dbgu $(PERIPH)/pio $(PERIPH)/aic $(PERIPH)/ssc $(PERIPH)/spi $(PERIPH)/pmc
VPATH += $(PERIPH)/cp15 $(PERIPH)/emac $(PERIPH)/rstc $(PERIPH)/usart $(PERIPH)/tc
VPATH += $(BOARDS)/$(BOARD) $(BOARDS)/$(BOARD)/$(CHIP)
VPATH += $(UIPLIB)/uip
VPATH += $(UIPLIB)/lib
VPATH += $(UIPLIB)/apps/dhcpc
#VPATH += $(UIPLIB)/apps/telnetd
INCLUDES += -I$(UTILITY)
INCLUDES += -I$(UIPLIB)/uip
INCLUDES += -I$(UIPLIB)/lib
INCLUDES += -I$(UIPLIB)/apps/dhcpc
#INCLUDES += -I$(UIPLIB)/apps/telnetd
# Objects built from C source files
C_OBJECTS = main.o
C_OBJECTS += at73c213.o dm9161.o protocol.o
C_OBJECTS += wav.o stdio.o math.o emac.o rstc.o tc.o usart.o
C_OBJECTS += dbgu.o pio.o ssc.o aic.o spi.o pmc.o cp15.o
C_OBJECTS += board_memories.o board_lowlevel.o
#UIP:
#lib
C_OBJECTS += memb.o
#uip
C_OBJECTS += psock.o timer.o uip.o uip_arp.o
#main
C_OBJECTS += clock-arch.o tapdev.o
#dhcp
C_OBJECTS += dhcpc.o
#telnetd
#C_OBJECTS += shell.o telnetd.o
# Objects built from Assembly source files
ASM_OBJECTS = board_cstartup.o
ASM_OBJECTS += cp15_asm.o
# Append OBJ and BIN directories to output filename
OUTPUT := $(BIN)/$(OUTPUT)
#-------------------------------------------------------------------------------
# Rules
#-------------------------------------------------------------------------------
all: $(BIN) $(OBJ) $(MEMORIES)
$(BIN) $(OBJ):
mkdir $#
define RULES
C_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(C_OBJECTS))
ASM_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(ASM_OBJECTS))
$(1): $$(ASM_OBJECTS_$(1)) $$(C_OBJECTS_$(1))
$(CC) $(LDFLAGS) -T"$(AT91LIB)/boards/$(BOARD)/$(CHIP)/$$#.lds" -o $(OUTPUT)-$$#.elf $$^
$(OBJCOPY) -O binary $(OUTPUT)-$$#.elf $(OUTPUT)-$$#.bin
$(SIZE) $$^ $(OUTPUT)-$$#.elf
$$(C_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN)
$(CC) $(CFLAGS) -D$(1) -c -o $$# $$<
$$(ASM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.S Makefile $(OBJ) $(BIN)
$(CC) $(ASFLAGS) -D$(1) -c -o $$# $$<
debug_$(1): $(1)
perl ../resources/gdb/debug.pl $(OUTPUT)-$(1).elf
endef
$(foreach MEMORY, $(MEMORIES), $(eval $(call RULES,$(MEMORY))))
clean:
-rm -f $(OBJ)/*.o $(BIN)/*.bin $(BIN)/*.elf