Skip to content

Conversation

@Rafi1018
Copy link
Contributor

This pull request addresses linker errors encountered during compilation due to missing symbols from the Abseil library. The errors were caused by the linker not being instructed to include all necessary Abseil libraries.

To resolve the issue, I have updated the Makefile to include the missing Abseil libraries explicitly. Specifically, I added -labsl_log_internal_check_op and -labsl_log_internal_message to the linker flags. These changes ensure that the linker can find the required symbols (_ZN4absl12lts_2024011612log_internal17MakeCheckOpStringIPKvS4_EEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEET_T0_PKc and _ZN4absl12lts_2024011612log_internal17MakeCheckOpStringIPKvS4_EEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEET_T0_PKc) and successfully link the program.

This fix resolves the compilation issue and ensures that the project can be built without encountering linker errors related to Abseil dependencies.

@collinalexbell
Copy link
Owner

Thanks. I don't exactly understand what they are for, but I see they are used for the CHECK runtime assertions.

@collinalexbell collinalexbell merged commit 4e8db4d into collinalexbell:master Apr 25, 2024
@collinalexbell
Copy link
Owner

#50

Sorry, I had to revert this. There is no apt package for absl that I can include in the readme, so I will have to add compiling it to the build process. I'm working on a cmake branch, so I'll consider adding it to that. What are you using it for? My toolchain doesn't require it to build the project as is, but perhaps yours does.

@Rafi1018
Copy link
Contributor Author

No problem.
the error occurred because there were unresolved symbols related to the Abseil library. Specifically, the linker couldn't find definitions for functions like absl::log_internal::MakeCheckOpString and absl::log_internal::LogMessageFatal::~LogMessageFatal().
BTW cmake would be great.

@collinalexbell
Copy link
Owner

Hello. I have made a new PR concerning this issue. Perhaps you could test it out for me!

#55

@Rafi1018
Copy link
Contributor Author

Rafi1018 commented Apr 27, 2024

Hello. I have made a new PR concerning this issue. Perhaps you could test it out for me!

#55

didn't work here's the output :

❯ make
g++ -std=c++20 -O3 -g -g -o matrix build/screen.o build/systems/Light.o build/components/Light.o build/main.o build/systems/Boot.o build/components/Bootable.o build/IndexPool.o build/WindowManager/Space.o build/systems/Move.o build/systems/ApplyTranslation.o build/systems/Derivative.o build/systems/Update.o build/systems/Intersections.o build/systems/Scripts.o build/components/Scriptable.o build/components/Parent.o build/components/RotateMovement.o build/components/Lock.o build/components/Key.o build/systems/KeyAndLock.o build/systems/Door.o build/systems/ApplyRotation.o build/persister.o build/engineGui.o build/entity.o build/renderer.o build/shader.o build/texture.o build/world.o build/camera.o build/api.o build/controls.o build/app.o build/WindowManager/WindowManager.o build/logger.o build/engine.o build/cube.o build/chunk.o build/mesher.o build/loader.o build/utility.o build/blocks.o build/dynamicObject.o build/assets.o
build/model.o build/mesh.o build/imgui/imgui.o build/imgui/imgui_draw.o build/imgui/imgui_impl_opengl3.o build/imgui/imgui_widgets.o build/imgui/imgui_demo.o build/imgui/imgui_impl_glfw.o build/imgui/imgui_tables.o build/enkimi.o build/miniz.o src/api.pb.cc src/glad.c src/glad_glx.c  build/Backup.o  build/Column.o  build/Database.o  build/Exception.o  build/Savepoint.o  build/Statement.o  build/Transaction.o -lzmq -lX11 -lXcomposite -lXtst -lXext -lXfixes -lprotobuf -lspdlog -lfmt -Llib -lglfw -lGL -lpthread -lassimp -lsqlite3  -Iinclude -I/usr/local/include -Iinclude/imgui
/usr/bin/ld: /tmp/cc7IhCdW.o: undefined reference to symbol '_ZN4absl12lts_2024011612log_internal17MakeCheckOpStringIPKvS4_EEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEET_T0_PKc'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../lib/libabsl_log_internal_check_op.so.2401.0.0: error adding symbols:
DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [makefile:30: matrix] Error 1

@collinalexbell
Copy link
Owner

Hmm. What is the output of lsb_release -i -s for you? Is it Arch or are you using an arch derivative like Manjaro? The shell code is AI generated so I may have to spin up an Arch vm to test it if you are on Arch.

@Rafi1018
Copy link
Contributor Author

Rafi1018 commented Apr 28, 2024

Hmm. What is the output of lsb_release -i -s for you? Is it Arch or are you using an arch derivative like Manjaro? The shell code is AI generated so I may have to spin up an Arch vm to test it if you are on Arch.

Hey there sorry went asleep. Yeah my output isn't arch actually. I think I have a better approach btw use this instead :

# Detect if the distro is arch based
ARCH_CHECK := $(shell grep -q 'arch' /etc/os-release && echo "true" || echo "false")

# Set extra linker flags for Arch Linux
ifeq ($(ARCH_CHECK),true)
    EXTRA_LDFLAGS := -labsl_log_internal_check_op -labsl_log_internal_message
endif

@Rafi1018
Copy link
Contributor Author

How far did you go with cmake by the way & I think you should make a discord. Much better to deal with issue & stuffs

@collinalexbell
Copy link
Owner

That is good code. Thanks. Will get the arch makefile merged. As far as CMake, I'm having some difficulties that I wrote about in the issue on CMake.

@Rafi1018
Copy link
Contributor Author

That is good code. Thanks. Will get the arch makefile merged. As far as CMake, I'm having some difficulties that I wrote about in the issue on CMake.

Ok let me see If I can help you with that

@blacklightpy
Copy link
Contributor

This is also an issue in Void Linux, and I'm on the musl edition.

I also had to set -DSPDLOG_FMT_EXTERNAL flag, because some distros use fmt-devel and build spdlog with that flag. Then programs also have to use -DSPDLOG_FMT_EXTERNAL (gabime/spdlog#1897 (comment) and gabime/spdlog#2310 (comment)). I don't know if there is a better way than that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants