Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to compile on ArchLinux #25

Open
Opaatia opened this issue Jan 17, 2024 · 17 comments
Open

Fail to compile on ArchLinux #25

Opaatia opened this issue Jan 17, 2024 · 17 comments

Comments

@Opaatia
Copy link

Opaatia commented Jan 17, 2024

Hello, thank you for working on making a fork of D Language and I have been eager to look forward and to evaluate it's progress. I have tried to clone and compile your project, it fail to build however. This is built with the latest version for Arch Linux packages.

Host DMD Compiler version: DMD64 D Compiler v2.106.1
Arch Linux - Updated as of January 16, 2024.
LLVM/Clang - Version 17.0.0 (Built and installed in /usr/local prefix)

src/rt/sections_elf_shared.d(195): Error: function `rt.sections_elf_shared.getTLSRange(ulong mod, ulong sz, ulong alignment)` is not callable using argument types `(const(ulong), const(ulong))`
src/rt/sections_elf_shared.d(195):        too few arguments, expected 3, got 2
@adamdruppe
Copy link
Contributor

It fails to compile anywhere rn, I totally broke it trying to merge dmd and ldc's druntime and make it work in teh ci scripts.

Make sure you pull master, it is changing every 5 mins rn. But I'm done trying for tonight, im going to bed.

If you have a PR to fix the build lmk, that specific error i did like 10 mins ago, but I'm pretty sure there's still more.

@Opaatia
Copy link
Author

Opaatia commented Jan 17, 2024

It fails to compile anywhere rn, I totally broke it trying to merge dmd and ldc's druntime and make it work in teh ci scripts.

Make sure you pull master, it is changing every 5 mins rn. But I'm done trying for tonight, im going to bed.

If you have a PR to fix the build lmk, that specific error i did like 10 mins ago, but I'm pretty sure there's still more.

Oh sorry, and no worries. Just thought to drop by to see if something needed to be fixed on my end. I'll wait patiently for the update. Have a good night, Adam Ruppe!

@ssvb
Copy link
Contributor

ssvb commented Jan 17, 2024

It fails to compile anywhere rn, I totally broke it trying to merge dmd and ldc's druntime and make it work in teh ci scripts.

Wouldn't it be better to do these ci scripts experiments in a separate branch before merging them to master?

@kassane
Copy link
Contributor

kassane commented Jan 17, 2024

Host DMD Compiler version: DMD64 D Compiler v2.106.1 Arch Linux - Updated as of January 16, 2024. LLVM/Clang - Version 17.0.0 (Built and installed in /usr/local prefix)

src/rt/sections_elf_shared.d(195): Error: function `rt.sections_elf_shared.getTLSRange(ulong mod, ulong sz, ulong alignment)` is not callable using argument types `(const(ulong), const(ulong))`
src/rt/sections_elf_shared.d(195):        too few arguments, expected 3, got 2

Hi @TechScribe-Deaf , I'm also an archlinux user.

From commit 526ec60, I can build dmd using ldc2-1.36.0 or master.


It fails to compile anywhere rn, I totally broke it trying to merge dmd and ldc's druntime and make it work in teh ci scripts.

Wouldn't it be better to recreate the CI/CD mechanism (another branch test) and simplify the whole process?

It will take all your time to try to maintain the dlang process from the beginning.
It is very easy to build dmd, the only problem would be ldc2, exactly because of the llvm. It would be interesting to get a copy of the prebuilt llvm to simplify and/or accelerate the ldc2 build process.

@adamdruppe
Copy link
Contributor

I have no idea how to do any of this. I don't know even what most these things are! I was really hoping someone else would step up and do it, but it is kinda important to have an actually usable artifact before much of anything else can happen.

The latest errors just say missing license file though so that might be near the end of it now.

@adamdruppe
Copy link
Contributor

i just tried to move the other stuff to a branch and get master back to the last working commit on linux (still doesn't work on windows but master should build for you here)

adamdruppe pushed a commit that referenced this issue Feb 4, 2024
@wilsonk
Copy link

wilsonk commented Feb 5, 2024

I was able to build OpenD (odmd and lodc, if that is what they will eventually be called) on two Arch derivatives (Garuda and Manjaro)...though I did have to comment out the two sections that were trying to build ldc-profgen in ldc/tools/CMakeLists.txt! I got some linker error that suggested incompatible compilers built a couple object files or libs, but I don't know how that is possible on the Manjaro install, as it is pretty much pristine/new?? Not sure what is going on there.

Other than that is seems to work.

@adamdruppe
Copy link
Contributor

Yeah, the profgen thing doesn't work on my Slackware computer too. I don't know why, but the ldc works so I was happy stopping it there. The CI setup manages to build those though.

@wilsonk
Copy link

wilsonk commented Feb 5, 2024

A quick diff in case anyone else is unclear on how to do this commenting out:

diff --git a/ldc/tools/CMakeLists.txt b/ldc/tools/CMakeLists.txt
index facb939472..f2908aae64 100644
--- a/ldc/tools/CMakeLists.txt
+++ b/ldc/tools/CMakeLists.txt
@@ -25,46 +25,46 @@ install(PROGRAMS ${LDCPRUNECACHE_EXE_FULL} DESTINATION ${CMAKE_INSTALL_PREFIX}/b
 
 #############################################################################
 # Build ldc-profdata for converting profile data formats (source version depends on LLVM version)
-set(LDCPROFDATA_SRC ldc-profdata/llvm-profdata-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.cpp)
-if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LDCPROFDATA_SRC})
-    add_executable(ldc-profdata ${LDCPROFDATA_SRC})
-    set_target_properties(
-        ldc-profdata PROPERTIES
-        RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin
-        COMPILE_FLAGS "${LLVM_CXXFLAGS} ${LDC_CXXFLAGS}"
-        LINK_FLAGS "${SANITIZE_LDFLAGS}"
-    )
-    target_link_libraries(ldc-profdata ${LLVM_LIBRARIES} ${CMAKE_DL_LIBS} ${LLVM_LDFLAGS})
-    install(TARGETS ldc-profdata DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
-else()
-    message(WARNING "ldc-profdata source (${LDCPROFDATA_SRC}) not found")
-endif()
+#set(LDCPROFDATA_SRC ldc-profdata/llvm-profdata-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.cpp)
+#if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LDCPROFDATA_SRC})
+#    add_executable(ldc-profdata ${LDCPROFDATA_SRC})
+#    set_target_properties(
+#        ldc-profdata PROPERTIES
+#        RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin
+#        COMPILE_FLAGS "${LLVM_CXXFLAGS} ${LDC_CXXFLAGS}"
+#        LINK_FLAGS "${SANITIZE_LDFLAGS}"
+#    )
+#    target_link_libraries(ldc-profdata ${LLVM_LIBRARIES} ${CMAKE_DL_LIBS} ${LLVM_LDFLAGS})
+#    install(TARGETS ldc-profdata DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
+#else()
+#    message(WARNING "ldc-profdata source (${LDCPROFDATA_SRC}) not found")
+#endif()
 
 #############################################################################
 # Build ldc-profgen utility that generates a profile data file from given perf script
 # data files for sample-based profile guided optimization (-fprofile-sample-use).
 # https://llvm.org/docs/CommandGuide/llvm-profgen.html
 # The source in ldc-profgen/ldc-profgen-xx.x is an unmodified copy of llvm's llvm-profgen source dir.
-if(LDC_LLVM_VER GREATER_EQUAL 1400)
-    macro(add_llvm_tool llvm_name)
-        string(REPLACE "llvm-" "ldc-" ldc_name ${llvm_name})
-        message(STATUS "Configuring ${ldc_name} build target")
-        add_executable(${ldc_name} ${ARGN})
-        set_target_properties(
-            ${ldc_name} PROPERTIES
-            RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin
-            COMPILE_FLAGS "${LLVM_CXXFLAGS} ${LDC_CXXFLAGS}"
-            LINK_FLAGS "${SANITIZE_LDFLAGS}"
-        )
-        target_link_libraries(${ldc_name} ${LLVM_LIBRARIES} ${CMAKE_DL_LIBS} ${LLVM_LDFLAGS})
-        install(TARGETS ${ldc_name} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
-    endmacro()
-    if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ldc-profgen/ldc-profgen-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR})
-        add_subdirectory(ldc-profgen/ldc-profgen-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR})
-    else()
-        message(WARNING "ldc-profgen source not found (${CMAKE_CURRENT_SOURCE_DIR}/ldc-profgen/ldc-profgen-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR})")
-    endif()
-endif()
+#if(LDC_LLVM_VER GREATER_EQUAL 1400)
+#    macro(add_llvm_tool llvm_name)
+#        string(REPLACE "llvm-" "ldc-" ldc_name ${llvm_name})
+#        message(STATUS "Configuring ${ldc_name} build target")
+#        add_executable(${ldc_name} ${ARGN})
+#        set_target_properties(
+#            ${ldc_name} PROPERTIES
+#            RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin
+#            COMPILE_FLAGS "${LLVM_CXXFLAGS} ${LDC_CXXFLAGS}"
+#            LINK_FLAGS "${SANITIZE_LDFLAGS}"
+#        )
+#        target_link_libraries(${ldc_name} ${LLVM_LIBRARIES} ${CMAKE_DL_LIBS} ${LLVM_LDFLAGS})
+#        install(TARGETS ${ldc_name} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
+#    endmacro()
+#    if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ldc-profgen/ldc-profgen-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR})
+#        add_subdirectory(ldc-profgen/ldc-profgen-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR})
+#    else()
+#        message(WARNING "ldc-profgen source not found (${CMAKE_CURRENT_SOURCE_DIR}/ldc-profgen/ldc-profgen-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR})")
+#    endif()
+#endif()
 
 #############################################################################
 # Build timetrace2txt

@igor84
Copy link

igor84 commented Mar 1, 2024

I am getting the following on Manjaro: /usr/bin/ld: cannot find -lLLVMSymbolize: No such file or directory. I can't find any LLVMSymbolize file on my machine? Any idea what am I missing?

Could be the issue is I have LLVM 16 and not 17 but I don't see 17 among the official packages. Should I install it from AUR and do I need llvm17 or llvm17-libs?

@adamdruppe
Copy link
Contributor

It should work with 16 too, that's what I built it on my computer. Did you do the whole cmake process so it configured for your computer?

@igor84
Copy link

igor84 commented Mar 1, 2024

I just cloned the repo, and ran make from it like the readme said. Is there anything else I need to do?

@adamdruppe
Copy link
Contributor

ok... where did it fail? check your build dir to see if ldc2 actually got generated. the top-level makefile tries to build like a dozen things so it might be one of the other tools.

@igor84
Copy link

igor84 commented Mar 1, 2024

It failed on building ldc2. I downloaded the LLVM 17 archive and just extracted libLLVMSymbolize.a to /usr/lib/ and the build then passed. Maybe that means that my LLVM 16 installation is somehow messed up and is missing that file...

@adamdruppe
Copy link
Contributor

huh idk, this is why i prefer dmd, lol it is so much easier to build.

@Opaatia
Copy link
Author

Opaatia commented Mar 20, 2024

Wouldn't it be ideal to start adding git submodule with specific commit required to build and basically static link them?

@adamdruppe
Copy link
Contributor

The CI script (which came from upstream) downloads a prebuilt LLVM from github, so perhaps that could be added to the instructions for a self build too.

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

No branches or pull requests

6 participants