-
Notifications
You must be signed in to change notification settings - Fork 402
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
1.84.0 fails to build in FreeBSD 14.0 due missing reference to libm using CMake #724
Comments
Two other problems:
|
@DanBloomberg : Last cmake GA job works fine for Ubuntu 20.04 https://github.com/DanBloomberg/leptonica/actions/runs/7313600843/job/19925360933 Can you check your installation? What is your gcc, openjeg versions? |
@diizzyy : Is autotools build working properly? Can you please add to prog/CMakeLists.txt the following code if it works on FreeBSD: if(${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD.*|DragonFly.*|FreeBSD")
check_library_exists(m sin "" HAVE_LIBM)
if(HAVE_LIBM)
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m)
endif (HAVE_LIBM)
endif(${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD.*|DragonFly.*|FreeBSD") |
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0. I can get it to compile by removing two lines in CMakeLists.txt:
I have been using libopenjp2 2.3.0. I downloaded and built 2.5.0, and it now finds the library.
I'm surprised others haven't reported this. It is fixed by commenting out the code in jp2kio.c leading to the 2-arg function:
|
Well gcc9 seems not to support the c17 standard so you can not use it for building Tesseract, e.g. everybody uses recent version... More interesting is that in Github action I see nothing about a compiler, so I would expect that it uses the default 20.04 compiler... I use libopenjp2 2.5.0 on Windows and there was no problem to compile leptonica. However GA that uses openjp2 from git reports and there is the problem: https://github.com/DanBloomberg/leptonica/actions/runs/7313482066/job/19925104247 |
I have cleaned up jp2kio.c, removing all references to openjpeg library versions before 2.1. So 2.1+ is now a requirement. OK, so Tesseract requires at least gcc10, which is later than the 9.4 compiler that came with ubuntu 20.04.
|
And ... cmake is version 3.16.3 |
@zdenop
|
Is there a problem with linking shared Regarding your snippet - the first test ( Also So it should look like: if(${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD.*|DragonFly.*|FreeBSD")
check_library_exists(m sin "" HAVE_LIBM)
if(HAVE_LIBM)
SET(EXTRA_LIBS "m")
endif(HAVE_LIBM)
endif(${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD.*|DragonFly.*|FreeBSD")
...
target_link_libraries (${target} leptonica ${EXTRA_LIBS}) |
While it's not a huge issue in this case overlinking is concidered bad in general. There is Indeed, my example could use some optimization :) |
2.1.0 was released in Apr 2014. |
Tesseract 5.x requires C++17. It works fine on GCC 9. |
I knew that libopenjp2 2.1 is 10 years old. Just want your permission to end support for 2.0. Given this, I will make a new leptonica release 1.84.1 that solves the problem with 2.5. Also,the problem on my old laptop with cmake and C17 is a configuration issue, because I still have the problem with gcc 13.1. So this is not a leptonica issue. |
If I got this right Ubuntu support openjp >= 2.3.1. If it is correct, I would not care about supporting the older version. |
Regarding openjpeg >= 2.1. No problem, IMO. RHEL 8/9. Ubuntu 20.04/22.04(/24.04) and the latest 2 Debian releases all have openjpeg >= 2.1 in their repos. The above distros versions also have GCC >= 8 which is the minimal requirement for the latest Tesseract version. |
In theory that works but then again... https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed |
The gentoo page says the "as needed" flag doesn't work in FreeBSD. |
As needed does indeed work with both LLVM/Clang and GCC however I was more trying to point out that linkers in general are still trying to be "safe". |
@diizzyy : can you check the current master code? |
Hi, Unfortunately this breaks build like @stweil reported
Best regards, |
Hi Daniel, I fixed that. It now works for Ubuntu (and hopefully for FreeBSD, too). |
@diizzyy : IMO this issue is fixed (e.g. it could be closed) |
Agreed, thanks for the help |
Adding "-lm" to LDFLAGS fixes the build
The text was updated successfully, but these errors were encountered: