0

I am trying to compile makefile using make command and bitbake recipe both are showing different error. Important part of Makedfile is shown below

CC = gcc
VERSION = 0.0.1
#CFLAGS =  -Wall -g -O2 -DRUN_AS_DAEMON -DFP_SIMULATOR -Dsplitmux_BOARD
CFLAGS =  -Wall -g -O2 -DRUN_AS_DAEMON -Dsplitmux_BOARD
CXXFLAGS = -Wall -O2
prefix = ${DESTDIR}/usr
includedir = $(prefix)/include
libdir = ${prefix}/lib
bindir = ${prefix}/bin
sbindir = ${prefix}/sbin
all:  Splitmux4K
LDFLAGS         = -L.
INSTALL = /usr/bin/install

SPLITMUX_SRCS = VideoMemory.cxx scalarSetRegisterT.cpp Receiver_new.cxx Transmitter.cxx Serializer.cxx VideoInput.cxx FpgaControl.cxx TempController.cxx DdcControl.cxx OSDController.cxx Monitor.cxx
SPLITMUX_OBJS = VideoMemory.o scalarSetRegisterT.o Receiver_new.o Transmitter.o Serializer.o VideoInput.o FpgaControl.o TempController.o DdcControl.o OSDController.o Monitor.o at91gpio.o

Splitmux4K: Splitmux4K.cxx $(SPLITMUX_SRCS) libsplitmuxdb.so libsplitmux.so libnetwork.so at91gpio.c libi2cbus.a libosdmenu.a
        $(CXX) $(CXXFLAGS) -c Splitmux4K.cxx -o Splitmux4K.o
        $(CXX) $(CXXFLAGS) -c VideoMemory.cxx -o VideoMemory.o
        $(CXX) $(CXXFLAGS) -c scalarSetRegisterT.cpp -o scalarSetRegisterT.o
        $(CXX) $(CXXFLAGS) -c Receiver_new.cxx -o Receiver_new.o
        $(CXX) $(CXXFLAGS) -c Transmitter.cxx -o Transmitter.o
        $(CXX) $(CXXFLAGS) -c Serializer.cxx -o Serializer.o
        $(CXX) $(CXXFLAGS) -c OSDController.cxx -o OSDController.o
        $(CXX) $(CXXFLAGS) -c FpgaControl.cxx -o FpgaControl.o
        $(CXX) $(CXXFLAGS) -c VideoInput.cxx -o VideoInput.o  
        $(CXX) $(CXXFLAGS) -c TempController.cxx -o TempController.o
        $(CXX) $(CXXFLAGS) -c DdcControl.cxx -o DdcControl.o
        $(CXX) $(CXXFLAGS) -c Monitor.cxx -o Monitor.o
        $(CXX) Splitmux4K.o $(SPLITMUX_OBJS) -o Splitmux4K  -Wall -static -L. -Wl,-Bdynamic -lnetwork -lsplitmuxdb -lsplitmux -lconfigxml -lmxml -lpthread -lrt -lssl -Wl,-Bstatic -li2cbus -losdmenu 

1)using make command

$make

error occurred is

g++ Splitmux4K.o VideoMemory.o scalarSetRegisterT.o Receiver_new.o Transmitter.o Serializer.o VideoInput.o FpgaControl.o TempController.o DdcControl.o OSDController.o Monitor.o at91gpio.o  -o Splitmux4K  -Wall -static -L. -Wl,-Bdynamic -lnetwork -lsplitmuxdb -lsplitmux -lconfigxml -lmxml -lpthread -lrt -lssl -Wl,-Bstatic -li2cbus -losdmenu 
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/libstdc++.a(eh_globals.o): undefined reference to symbol '__tls_get_addr@@GLIBC_2.3'
//lib/x86_64-linux-gnu/ld-linux-x86-64.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:167: recipe for target 'Splitmux4K' failed
make: *** [Splitmux4K] Error 1

2)bitbake recipe

scalar.bb file

SUMMARY = "bitbake-layers recipe"
DESCRIPTION = "Recipe created by bitbake-layers"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://Makefile"

S = "${WORKDIR}"

do_compile() {
        oe_runmake all 'CC=${CC}'
}

do_install() {
         oe_runmake install 'DESTDIR=${D}'
}

when i use bitbake scalar it show me error

Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: make -j 6 all CC=arm-poky-linux-gnueabi-gcc  -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a5 -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/user/my_dir/poky/build-microchip/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/scalar/1.0-r0/recipe-sysroot
| make: *** No rule to make target 'Splitmux4K.cxx', needed by 'Splitmux4K'.  Stop.
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /home/user/my_dir/poky/build-microchip/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi/scalar/1.0-r0/temp/log.do_compile.7440)

when i individually compile Splitmux4K.cxx or any related file it show following type error

undefined reference to `VideoMemory::GetOutHorzResolution() 
undefined reference to `VideoMemory::GetInputMemoryOffset(int)
undefined reference to `Receiver::GetVertWidth()

as @LetoThe2nd said i am not trying to pull files manually. Please help me to solve the error

Ganesh Khose
  • 11
  • 1
  • 8
  • Unrelated to your error, your makefile isn't very good. You shouldn't build a lot of source files in one rule, instead have lots of rules that build a single source file each. You also doesn't have dependencies on the source files you build. I also suggest you [read the documentation](https://www.gnu.org/software/make/manual/html_node/index.html), especially about [*implicit rules*](https://www.gnu.org/software/make/manual/html_node/Implicit-Rules.html#Implicit-Rules) which means you don't need one explicit rule per source file. – Some programmer dude Jan 21 '20 at 07:32
  • 1
    Maybe [here](https://stackoverflow.com/questions/19901934/libpthread-so-0-error-adding-symbols-dso-missing-from-command-line) is something helpful? Did you really wanted to use `gcc` and not `g++`? – YesThatIsMyName Jan 21 '20 at 07:32
  • i have build dependencies but i have uploaded only important part of Makefile.i dont know what is this error undefined reference to symbol '__tls_get_addr@@GLIBC_2.3' and why it occured – Ganesh Khose Jan 21 '20 at 07:35
  • yes i want to use gcc only. – Ganesh Khose Jan 21 '20 at 07:48
  • gcc won't compile c++. you need g++. – LetoThe2nd Jan 21 '20 at 07:56
  • even moreso, hand-crafting makefiles is hard, error-prone and totally unneded these days. we have autotools, cmake, meson. – LetoThe2nd Jan 21 '20 at 07:59
  • @LetoThe2nd The `gcc` and `g++` programs are just simple frontend programs that calls the "real" compiler (and linker, as needed). Both can be used to compiler C *or* C++. The problem is that `gcc` will not add some C++-specific flags when calling the actual compiler, so there might be problems with header files. `gcc` also don't link with the GCC C++ standard library. But by explicitly passing the right flags when invoking `gcc`, it can indeed be used to build C++ projects (but I won't recommend it). – Some programmer dude Jan 21 '20 at 08:00
  • 1
    @Someprogrammerdude You are 100% right. things I took into account for my somewhat simplified answer: 1) OP is trying to build with bitbake, e.g. the Yocto Project. Breaking conventions will just make things harder. 2) OP has a history of very introductory questions here. So I chose the answer that will work for him, without knowing the gory inner details. But again, once you get to the level, you are absolutely correct. – LetoThe2nd Jan 21 '20 at 08:06
  • @LetoThe2nd i tried using cmake also but i error is same undefined reference.i have not posted CMakefile.txt file here.i have not tried using auto tools.My aim is to compile that file. i thought bitbake is easy so i tried using it. – Ganesh Khose Jan 21 '20 at 10:22

0 Answers0