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

Can't run on Ubuntu 20.04 #8

Closed
Deimantas69 opened this issue Dec 21, 2021 · 4 comments
Closed

Can't run on Ubuntu 20.04 #8

Deimantas69 opened this issue Dec 21, 2021 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@Deimantas69
Copy link

Deimantas69 commented Dec 21, 2021

When running cmake with the example CMakeLists, I get the following error:
Bin/RefurekuGenerator: error while loading shared libraries: libclang.so.12: cannot open shared object file: No such file or directory

cmake file:

cmake_minimum_required(VERSION 3.21)
project(RefurekuTest)

set(CMAKE_CXX_STANDARD 17)


add_executable(RefurekuTest main.cpp)
target_compile_features(RefurekuTest PUBLIC cxx_std_17)


target_include_directories(RefurekuTest PUBLIC ${PROJECT_SOURCE_DIR}/Include)
target_link_directories(RefurekuTest PRIVATE ${PROJECT_SOURCE_DIR}/Bin)
target_link_libraries(RefurekuTest PRIVATE Refureku)

add_custom_target(RunRefurekuGenerator
        WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}  #PROJECT_SOURCE_DIR is the path to the directory containing the Cmake with the project command
        COMMAND ${PROJECT_SOURCE_DIR}/Bin/RefurekuGenerator ${PROJECT_SOURCE_DIR}/RefurekuSettings.toml)

add_dependencies(RefurekuTest RunRefurekuGenerator)
@jsoysouvanh
Copy link
Owner

jsoysouvanh commented Dec 22, 2021

Hi,

I'm not very familiar with Linux systems (I don't have a linux machine to test it so I just tested it with the Window's Linux subsystem).
It looks like your system can't locate the libclang.so.12 shared library (which is perfectly normal since it is not installed on your machine) so the generator can't run. You should have a look at this link; Step 4: Making the library available at runtime which explains steps very well. Since the generator binaries are prebuilt, you won't be able to use rpath so check directly the LD_LIBRARY_PATH or ldconfig options.
The LD_LIBRARY_PATH is the "quick" option but doesn't sound clean, so you'd better move the libclang.so.12 to a library folder, make a symlink from libclang.so to libclang.so.12, and try running the generator again.

Roughly something like this (not tested so there may be typo):

cp RefurekuTest/Bin/libclang.so.12 /usr/lib
chmod 0755 /usr/lib/libclang.so.12

# Next 3 lines should be optional
cd /usr/lib/
ln -s libclang.so.12 libclang.so
ldconfig

Then check that RefurekuGenerator points correctly to libclang.so.12:

ldd RefurekuTest/Bin/RefurekuGenerator

You should have libclang.so.12 => /usr/lib/libclang.so.12.

The generator should be able to run correctly after that. Let me know if it solves your problem.

@jsoysouvanh jsoysouvanh added the question Further information is requested label Dec 22, 2021
@jsoysouvanh jsoysouvanh self-assigned this Dec 22, 2021
@Deimantas69
Copy link
Author

Thanks for the detailed response, Initially I thought there would've been a way to automate this/link the file using CMake, however this seems to do the trick

@jsoysouvanh
Copy link
Owner

I made some research yesterday and stumbled across the RUNPATH tag.
I will try to add the executable path so that it looks automatically in the executable's directory for the libclang library (just like in Windows).

@jsoysouvanh
Copy link
Owner

I released a new version (v2.0.2) with a few updates including the automatic libclang.so lookup as long as it is located next to RefurekuGenerator. Feel free to reopen the issue if something's wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants