Freeimage error

219 views
Skip to first unread message

Vlademiro Landim

unread,
Dec 3, 2022, 11:07:07 PM12/3/22
to Harbour Users

Hi guys

I compile harbour with free image. All ok.
But... when I compile my test.prg, this error is generated:

hbmk2 test.prg hbf image.hbc zebra.hbc
undefined reference to `FreeImage_RotateClassic'

Any idea ?

PS: FImage compiled is last version 

Maurizio la Cecilia

unread,
Dec 5, 2022, 4:04:59 AM12/5/22
to harbou...@googlegroups.com
Hi Vlademiro,
probably you're using a FreeImage version newer than the covered by contrib release.
Me too had the same issue.
To solve you need to edit hbfimage.hbx and change

DYNAMIC fi_RotateClassic

with

DYNAMIC fi_Rotate

That's all.
Best regards.
--
Maurizio

--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/a092941d-68f6-42d8-91f2-6a9528b4ff4bn%40googlegroups.com.


Vlademiro Landim

unread,
Dec 5, 2022, 7:28:53 PM12/5/22
to Harbour Users
Maurizio, 

Thanks for the answer. I'm trying. 

It still didn't work out. 

What did I do: 

(1) I changed the hbx file as you said 
(2) I changed the function name in core.c contrib\hbimage\core.c 
(2.1.) I changed the name in the same way RotateClassic->Rotate 
(3) I changed the fonts because of the number of parameters 

 When compiling Harbor, it generates the libFreeImage.a file, but when compiling, an error appears: 
 skipping incompatible C:/HARBOUR/lib/win/mingw64/libfreeimage.a 

When searching for libfreeimage I used the nm command on the lib and the message appears over and over again:

"Recognized but unhandled machine type"

My gcc is 64bits, 

gcc --version
gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I don't understand

  I'm tired now to continue for today. Tomorrow I'll keep tryin

Vlademiro Landim

unread,
Dec 5, 2022, 7:33:31 PM12/5/22
to Harbour Users
Continue...

The freeimage I downloaded was 32bits and 64bits.
I use the 64.
set HB_WITH_FREEIMAGE=C:\HarbourAux\FreeImage\Dist\x64

Vlademiro Landim

unread,
Dec 5, 2022, 8:00:29 PM12/5/22
to Harbour Users
When win-make install 

C:\sistemas\sistemas22\base\harbour\2022_12_03\bin\win\mingw64\hbmk2 -quiet -width=0 -autohbm- @hbpre -inc hbfimage/hbfimage.hbp @hbpost
hbmk2: Dependência 'freeimage' encontrado: C:\HarbourAux\FreeImage\Dist\x64
hbmk2[hbfimage]: Atenção: Não foram encontrados fontes para biblioteca de importação.--> Google translate:  Attention: No fonts were found for import library.
hbmk2: Alvo atualizado: ..\lib\win\mingw64\libhbfimage.a

Lib was generated but doesn't work.

Better go to sleep. I continue tomorrow

Maurizio la Cecilia

unread,
Dec 6, 2022, 6:22:06 AM12/6/22
to harbou...@googlegroups.com
Hi Vlademiro,
sorry, I forgot to say about the changed name in core.c because I made the changes long time ago.

I am amazed at your problems.
I'm also using MinGW64, but version 12.2 from MSYS2 and my building runs fine, without errors about fonts.
The lib is correctly created (42 Kb) and the test.prg is built smoothly, after some change due to my errorlevel setting and new function name (short, I remmed lines 26, 50 and 52 and changed fi_RotateClassic in line 89)

The exe runs fine and create the expected files in <%HB_PATH%>\contrib\hbfimage\tests\imgs_out.

2. about the malformed library my suspect is that the order of the linked libraries brings to a well known issue (see at https://groups.google.com/g/harbour-devel/c/CzEiQI3cygQ/m/osLupsB5BwAJ). Please, try to move hbfreeimage.hbc in your script file to another position and verify until the issues disappear. Probably some other library you're using have conflicting symbols and the linker goes wrong (like happens with hbhpdf and png)

Best regards.
--
Maurizio

v...@dc.ufc.br

unread,
Dec 7, 2022, 6:59:06 AM12/7/22
to Harbour Users
Hi Maurizio

 I'll try.

Can you post your modified core.c file?

Thanks

Maurizio la Cecilia

unread,
Dec 7, 2022, 12:06:21 PM12/7/22
to harbou...@googlegroups.com
Hi Vladimiro,
that's the changes I made:



Please, let me know if with this changes all goes right.
--
Maurizio

Vlademiro Landim

unread,
Dec 7, 2022, 9:35:53 PM12/7/22
to Harbour Users
Hi Maurizio 

 It finally worked. 

 What was happening: 
 (1) Harbor compiled was 64bit 
(2) Mingw does not generate libFreeImage.a automatically from FreeImage.lib. Only Migw 32bits generated .a from .lib automatically.
(3) The compiled Harbour (64bits) only generates libhbfimage.a (the wrapper) 

 If someone is going to use freeimage in 64bits they should: 

 (1) Make the changes you posted 
(2) Execute the commands: 

gendef FreeImage.dll 
dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib libFreeImage.a --input-def FreeImage.def

Your tips were essential.

Thanks for your help.
Reply all
Reply to author
Forward
0 new messages