Now I cross-compile and link my code with both dynamic and static libraries, but the following error occurs: can't find lstdc + +(make error 1);
If I changed $LD to $CC, another issues occured: can't find -lpaho-mqtt3a(make error 2), what's going on?
change $(LD)
$(TARGET):$(OBJS)
$(LD) -o $(OUTPUT_DIR)/$(TARGET) $(OBJS) $(CFLAGS_OTHERS_LIB)
$(LIB_FOR_SRS) $(LINK_OPTION)
$(STRIP) $(OUTPUT_DIR)/$(TARGET)
to $(CC)
$(TARGET):$(OBJS)
$(CC) -o $(OUTPUT_DIR)/$(TARGET) $(OBJS) $(CFLAGS_OTHERS_LIB)
$(LIB_FOR_SRS) $(LINK_OPTION)
$(STRIP) $(OUTPUT_DIR)/$(TARGET)
I use these dynamic and static libraries to compile links:
paho-mqtt3a.so libjson-c.a libjson-c.la libsqlite3.so libsqlite3.la libsqlite3.a srs_librtmp.a
libssl.a libcrypto.a
Makefile :
COMPILE = aarch64-linux-gnu-
CC = $(COMPILE)gcc
STRIP = $(COMPILE)strip
LD = $(COMPILE)ld
COMPILE_OPTION = -Wall -Wcomment -Wformat -Wmissing-braces -Wswitch -Wuninitialized
\
-Wbad-function-cast -Waggregate-return -Wmultichar -Wsign-compare -
Wshadow
#COMPILE_OPTION_DEBUG = -gdwarf-2 -g
COMPILE_ALL_OPTION += $(COMPILE_OPTION) $(COMPILE_OPTION_DEBUG)
LINK_OPTION = -lpaho-mqtt3a -ljson-c -lsqlite3 -lm -lc -lpthread -ldl -lstdc++ -static
LIB_FOR_JSON = ./lib/json_lib/*
LIB_FOR_MQTT = ./lib/mqtt_lib/*
LIB_FOR_SQLITE3 = ./lib/sqlite3_lib/*
LIB_FOR_SRS = ./lib/srslibrtmp_lib/*
SRC_DIR = ./src
OUTPUT_DIR = ./output
SYS_LOCAL_LIB_DIR = /usr/local/lib
OBJS_MAIN = main.o
OBJS_EC_UART_232 = ec_uart_232.o
OBJS_EC_UART_485 = ec_uart_485.o
OBJS_EC_MANAGE_PLCE = ec_manage_plce.o
OBJS_EC_SOCKET_VIDEO = ec_socket_video.o
OBJS_EC_MQTT_ANDROID = ec_mqtt_android.o
OBJS_EC_SQLITE = ec_sqlite.o
OBJS_EC_STORE_INFO = ec_store_info.o
OBJS_EC_MANAGE_CAMERA = ec_manage_camera.o
OBJS_DEAL_REQUEST_LOOP = deal_request_loop.o
OBJS_PUSH_VIDEO = push_video.o
TARGET = ecSmartFire
RM = rm -rf
MV = mv
CP = cp -r
LDCONFIG = ldconfig
OBJS = $(OBJS_MAIN) $(OBJS_EC_UART_232) $(OBJS_EC_UART_485) $(OBJS_EC_MANAGE_PLCE)
$(OBJS_EC_SOCKET_VIDEO) \
$(OBJS_EC_MQTT_ANDROID) $(OBJS_EC_SQLITE) $(OBJS_EC_STORE_INFO) $(OBJS_EC_MANAGE_CAMERA)
$(OBJS_DEAL_REQUEST_LOOP) \
$(OBJS_PUSH_VIDEO)
$(TARGET):$(OBJS)
$(LD) -o $(OUTPUT_DIR)/$(TARGET) $(OBJS) $(CFLAGS_OTHERS_LIB) $(LIB_FOR_SRS) $(LINK_OPTION)
$(STRIP) $(OUTPUT_DIR)/$(TARGET)
$(OBJS_MAIN):
$(CC) -c $(SRC_DIR)/main.c $(COMPILE_ALL_OPTION)
$(OBJS_EC_UART_232):
$(CC) -c $(SRC_DIR)/ec_uart_232.c $(COMPILE_ALL_OPTION)
$(OBJS_EC_UART_485):
$(CC) -c $(SRC_DIR)/ec_uart_485.c $(COMPILE_ALL_OPTION)
$(OBJS_EC_MANAGE_PLCE):
$(CC) -c $(SRC_DIR)/ec_manage_plce.c $(COMPILE_ALL_OPTION)
$(OBJS_EC_SOCKET_VIDEO):
$(CC) -c $(SRC_DIR)/ec_socket_video.c $(COMPILE_ALL_OPTION)
$(OBJS_EC_MQTT_ANDROID):
$(CC) -c $(SRC_DIR)/ec_mqtt_android.c $(COMPILE_ALL_OPTION)
$(OBJS_EC_SQLITE):
$(CC) -c $(SRC_DIR)/ec_sqlite.c $(COMPILE_ALL_OPTION)
$(OBJS_EC_STORE_INFO):
$(CC) -c $(SRC_DIR)/ec_store_info.c $(COMPILE_ALL_OPTION)
$(OBJS_EC_MANAGE_CAMERA):
$(CC) -c $(SRC_DIR)/ec_manage_camera.c $(COMPILE_ALL_OPTION)
$(OBJS_DEAL_REQUEST_LOOP):
$(CC) -c $(SRC_DIR)/deal_request_loop.c $(COMPILE_ALL_OPTION)
$(OBJS_PUSH_VIDEO):
$(CC) -c $(SRC_DIR)/push_video.c $(COMPILE_ALL_OPTION)
.PHONY:clean copylib
clean:
-$(RM) $(OUTPUT_DIR)/* $(OBJS)
copylib:
$(CP) $(LIB_FOR_MQTT) $(SYS_LOCAL_LIB_DIR)/
$(CP) $(LIB_FOR_JSON) $(SYS_LOCAL_LIB_DIR)/
$(CP) $(LIB_FOR_SQLITE3) $(SYS_LOCAL_LIB_DIR)/
$(LDCONFIG)
make error 1:
...
no errors
...
aarch64-linux-gnu-gcc -c ./src/ec_store_info.c -Wall -Wcomment -Wformat -Wmissing-braces -
Wswitch -Wuninitialized -Wbad-function-cast -Waggregate-return -Wmultichar -Wsign-compare -
Wshadow
aarch64-linux-gnu-gcc -c ./src/ec_manage_camera.c -Wall -Wcomment -Wformat -Wmissing-braces -
Wswitch -Wuninitialized -Wbad-function-cast -Waggregate-return -Wmultichar -Wsign-compare -
Wshadow
aarch64-linux-gnu-gcc -c ./src/deal_request_loop.c -Wall -Wcomment -Wformat -Wmissing-braces -
Wswitch -Wuninitialized -Wbad-function-cast -Waggregate-return -Wmultichar -Wsign-compare -
Wshadow
aarch64-linux-gnu-gcc -c ./src/push_video.c -Wall -Wcomment -Wformat -Wmissing-braces -Wswitch
-Wuninitialized -Wbad-function-cast -Waggregate-return -Wmultichar -Wsign-compare -Wshadow
./src/push_video.c: In function 'PushVideoToServer':
./src/push_video.c:21:43: warning: pointer targets in passing argument 2 of
'srs_h264_write_raw_frames' differ in signedness [-Wpointer-sign]
ret = srs_h264_write_raw_frames(Rtmp, data, dataSize, DTS, PTS);
^~~~
In file included from ./src/push_video.c:2:
./src/../head/srs_librtmp/srs_librtmp.h:465:12: note: expected 'char *' but argument is of type
'unsigned char *'
extern int srs_h264_write_raw_frames(srs_rtmp_t rtmp, char* frames, int frames_size, uint32_t
dts, uint32_t pts);
^~~~~~~~~~~~~~~~~~~~~~~~~
./src/push_video.c: In function 'PushVideoFunction':
./src/push_video.c:86:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
aarch64-linux-gnu-ld -o ./output/ecSmartFire main.o ec_uart_232.o ec_uart_485.o ec_manage_plce.o
ec_socket_video.o ec_mqtt_android.o ec_sqlite.o ec_store_info.o ec_manage_camera.o
deal_request_loop.o push_video.o ./lib/srslibrtmp_lib/* -lpaho-mqtt3a -ljson-c -lsqlite3 -lm
-lc -lpthread -ldl -lstdc++ -static
aarch64-linux-gnu-ld: cannot find -lstdc++
make: *** [Makefile:51: ecSmartFire] Error 1
make error 2:
...
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-
gnu/bin/ld: cannot find -lpaho-mqtt3a
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-
gnu/bin/ld: ./lib/srslibrtmp_lib/srs_librtmp.a(srs_lib_simple_socket.o):
in function `srs_hijack_io_connect(void*, char const*, int)':
solved it.
1,as MadScientist said, I always use gcc to compile not ld.
2,I use option -Wl,-Bstatic and -Wl,-Bdynamic to separte static library and dynamic library.
$(TARGET):$(OBJS)
$(CC) -L $(LIB_FOR_SRS) -o $(OUTPUT_DIR)/$(TARGET) $(OBJS) -Wl,-Bstatic -lssl -
lcrypto \
-Wl,-Bdynamic $(DYNAMIC_LINK_OPTION) $(STATIC_LINK_OPTION)
$(STRIP) $(OUTPUT_DIR)/$(TARGET)
Related
I encountered a problem about makefile, I modified my 2 source files link_ec.c and link_cloud.c, and 2 head files link_ec.h and link_cloud.h, but makefile is not recompiled. Is there a problem with where it was written?
my makefile as follows:
LIB_FOR_JSON = ./lib/json_lib/*
LIB_FOR_MQTT = ./lib/mqtt_lib/*
SRC_DIR = ./src
OUTPUT_DIR = ./output
SYS_LOCAL_LIB_DIR = /usr/local/lib
TARGET = linkCloudApp
RM = rm -rf
MV = mv
CP = cp -r
LDCONFIG = ldconfig
#### compile comment #####
COMPILE = aarch64-linux-gnu-
CC = $(COMPILE)gcc
STRIP = $(COMPILE)strip
LD = $(COMPILE)ld
COMPILE_OPTION = -O2 -Wall -Wcomment -Wformat -Wmissing-braces -Wswitch -Wuninitialized \
-Wbad-function-cast -Waggregate-return -Wmultichar -Wsign-compare -Wshadow
#COMPILE_OPTION_DEBUG = -gdwarf-2 -g
COMPILE_ALL_OPTION += $(COMPILE_OPTION) $(COMPILE_OPTION_DEBUG)
LINK_OPTION = -lpaho-mqtt3a -ljson-c -lm -lpthread -lz
OBJS_MAIN = main.o
OBJS_LINK_EC = link_ec.o
OBJS_LINK_CLOUD = link_cloud.o
OBJS = $(OBJS_MAIN) $(OBJS_LINK_EC) $(OBJS_LINK_CLOUD)
$(TARGET):$(OBJS)
$(CC) -o $(OUTPUT_DIR)/$(TARGET) $(OBJS) $(LINK_OPTION)
$(STRIP) $(OUTPUT_DIR)/$(TARGET)
$(OBJS_MAIN):
$(CC) -c $(SRC_DIR)/main.c $(COMPILE_ALL_OPTION)
$(OBJS_LINK_EC):
$(CC) -c $(SRC_DIR)/link_ec.c $(COMPILE_ALL_OPTION)
$(OBJS_LINK_CLOUD):
$(CC) -c $(SRC_DIR)/link_cloud.c $(COMPILE_ALL_OPTION)
.PHONY:clean copylib
clean:
-$(RM) $(OUTPUT_DIR)/* $(OBJS)
copylib:
$(CP) $(LIB_FOR_MQTT) $(SYS_LOCAL_LIB_DIR)/
$(CP) $(LIB_FOR_JSON) $(SYS_LOCAL_LIB_DIR)/
$(LDCONFIG)
Your object file recipes don't have any dependencies associated with them, so they won't get built unless you specify them explicitly.
Add the .c files to the dependency lists:
$(OBJS_MAIN): $(SRC_DIR)/main.c
$(CC) -c $(SRC_DIR)/main.c $(COMPILE_ALL_OPTION)
$(OBJS_LINK_EC): $(SRC_DIR)/link_ec.c
$(CC) -c $(SRC_DIR)/link_ec.c $(COMPILE_ALL_OPTION)
$(OBJS_LINK_CLOUD): $(SRC_DIR)/link_cloud.c
$(CC) -c $(SRC_DIR)/link_cloud.c $(COMPILE_ALL_OPTION)
Or you could make a single generic target for all of your .o files:
%.o: $(SRC_DIR)/%.c
$(CC) $(COMPILE_ALL_OPTION) -c $<
I've been reading so many make guide but I still cant make it work.
I'm trying to create a makefile that creates different programs, each program has its own source file (.c) but they all use the same header file (.h) nad all the files are in the same directory.
For now i have this:
CC = gcc
CFLAGS = -std=c99 -g -c -Wall
LFLAGS = -std=c99 -g -c -Wall
OBJS = nivel1.o nivel2.o nivel3.o nivel4.o nivel5.o nivel6.o my_shell.o
OUT = nivel1,nivel2,nivel3,nivel4,nivel5,nivel6,my_shell
OBJS0 = nivel1.o
SOURCE0 = nivel1.c
HEADER0 = my_shell.h
OUT0 = nivel1
OBJS1 = nivel2.o
SOURCE1 = nivel2.c
HEADER1 = my_shell.h
OUT1 = nivel2
OBJS2 = nivel3.o
SOURCE2 = nivel3.c
HEADER2 = my_shell.h
OUT2 = nivel3
OBJS3 = nivel4.o
SOURCE3 = nivel4.c
HEADER3 = my_shell.h
OUT3 = nivel4
OBJS4 = nivel5.o
SOURCE4 = nivel5.c
HEADER4 = my_shell.h
OUT4 = nivel5
OBJS5 = nivel6.o
SOURCE5 = nivel6.c
HEADER5 = my_shell.h
OUT5 = nivel6
OBJS6 = my_shell.o
SOURCE6 = my_shell.c
HEADER6 = my_shell.h
OUT6 = my_shell
all: nivel1 nivel2 nivel3 nivel4 nivel5 nivel6 my_shell
nivel1: $(OBJS0) $(LFLAGS)
$(CC) -g $(OBJS0) -o $(OUT0)
nivel2: $(OBJS1) $(LFLAGS)
$(CC) -g $(OBJS1) -o $(OUT1)
nivel3: $(OBJS2) $(LFLAGS)
$(CC) -g $(OBJS2) -o $(OUT2)
nivel4: $(OBJS3) $(LFLAGS)
$(CC) -g $(OBJS3) -o $(OUT3)
nivel5: $(OBJS4) $(LFLAGS)
$(CC) -g $(OBJS4) -o $(OUT4)
nivel6: $(OBJS5) $(LFLAGS)
$(CC) -g $(OBJS5) -o $(OUT5)
my_shell: $(OBJS6) $(LFLAGS)
$(CC) -g $(OBJS6) -o $(OUT6)
nivel1.o: nivel1.c
$(CC) $(FLAGS) nivel1.c -std=c99
nivel2.o: nivel2.c
$(CC) $(FLAGS) nivel2.c -std=c99
nivel3.o: nivel3.c
$(CC) $(FLAGS) nivel3.c -std=c99
nivel4.o: nivel4.c
$(CC) $(FLAGS) nivel4.c -std=c99
nivel5.o: nivel5.c
$(CC) $(FLAGS) nivel5.c -std=c99
nivel6.o: nivel6.c
$(CC) $(FLAGS) nivel6.c -std=c99
my_shell.o: my_shell.c
$(CC) $(FLAGS) my_shell.c -std=c99
clean:
rm -f $(OBJS) $(OUT)
I've tried changing many things but nothing gets it to work,
any help would be appreciated!
PD: I need it to be std c99.
nivel1: $(OBJS0) $(LFLAGS)
$(CC) -g $(OBJS0) -o $(OUT0)
is wrong. That is why make complains. You specified a dependance on $(LFLAGS) but that is not a file or a target, that is just a flag definition used at compile-time. You probably want:
nivel1: $(OBJS0)
$(CC) $(LFLAGS) -g $(OBJS0) -o $(OUT0)
---EDIT---(suggested by Kaylum)
LFLAGS has a wrong value. Since this command is a linking phase, neither -std=c99, -c nor -Wall are usable.
I am trying to compile a program and I have to set the paths to the NETCDF inc and lib directories in the Makefile as well as set the gfortran and c compiler settings. The variables were already named as shown below, it just told me to edit the paths/options which I have tried to do. Here is what I have for my netcdf inc and lib, as well as the hdf5:
NETCDFINC = -I$(NETCDFF_INCDIR) -I$(NETCDFC_INCDIR)
NETCDFLIB = -Wl,-rpath=$(NETCDFF_LIBDIR) -L$(NETCDFF_LIBDIR) -Wl,-
rpath=$(NETCDFC_LIBDIR) -L$(NETCDFC_LIBDIR) -Wl,-rpath=$(HDF5_LIBDIR) -
L$(HDF5_LIBDIR) -lhdf5_hl -lhdf5 -lz
Note that the NETCDFLIB is on one line on my file, and the paths of the variables are correct, but the syntax may not be.
Next for the fortran and c compiler information I have the following:
FC = gfortran -m64 -g -O0 -ffixed-line-length-132 -Wunused -Wuninitialized
CC = gcc
CFLAGS = -m64 -c -g -I. -DLONG32 -DUNDERSCORE -DLITTLE -Wunused -
Wuninitialized
Finally, when I run the program I first get a bunch of warnings such as:
oban_namelist.f90:495.29:
real :: flt
1
Warning: Unused variable 'flt' declared at (1)
Followed by a bunch of undefined reference errors such as:
oban.o: In function `check':
/uufs/chpc.utah.edu/common/home/zpu-
group3/dhodges/DART/data/radar/opaws/oban.f90:1902: undefined reference to
`__netcdf_MOD_nf90_strerror'
The error shouldn't be in this oban.o function since I didn't write it. The only things I have edited in the program I listed above for the netcdf path and gfortran/c information and so I think the error lies there. This is my first question on here, so if I missed anything you need feel free to ask. What can I try?
Edit: By request, this is the entire makefile I am using. Also, I just type 'make' to compile it per the instructions in the README file.
# Makefile for creating the OPAWS analysis software
#
# Rev: 02/05/10 LJW
# 12/05/10 DCD
# 02/11/11 LJW
#
# netCDF4 libs - you need to fill in the blanks
NETCDFINC = -I$(NETCDFF_INCDIR) -I$(NETCDFC_INCDIR)
NETCDFLIB = -Wl,-rpath=$(NETCDFF_LIBDIR) -L$(NETCDFF_LIBDIR) -Wl,-rpath=$(NETCDFC_LIBDIR) -L$(NETCDFC_LIBDIR) -Wl,-rpath=$(HDF5_LIBDIR) -
L$(HDF5_LIBDIR) -lhdf5_hl -lhdf5 -lz
# Fortran and C compiler information - various configurations are setup, try and find one close
#=====>> Gfortran
#
FC = gfortran -m64 -g -O0 -ffixed-line-length-132 -Wunused -Wuninitialized
CC = gcc
CFLAGS = -m64 -c -g -I. -DLONG32 -DUNDERSCORE -DLITTLE -Wunused -Wuninitialized
# Leave this stuff alone
EXEC = x.oban
EXECcs = x.clutter_stats
EXECmd = mosaic_2_dart
OBJS = DART.o oban_module.o dict_module.o oban_namelist.o derived_types.o util.o fileio.o read_dorade.o binio.o v5d.o
OBJScs = DART.o dict_module.o oban_namelist.o derived_types.o fileio.o util.o read_dorade.o binio.o v5d.o
OBJSmd = DART.o dict_module.o oban_namelist.o derived_types.o fileio.o util.o read_dorade.o binio.o v5d.o
default: $(EXEC) $(EXECcs) $(EXECmd)
$(EXEC): $(OBJS) oban.o
$(FC) $(OPT) -o $(EXEC) oban.o $(OBJS) $(NETCDFLIB)
$(EXECcs): $(OBJScs) clutter_stats.o
$(FC) $(OPT) -o $(EXECcs) clutter_stats.o $(OBJScs) $(NETCDFLIB)
$(EXECmd): $(OBJSmd) mosaic_2_dart.o
$(FC) $(OPT) -o $(EXECmd) mosaic_2_dart.o $(OBJSmd) $(NETCDFLIB)
clean:
rm $(EXEC) oban.o $(OBJS) $(EXECcs) clutter_stats.o $(OBJScs) $(EXECmd) mosaic_2_dart.o $(OBJSmd) *.mod ncgen.input *.pyc sweep_file_list.txt
# Individual compilation instructions
oban.o: oban.f90 structures.inc opaws.inc DART.o
$(FC) $(OPT) -c $(NETCDFINC) oban.f90
clutter_stats.o: clutter_stats.f90 opaws.inc
$(FC) $(OPT) -c $(NETCDFINC) clutter_stats.f90
mosaic_2_dart.o: mosaic_2_dart.f90 opaws.inc
$(FC) $(OPT) -c $(NETCDFINC) mosaic_2_dart.f90
oban_module.o: oban_module.f90 derived_types.o opaws.inc
$(FC) $(OPT) -c oban_module.f90
read_dorade.o: read_dorade.c read_dorade.h
$(CC) $(CFLAGS) -c read_dorade.c
fileio.o: fileio.f90
$(FC) $(OPT) $(NETCDFINC) -c fileio.f90
util.o: util.f opaws.inc structures.inc
$(FC) $(OPT) -c util.f
DART.o: DART.f
$(FC) $(OPT) -c DART.f
derived_types.o: derived_types.f90
$(FC) $(OPT) -c derived_types.f90
oban_namelist.o: oban_namelist.f90 opaws.inc
$(FC) $(OPT) -c oban_namelist.f90
dict_module.o: dict_module.f90
$(FC) $(OPT) -c dict_module.f90
binio.o: binio.c
$(CC) $(CFLAGS) binio.c -o binio.o
v5d.o: v5d.c
$(CC) $(CFLAGS) v5d.c -o v5d.o
The problem was solved by editing the NETCDFLIB line as follows:
I edited the NETCDFLIB line as follows and it works: NETCDFLIB = -Wl,-
rpath=$(NETCDFF_LIBDIR) -L$(NETCDFF_LIBDIR) -Wl,-rpath=$(NETCDFC_LIBDIR) -
L$(NETCDFC_LIBDIR) -lnetcdff -lnetcdf -lm -Wl,-rpath=$(HDF5_LIBDIR) -
L$(HDF5_LIBDIR) -lhdf5_hl -lhdf5 -lz
Basically I just needed to add:
-lnetcdff -lnetcdf -lm
This allowed for the compiler to get access to the libraries it needed that were originally undefined.
I try to launch my executable but i got this error:
.dudac/stage/monkey/lib/hello.duda: undefined symbol: DDS_sequence_BoardGlobalParameters_BoardGPSoftState__alloc
Whereas link and compile work fine
Here is my makefile:
# ====================================
# Date : Tue 21, Feb 2017 at 10:15
NAME = hello
CC = /opt/windriver/wrlinux-small/7.0-xxxxxx-3543dr/sysroots/x86_64-wrlinuxsdk-linux/usr/bin/arm-wrs-linux-gnueabi/arm-wrs-linux-gnueabi-gcc
CFLAGS = -g -Wall -DDEBUG -L/opt/PrismTech/Vortex_v2/Device/VortexOpenSpliceRTE/6.7.1p2/RTS/armv7at2_vfp_neon.WRlinux7_gcc/lib -ldcpssac -ldcpsisocpp2
#-g -Wall -DDEBUG -fPIC
LDFLAGS =
DEFS =
INCDIR = -I/home/T0181049/.dudac/stage/monkey//include/ -I/home/T0181049/.dudac/stage/monkey//src/include -I/home/T0181049/.dudac/stage/monkey//plugins/duda/src -I/home/T0181049/.dudac/stage/monkey//plugins/duda/ -I/opt/PrismTech/Vortex_v2/Device/VortexOpenSpliceRTE/6.7.1p2/HDE/armv7at2_vfp_neon.WRlinux7_gcc/include -I/opt/PrismTech/Vortex_v2/Device/VortexOpenSpliceRTE/6.7.1p2/HDE/armv7at2_vfp_neon.WRlinux7_gcc/include/dcps/C/SAC -I/opt/PrismTech/Vortex_v2/Device/VortexOpenSpliceRTE/6.7.1p2/HDE/armv7at2_vfp_neon.WRlinux7_gcc/include/sys -I/opt/PrismTech/Vortex_v2/Device/VortexOpenSplice/6.7.1p1/HDE/x86_64.linux/include -I/opt/PrismTech/Vortex_v2/Device/VortexOpenSplice/6.7.1p1/HDE/x86_64.linux/include/sys -I/opt/windriver/wrlinux-small/7.0-xxxxx-3543dr/sysroots/armv7at2-vfp-neon-wrs-linux-gnueabi/usr/include -I/opt/windriver/wrlinux-small/7.0-xxxxx-3543dr/sysroots/armv7at2-vfp-neon-wrs-linux-gnueabi/usr/include/c++ -I/opt/windriver/wrlinux-small/7.0-xxxxxx-3543dr/sysroots/armv7at2-vfp-neon-wrs-linux-gnueabi/usr/include/c++/4.9.1 -I/opt/windriver/wrlinux-small/7.0-xxxxxx-3543dr/sysroots/armv7at2-vfp-neon-wrs-linux-gnueabi/usr/include/c++/4.9.1/arm-windriverv7atneon-linux-gnueabi -I/opt/windriver/wrlinux-small/7.0-xxxxx-3543dr/sysroots/armv7at2-vfp-neon-wrs-linux-gnueabi/usr/include/c++/4.9.1/backward -I/opt/windriver/wrlinux-small/7.0-xxxxx-3543dr/sysroots/armv7at2-vfp-neon-wrs-linux-gnueabi/usr/include/dtc -I/opt/windriver/wrlinux-small/7.0-xxxxxx-3543dr/sysroots/x86_64-wrlinuxsdk-linux/usr/lib/arm-wrs-linux-gnueabi/gcc/arm-wrs-linux-gnueabi/4.9.1/include -I/opt/windriver/wrlinux-small/7.0-xxxxx-3543dr/sysroots/x86_64-wrlinuxsdk-linux/usr/lib/arm-wrs-linux-gnueabi/gcc/arm-wrs-linux-gnueabi/4.9.1/include-fixed
OBJECTS = main.o
_PATH = $(patsubst /%, %, $(CURDIR))
_CC = #/bin/echo -e " [\033[33mCC\033[0m] $#"; $(CC)
_DD = #/bin/echo -e " [\033[32mDD\033[0m] $#"; $(CC)
_CC_QUIET = #/bin/echo -n; $(CC)
all: $(NAME).duda
$(NAME).duda: $(OBJECTS)
$(_DD) $(CFLAGS) $(DEFS) -shared -o $# $^ -lc $(LDFLAGS)
.c.o:
$(_CC) -c $(CFLAGS) $(DEFS) $(INCDIR) -fPIC $<
$(_CC_QUIET) -MM -MP $(CFLAGS) $(DEFS) $(INCDIR) $*.c -o $*.d > /dev/null &2>&1
clean:
rm -rf *.o *.d *~ $(NAME).duda
How do i resolve that ?
Thanks
During linking you have specified libraries that are not in the standard path
Solutions
link statically
Use LD_LIBRARY_PATH
Use LD_PRELOAD
Use rpath
I try to use rpath just like this but got the same error:
CFLAGS = -g -Wall -DDEBUG -L/opt/PrismTech/Vortex_v2/Device/VortexOpenSpliceRTE/6.7.1p2/HDE/armv7at2_vfp_neon.WRlinux7_gcc/lib -Wl,-rpath,/opt/PrismTech/Vortex_v2/Device/VortexOpenSpliceRTE/6.7.1p2/HDE/armv7at2_vfp_neon.WRlinux7_gcc/lib -ldcpssac -ldcpsisocpp2
Here is my makefile code :
CC = gcc
IFLAGS = -Iinclude
CFLAGS = -std=c99 -fPIC -pedantic -Wall -Wextra -c # -march=native -ggdb3
LFLAGS = -shared -lX11 # -march=native -ggdb3
DFLAGS = -L./lib -lOSPOOC
TARGET = lib/libOSPOOC.so
SOURCES = $(shell echo src/*.c)
HEADERS = $(shell echo include/*.h)
OBJECTS = $(patsubst %.c,%.o, $(SOURCES))
# CURLIBPATH = $(PWD)/lib
# LDLIBPATH = $(shell echo $(LD_LIBRARY_PATH) | grep $(CURLIBPATH))
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(CC) $(LFLAGS) -o $(TARGET) $(OBJECTS)
*.o: *.c
echo allo
$(CC) $(IFLAGS) $(CFLAGS) -o $# $<
demo: $(TARGET) demo/windows.c
$(CC) $(IFLAGS) -o bin/windows demo/windows.c $(DFLAGS)
clean:
rm -r */*.o */*.so bin/*
The rule *.o is not called, and, I don't know how, but it compiles correctly...
Result :
make demo
gcc -std=c99 -fPIC -pedantic -Wall -Wextra -c -c -o src/OSPobj.o src/OSPobj.c
gcc -std=c99 -fPIC -pedantic -Wall -Wextra -c -c -o src/OSPutl.o src/OSPutl.c
gcc -std=c99 -fPIC -pedantic -Wall -Wextra -c -c -o src/OSPwin.o src/OSPwin.c
gcc -shared -lX11 -o lib/libOSPOOC.so src/OSPobj.o src/OSPutl.o src/OSPwin.o
gcc -Iinclude -o bin/windows demo/windows.c -L./lib -lOSPOOC
The problem is that -c is used twice, and echo allo isn't event called...
What do I don't understand, why do I have this strange behaviour?
Ok that's not *.o: *.c but %.o: %.c
*.o is for bash, %.o is for make