Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML Segmentation Fault on Static Build  (Read 2148 times)

0 Members and 1 Guest are viewing this topic.

flamendless

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
SFML Segmentation Fault on Static Build
« on: December 14, 2018, 01:44:06 pm »
Hi, Im using the SFML 2.5.1, I've already compiled the source to work with my clang/clang++ system version. I am using this Makefile to build my static linked project. When I run the executable, I get segmentation fault (core dumped) error (NOTE: There's no problem with compilation and linking and building)

Here's the Makefile content:
PROJECT_NAME := GeoMath
VERSION := 0.1.3
TYPE := Dynamic
PLATFORM := Linux#Windows
ARCHITECTURE := x86# x86_64
CONFIG := Debug#Release
CXXFLAGS := ${CXXFLAGS} -std=c++11 -Wall -W -pedantic
CXXFLAGS += -D_$(shell echo ${CONFIG} | tr a-z A-Z) -DVERSION=${VERSION}
SRC_DIR := src
INCLUDE_DIR := include

OBJ_DIR := bin
NAME := ${OBJ_DIR}/${PLATFORM}-${TYPE}
BUILD_DIR := build/${PLATFORM}-${TYPE}

LIB_IMGUI := ${INCLUDE_DIR}/imgui
LIB_IMGUI_SFML := ${INCLUDE_DIR}/imgui-sfml

SOURCES := $(wildcard ${SRC_DIR}/*.cpp)
SOURCES += $(wildcard ${LIB_IMGUI}/*.cpp)
SOURCES += $(wildcard ${LIB_IMGUI_SFML}/*.cpp)
SOURCES := $(filter-out ${LIB_IMGUI}/imgui_demo.cpp, ${SOURCES})

OBJECTS := $(patsubst $(SRC_DIR)/%.cpp, $(OBJ_DIR)/%.o, $(SOURCES))
INCLUDES := -I${LIB_IMGUI} -I${LIB_IMGUI_SFML}

ifeq ($(TYPE), Static)
  CXXFLAGS += -DSFML_STATIC
  LDDFLAGS := -Linclude/SFML/lib-clang
  LDDFLAGS += -lsfml-graphics-s -lsfml-window-s -lsfml-system-s
  LDDFLAGS += -lX11 -lXrandr -lpthread -lopenal -ludev -lfreetype -lGL
else
  LDDFLAGS := -lsfml-graphics -lsfml-window -lsfml-system
  LDDFLAGS += -lGL
endif

ifeq ($(PLATFORM), Windows)
  ifeq ($(ARCHITECTURE), x86_64)
    CC = x86_64-w64-mingw32-gcc
    CXX = x86_64-w64-mingw32-g++
  else
    CC = i686-w64-mingw32-gcc
    CXX = i686-w64-mingw32-g++
  endif
  INCLUDES += -Iinclude/SFML/include
  LINKS := -Linclude/SFML/lib
  LDDFLAGS += -lopengl32
  LINKS += ${LDDFLAGS}
else
  CC ?= clang
  CXX ?= clang++
  LINKS := ${LDDFLAGS}
endif

EXECUTABLE := ${PROJECT_NAME}-${CONFIG}-${TYPE}-${ARCHITECTURE}

${EXECUTABLE}: ${OBJECTS}
   ${CXX} ${CXXFLAGS} -o ${OBJ_DIR}/$@ $^ ${INCLUDES} ${LINKS}

$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
   ${CXX} ${CXXFLAGS} -c -o $@ $< ${INCLUDES}

test:
   ./${BUILD_DIR}/${EXECUTABLE}

compile:
   ${CXX} ${CXXFLAGS} -o ${BUILD_DIR}/${EXECUTABLE} ${SOURCES} ${INCLUDES} ${LINKS}

package-windows:
   make CONFIG=Release PLATFORM=Windows
   cd ${BUILD_DIR}/ && zip -9r GeoMath-${PLATFORM}-${TYPE}-${CONFIG}.zip .
« Last Edit: December 14, 2018, 04:08:21 pm by eXpl0it3r »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: SFML Segmentation Fault on Static Build
« Reply #1 on: December 14, 2018, 02:23:40 pm »
Use a debugger to get the call stack of the crash.

Is Imgui-SFML also linking SFML statically?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

flamendless

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: SFML Segmentation Fault on Static Build
« Reply #2 on: December 14, 2018, 02:27:49 pm »
Use a debugger to get the call stack of the crash.

Is Imgui-SFML also linking SFML statically?

imgui-sfml is only header lib.


flamendless

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: SFML Segmentation Fault on Static Build
« Reply #3 on: December 14, 2018, 02:40:56 pm »
Use a debugger to get the call stack of the crash.

Is Imgui-SFML also linking SFML statically?

okay, error is
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

i dont have any clue why that causes the error :/
« Last Edit: December 14, 2018, 04:08:36 pm by eXpl0it3r »

flamendless

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: SFML Segmentation Fault on Static Build
« Reply #4 on: December 19, 2018, 02:26:14 am »
Still no progress :(

 

anything