Click here to Skip to main content
15,902,114 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm working on a base project by someone else and I'm kind of new to the linux system.

I know how to use sqlite3 in Windows' Visual Studio, however in linux it's not working.

I've come to the thought that it might be because of the make file, here it is:

LIBPS4	:=	$(PS4SDK)/libPS4

TEXT	:=	0x926200000
DATA	:=	0x926300000

CC	:=	gcc
AS	:=	gcc
OBJCOPY	:=	objcopy
ODIR	:=	build
SDIR	:=	source
IDIRS	:=	-I$(LIBPS4)/include -I. -Iinclude
LDIRS	:=	-L$(LIBPS4) -L. -Llib
CFLAGS	:=	$(IDIRS) -O2 -std=gnu11 -fno-builtin -nostartfiles -nostdlib -Wall -masm=intel -march=btver2 -mtune=btver2 -m64 -mabi=sysv -mcmodel=large
SFLAGS	:=	-nostartfiles -nostdlib -masm=intel -march=btver2 -mtune=btver2 -m64 -mabi=sysv -mcmodel=large
LFLAGS	:=	$(LDIRS) -Xlinker -T $(LIBPS4)/linker.x -Wl,--build-id=none -Ttext=$(TEXT) -Tdata=$(DATA)
CFILES	:=	$(wildcard $(SDIR)/*.c)
SFILES	:=	$(wildcard $(SDIR)/*.s)
OBJS	:=	$(patsubst $(SDIR)/%.c, $(ODIR)/%.o, $(CFILES)) $(patsubst $(SDIR)/%.s, $(ODIR)/%.o, $(SFILES))

LIBS	:=	-lPS4 -lpthread

TARGET = $(shell basename $(CURDIR)).bin

$(TARGET): $(ODIR) $(OBJS)
	$(CC) $(LIBPS4)/crt0.s $(ODIR)/*.o -o temp.t $(CFLAGS) $(LFLAGS) $(LIBS)
	$(OBJCOPY) -O binary temp.t $(TARGET)
	rm -f temp.t

$(ODIR)/%.o: $(SDIR)/%.c
	$(CC) -c -o $@ $< $(CFLAGS)

$(ODIR)/%.o: $(SDIR)/%.s
	$(AS) -c -o $@ $< $(SFLAGS)

$(ODIR):
	@mkdir $@

.PHONY: clean

clean:
	rm -f $(TARGET) $(ODIR)/*.o



I'm getting an error of:

/usr/bin/ld: build/shell.o: undefined reference to symbol 'fflush@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libc.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status



how do i fix it?

What I have tried:

I've tried running the code in Windows' Visual studio and succeed, I've tried running it in Linux and failed.
ty in advance.
Posted
Updated 29-Mar-18 12:05pm

1 solution

Here's what I found. Looks like you need to add a reference to the library that fflush is in.

DSO missing from command line
 
Share this answer
 
Comments
Member 13227401 29-Mar-18 18:46pm    
fflush is a string.h function for all I know, string.h is in /usr/include, but I really didn't understand how to do it.
@Jon Shearin
Richard MacCutchan 30-Mar-18 5:22am    
fflush is part of stdio.h, nothing to do with strings. However, the issue you have is not a compiler problem. You need to include the standard C library 'libc', in your link options.
Member 13227401 30-Mar-18 9:30am    
You're right stdio.h my bad. I've already managed to compile it, but it didn't work. I've decided to give up on it for now.
I don't know if it's against the rules, but you can watch this :
https://askubuntu.com/questions/1020388/undefined-symbol-error
Richard MacCutchan 30-Mar-18 11:07am    
I just built the shell application using the command:
gcc -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION shell.c sqlite3.c as described at How To Compile SQLite[^]. I have not had time to try the full amalgamation, it's a job for the future.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900