justanhduc / task-spooler

A scheduler for GPU/CPU tasks
https://justanhduc.github.io/2021/02/03/Task-Spooler.html
GNU General Public License v2.0
273 stars 24 forks source link

[cpu-only] Fail to build: multiple definition of `logdir' #15

Closed AdelKS closed 2 years ago

AdelKS commented 2 years ago

Hello,

I tried to build it but apparently I am hitting against an issue

➜  task-spooler git:(cpu-only) ./install_make 
GIT_VERSION=$(echo $(git describe --dirty --always --tags) | tr - +); \
cc -pedantic -ansi -Wall -g -O0 -std=c11 -D_XOPEN_SOURCE=500 -D__STRICT_ANSI__ -DTS_VERSION=${GIT_VERSION} -c main.c -o main.o
cc -pedantic -ansi -Wall -g -O0 -std=c11 -D_XOPEN_SOURCE=500 -D__STRICT_ANSI__ -c server.c -o server.o
cc -pedantic -ansi -Wall -g -O0 -std=c11 -D_XOPEN_SOURCE=500 -D__STRICT_ANSI__ -c server_start.c -o server_start.o
cc -pedantic -ansi -Wall -g -O0 -std=c11 -D_XOPEN_SOURCE=500 -D__STRICT_ANSI__ -c client.c -o client.o
cc -pedantic -ansi -Wall -g -O0 -std=c11 -D_XOPEN_SOURCE=500 -D__STRICT_ANSI__ -c msgdump.c -o msgdump.o
cc -pedantic -ansi -Wall -g -O0 -std=c11 -D_XOPEN_SOURCE=500 -D__STRICT_ANSI__ -c jobs.c -o jobs.o
cc -pedantic -ansi -Wall -g -O0 -std=c11 -D_XOPEN_SOURCE=500 -D__STRICT_ANSI__ -c execute.c -o execute.o
cc -pedantic -ansi -Wall -g -O0 -std=c11 -D_XOPEN_SOURCE=500 -D__STRICT_ANSI__ -c msg.c -o msg.o
cc -pedantic -ansi -Wall -g -O0 -std=c11 -D_XOPEN_SOURCE=500 -D__STRICT_ANSI__ -c mail.c -o mail.o
cc -pedantic -ansi -Wall -g -O0 -std=c11 -D_XOPEN_SOURCE=500 -D__STRICT_ANSI__ -c error.c -o error.o
cc -pedantic -ansi -Wall -g -O0 -std=c11 -D_XOPEN_SOURCE=500 -D__STRICT_ANSI__ -c signals.c -o signals.o
cc -pedantic -ansi -Wall -g -O0 -std=c11 -D_XOPEN_SOURCE=500 -D__STRICT_ANSI__ -c list.c -o list.o
cc -pedantic -ansi -Wall -g -O0 -std=c11 -D_XOPEN_SOURCE=500 -D__STRICT_ANSI__ -c print.c -o print.o
cc -pedantic -ansi -Wall -g -O0 -std=c11 -D_XOPEN_SOURCE=500 -D__STRICT_ANSI__ -c info.c -o info.o
cc -pedantic -ansi -Wall -g -O0 -std=c11 -D_XOPEN_SOURCE=500 -D__STRICT_ANSI__ -c env.c -o env.o
cc -pedantic -ansi -Wall -g -O0 -std=c11 -D_XOPEN_SOURCE=500 -D__STRICT_ANSI__ -c tail.c -o tail.o
cc  -o ts main.o server.o server_start.o client.o msgdump.o jobs.o execute.o msg.o mail.o error.o signals.o list.o print.o info.o env.o tail.o
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: jobs.o:/home/adel/Documents/Gethings/task-spooler/jobs.c:43: multiple definition of `logdir'; server.o:/home/adel/Documents/Gethings/task-spooler/server.c:40: first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:29: ts] Error 1

Same goes with install_cmake

Thanks!

justanhduc commented 2 years ago

Hi @AdelKS. Unfortunately I cannot reproduce the error when installing from the latest commit of the CPU-only version. Could you please let me know some details about your environment and which commit you installed from?

AdelKS commented 2 years ago

It the latest commit 9322187 (HEAD -> cpu-only, origin/cpu-only) update changelog. The machine I tried compiling on run on Gentoo. This is my current environment:

➜  task-spooler git:(cpu-only) printenv
LESS=-R -M --shift 5
LV2_PATH=/usr/lib64/lv2
GDMSESSION=lxqt
DESKTOP_SESSION=lxqt
PWD=/home/adel/Documents/Gethings/task-spooler
LOGNAME=adel
EDITOR=/bin/nano
MAIL=/var/mail/adel
INFOPATH=/usr/share/gcc-data/x86_64-pc-linux-gnu/11.2.1/info:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37_p1/info:/usr/share/info
JAVAC=/etc/java-config-2/current-system-vm/bin/javac
ANT_HOME=/usr/share/ant
GSETTINGS_BACKEND=dconf
XDG_SESSION_TYPE=x11
SYSTEMD_EXEC_PID=1648
PATH=/home/adel/bin:/home/adel/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/13/bin
HOME=/home/adel
USERNAME=adel
XDG_CACHE_HOME=/home/adel/.cache
USER=adel
DISPLAY=:0
MOTD_SHOWN=pam
LANG=en_US.UTF-8
XAUTHORITY=/run/user/1000/gdm/Xauthority
XDG_SESSION_ID=2
PAGER=/usr/bin/less
QT_PLATFORM_PLUGIN=lxqt
XDG_SESSION_DESKTOP=lxqt
JAVA_HOME=/etc/java-config-2/current-system-vm
XDG_RUNTIME_DIR=/run/user/1000
XDG_CURRENT_DESKTOP=LXQt
XDG_DATA_HOME=/home/adel/.local/share
LESSOPEN=|lesspipe %s
XDG_CONFIG_DIRS=/etc/xdg:/usr/share
GNOME_TERMINAL_SERVICE=:1.66
GCC_SPECS=
SHELL=/bin/zsh
XDG_DATA_DIRS=/usr/local/share:/usr/share:/usr/share/gdm
XDG_CONFIG_HOME=/home/adel/.config
XDG_SESSION_CLASS=user
VTE_VERSION=6602
GDM_LANG=en_US.UTF-8
GTK_MODULES=canberra-gtk-module
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
MANPAGER=manpager
CONFIG_PROTECT_MASK=/etc/sandbox.d /etc/fonts/fonts.conf /etc/gentoo-release /etc/terminfo /etc/dconf /etc/ca-certificates.conf /etc/texmf/web2c /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/revdep-rebuild
LADSPA_PATH=/usr/lib64/ladspa
GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/8d91fbfb_7ee6_48cb_aa81_288fb658df46
XDG_VTNR=2
GTK_OVERLAY_SCROLLING=0
QT_QPA_PLATFORMTHEME=lxqt
LXQT_SESSION_CONFIG=session
TERM=xterm-256color
XDG_MENU_PREFIX=lxqt-
GTK_CSD=0
COLORTERM=truecolor
MANPATH=/etc/java-config-2/current-system-vm/man:/usr/share/gcc-data/x86_64-pc-linux-gnu/11.2.1/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37_p1/man:/etc/java-config-2/current-system-vm/man/:/usr/local/share/man:/usr/share/man:/usr/lib/rust/man:/usr/lib/llvm/13/share/man
WINDOWPATH=2
JDK_HOME=/etc/java-config-2/current-system-vm
XDG_SEAT=seat0
SHLVL=1
OLDPWD=/home/adel
ZSH=/home/adel/.oh-my-zsh

Is it normal that the build is in debug ? I just realized it is getting compiled with -O0 -g, that's probably the issue

justanhduc commented 2 years ago

Hi @AdelKS. I checked the code again and indeed there is a redundant definition of a global variable, which somehow is tolerated on Ubuntu. Debug config probably inline a lot of things so the error is not visible too. So I pushed a fix. Could you please check and let me know if there is any other issue?

AdelKS commented 2 years ago

It builds all good now, thanks!