Skip to main content
make question clear
Source Link
user5819540
user5819540

Platform: ubuntu22.04 I'm using cmake to link to a 3rd party library. It looks like:

// Those two files are identical. 
// abc.so is the original file and libabc.so is a copy 

// ${shared} is an absolute path
${shared}/libabc.so
${shared}/abc.so

My CMakeLists.txt:

LINK_DIRECTORIES(${shared})

ADD_EXECUTABLE(main ...)

TARGET_LINK_LIBRARIES(main libabc.so)

So far it works fine. You may have noticed that I have ${shared}/libabc.so and ${shared}/abc.so at the same time. They are identical. So I delete libabc.so (abc.so is the original file) and create a link file with ln -s relative_path/shared/abc.so relative_path/shared/libabc.so. But I got:

/usr/bin/ld: cannot find -labc: No such file or directory
collect2: error: ld returned 1 exit status

Why do I get this error when libabc.so did exists?

Platform: ubuntu22.04 I'm using cmake to link to a 3rd party library. It looks like:

// Those two files are identical. 
// abc.so is the original file and libabc.so is a copy
${shared}/libabc.so
${shared}/abc.so

My CMakeLists.txt:

LINK_DIRECTORIES(${shared})

ADD_EXECUTABLE(main ...)

TARGET_LINK_LIBRARIES(main libabc.so)

So far it works fine. You may have noticed that I have shared/libabc.so and shared/abc.so at the same time. They are identical. So I delete libabc.so (abc.so is the original file) and create a link file with ln -s shared/abc.so shared/libabc.so. But I got:

/usr/bin/ld: cannot find -labc: No such file or directory
collect2: error: ld returned 1 exit status

Why do I get this error when libabc.so did exists?

Platform: ubuntu22.04 I'm using cmake to link to a 3rd party library. It looks like:

// Those two files are identical. 
// abc.so is the original file and libabc.so is a copy 

// ${shared} is an absolute path
${shared}/libabc.so
${shared}/abc.so

My CMakeLists.txt:

LINK_DIRECTORIES(${shared})

ADD_EXECUTABLE(main ...)

TARGET_LINK_LIBRARIES(main libabc.so)

So far it works fine. You may have noticed that I have ${shared}/libabc.so and ${shared}/abc.so at the same time. They are identical. So I delete libabc.so (abc.so is the original file) and create a link file with ln -s relative_path/shared/abc.so relative_path/shared/libabc.so. But I got:

/usr/bin/ld: cannot find -labc: No such file or directory
collect2: error: ld returned 1 exit status

Why do I get this error when libabc.so did exists?

added 11 characters in body; edited title
Source Link
starball
  • 48k
  • 28
  • 183
  • 841

CMake cannot find .so which is symbollinksymbolic link file

Platform: ubuntu22.04 I'm using cmake to link to a 3rd party library. It looks like:

// Those two files are identical. 
// abc.so is the original file and libabc.so is a copy
${shared}/libabc.so
${shared}/abc.so

My CMakeLists.txt:

LINK_DIRECTORIES(${shared})

ADD_EXECUTABLE(main ...)

TARGET_LINK_LIBRARIES(main libabc.so)

So far it works fine. You may have noticed that I have shared/libabc.so and shared/abc.so at the same time. They are identical. So I delete libabc.so (abc.so is the original file) and create a link file with ln -s shared/abc.so shared/libabc.so. But I got:

/usr/bin/ld: cannot find -labc: No such file or directory
collect2: error: ld returned 1 exit status

Why do I get this error when libabc.so did exists?

CMake cannot find .so which is symbollink file

Platform: ubuntu22.04 I'm using cmake to link to a 3rd party library. It looks like:

// Those two files are identical. 
// abc.so is the original file and libabc.so is a copy
${shared}/libabc.so
${shared}/abc.so

My CMakeLists.txt:

LINK_DIRECTORIES(${shared})

ADD_EXECUTABLE(main ...)

TARGET_LINK_LIBRARIES(main libabc.so)

So far it works fine. You may have noticed that I have shared/libabc.so and shared/abc.so at the same time. They are identical. So I delete libabc.so (abc.so is the original file) and create a link file with ln -s shared/abc.so shared/libabc.so. But I got:

/usr/bin/ld: cannot find -labc: No such file or directory
collect2: error: ld returned 1 exit status

Why I get this error when libabc.so did exists?

CMake cannot find .so which is symbolic link file

Platform: ubuntu22.04 I'm using cmake to link to a 3rd party library. It looks like:

// Those two files are identical. 
// abc.so is the original file and libabc.so is a copy
${shared}/libabc.so
${shared}/abc.so

My CMakeLists.txt:

LINK_DIRECTORIES(${shared})

ADD_EXECUTABLE(main ...)

TARGET_LINK_LIBRARIES(main libabc.so)

So far it works fine. You may have noticed that I have shared/libabc.so and shared/abc.so at the same time. They are identical. So I delete libabc.so (abc.so is the original file) and create a link file with ln -s shared/abc.so shared/libabc.so. But I got:

/usr/bin/ld: cannot find -labc: No such file or directory
collect2: error: ld returned 1 exit status

Why do I get this error when libabc.so did exists?

add env
Source Link
user5819540
user5819540

Platform: ubuntu22.04 I'm using cmake to link to a 3rd party library. It looks like:

// Those two files are identical. 
// abc.so is the original file and libabc.so is a copy
${shared}/libabc.so
${shared}/abc.so

My CMakeLists.txt:

LINK_DIRECTORIES(${shared})

ADD_EXECUTABLE(main ...)

TARGET_LINK_LIBRARIES(main libabc.so)

So far it works fine. You may have noticed that I have shared/libabc.so and shared/abc.so at the same time. They are identical. So I delete libabc.so (abc.so is the original file) and create a link file with ln -s shared/abc.so shared/libabc.so. But I got:

/usr/bin/ld: cannot find -labc: No such file or directory
collect2: error: ld returned 1 exit status

Why I get this error when libabc.so did exists?

Platform: ubuntu22.04 I'm using cmake to link to a 3rd party library. It looks like:

// Those two files are identical. 
// abc.so is the original file and libabc.so is a copy
shared/libabc.so
shared/abc.so

My CMakeLists.txt:

LINK_DIRECTORIES(shared)

ADD_EXECUTABLE(main ...)

TARGET_LINK_LIBRARIES(main libabc.so)

So far it works fine. You may have noticed that I have shared/libabc.so and shared/abc.so at the same time. They are identical. So I delete libabc.so (abc.so is the original file) and create a link file with ln -s shared/abc.so shared/libabc.so. But I got:

/usr/bin/ld: cannot find -labc: No such file or directory
collect2: error: ld returned 1 exit status

Why I get this error when libabc.so did exists?

Platform: ubuntu22.04 I'm using cmake to link to a 3rd party library. It looks like:

// Those two files are identical. 
// abc.so is the original file and libabc.so is a copy
${shared}/libabc.so
${shared}/abc.so

My CMakeLists.txt:

LINK_DIRECTORIES(${shared})

ADD_EXECUTABLE(main ...)

TARGET_LINK_LIBRARIES(main libabc.so)

So far it works fine. You may have noticed that I have shared/libabc.so and shared/abc.so at the same time. They are identical. So I delete libabc.so (abc.so is the original file) and create a link file with ln -s shared/abc.so shared/libabc.so. But I got:

/usr/bin/ld: cannot find -labc: No such file or directory
collect2: error: ld returned 1 exit status

Why I get this error when libabc.so did exists?

Source Link
user5819540
user5819540
Loading