Linker Error

Just starting out? Need help? Post your questions and find answers here.
swhite
Addict
Addict
Posts: 805
Joined: Thu May 21, 2009 6:56 pm

Linker Error

Post by swhite »

Hi

I am trying to compile an application that uses the webui-2.so and I get the following linker errors which I do not understand. When I compile the application in Windows using the windows' version of the webui library everything works correctly. The problem arises when I try the Linux version. I am using PB5.73 with gcc 7.
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: warning: SetStringBasePosition_ASM.o: missing .note.GNU-stack section implies executable stack
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: /home/remote/KardTech/FusionPro/webui-2.so: undefined reference to `stat64@GLIBC_2.33'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: /home/remote/KardTech/FusionPro/webui-2.so: undefined reference to `pthread_mutexattr_init@GLIBC_2.34'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: /home/remote/KardTech/FusionPro/webui-2.so: undefined reference to `pthread_key_create@GLIBC_2.34'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: /home/remote/KardTech/FusionPro/webui-2.so: undefined reference to `pthread_detach@GLIBC_2.34'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: /home/remote/KardTech/FusionPro/webui-2.so: undefined reference to `pthread_setspecific@GLIBC_2.34'
...
collect2: error: ld returned 1 exit status

Code: Select all

; MPLite_WebUI.pb - MPLite WebUI

CompilerIf Not #PB_Compiler_Thread
   CompilerError "Enable threadsafe in compiler options"
CompilerEndIf
#WEBUI_VERSION = "2.4.2"
#WEBUI_MAX_IDS = 512

Enumeration webui_browsers
   #NoBrowser
   #AnyBrowser
   #Chrome
   #Firefox
   #Edge
   #Safari
   #Chromium
   #Opera
   #Brave
   #Vivaldi
   #Epic
   #Yandex
   #ChromiumBased
EndEnumeration

Enumeration webui_runtimes 
   #None
   #Deno
   #NodeJS
EndEnumeration

Enumeration webui_events
   #WEBUI_EVENT_DISCONNECTED
   #WEBUI_EVENT_CONNECTED
   #WEBUI_EVENT_MOUSE_CLICK
   #WEBUI_EVENT_NAVIGATION
   #WEBUI_EVENT_CALLBACK
EndEnumeration

Structure webui_event_t Align #PB_Structure_AlignC
   window.i        ; The window object number
   event_type.i    ; Event type
   *element        ; HTML element ID
   event_number.i  ; Internal WebUI
   bind_id.i       ; Bind ID
   *data           ; JavaScript data
EndStructure

PrototypeC PrototypeC_webui_event(*e.webui_event_t)

ImportC "/home/remote/KardTech/FusionPro/webui-2.so"
   
   webui_new_window()                                                            ; Create a new webui window object.
   webui_new_window_id(window_number.i)                                          ; Create a new webui window object.
   webui_get_new_window_id.i()                                                   ; Get a free window ID that can be used with `webui_new_window_id()`
   webui_bind.i(window.i, element.p-Ascii, webui_event.PrototypeC_webui_event)   ; Bind a specific html element click event with a function. Empty element means all events.
   webui_show.i(window.i, content.p-Ascii)                                       ; Show a window using a embedded HTML, or a file. If the window is already
   webui_show_browser(window.i, content.p-Ascii, browser.i)                      ; Same as webui_show(). But with a specific web browser.
   webui_set_kiosk(window.i, status.i)                                           ; Set the window in Kiosk mode (Full screen)
   webui_wait()                                                                  ; Wait until all opened windows get closed.
   webui_close(window.i)                                                         ; Close a specific window only. The window object will still exist.
   webui_destroy(window.i)                                                       ; Close a specific window and free all memory resources.
   
   webui_exit()                                                                  ; Close all opened windows. webui_wait() will break.
   webui_set_root_folder.i(window.i, path.p-Ascii)                               ; Set the web-server root folder path.
   webui_set_default_root_folder(path.p-Ascii)                                   ; Set the default web-server root folder path.
   
   ; -- Other ---------------------------
   webui_is_shown.i(window.i)                                                    ; Check a specific window if it's still running
   webui_set_timeout(second.i)                                                   ; Set the maximum time in seconds to wait for browser to start 
   webui_set_icon(window.i, icon.p-Ascii, icon_type.p-Ascii)                     ; Set the default embedded HTML favicon
   webui_set_multi_access(window.i, status.b)                                    ; Allow the window URL to be re-used in normal web browsers
   webui_navigate(window.i, url.p-ascii)                                         ; Navigate to URL
   
   ; -- JavaScript ----------------------
   webui_run(window.i, script.p-Ascii)                                           ; Run JavaScript quickly with no waiting for the response.
   webui_script.i(window.i, script.p-Ascii, timeout.i, *buffer, buffer_length.i) ; Run a JavaScript, and get the response back (Make sure your local buffer can hold the response).
   webui_set_runtime(window.i, run_time.i)                                       ; Chose between Deno and Nodejs runtime for .js and .ts files.
   webui_get_int.q(*e.webui_event_t)                                             ; Parse argument as integer.
   webui_get_string.i(*e.webui_event_t)                                          ; Parse argument as string.
   webui_get_bool.i(*e.webui_event_t)                                            ; Parse argument as boolean.
   webui_return_int(*e.webui_event_t, number.i)                                  ; Return the response to JavaScript as integer.
   webui_return_string(*e.webui_event_t, const.p-Ascii)                          ; Return the response to JavaScript as string.
   webui_return_bool(*e.webui_event_t, bool.i)                                   ; Return the response to JavaScript as boolean.
   webui_encode.i(*char)                                                         ; Base64 encoding. Use this to safely send text based data to the UI. If it fails it will return NULL.
   webui_decode.i(char.p-Ascii)                                                  ; Base64 decoding. Use this to safely decode received Base64 text from the UI. If it fails it will return NULL.
   webui_free(*ptr)                                                              ; Safely free a buffer allocated by WebUI, For example when using webui_encode().
   
   ; -- Interface -----------------------
   webui_interface_bind.i(window.i, element.p-Ascii, *func)                      ; Bind a specific html element click event with a function. Empty element means all events. This replace webui_bind(). The func is (Window, EventType, Element, Data, EventNumber)
   webui_interface_set_response(window.i, event_number.i, response.p-Ascii)      ; When using `webui_interface_bind()` you may need this function to easily set your callback response.
   webui_interface_is_app_running.i()                                            ; Check if the app still running or not. This replace webui_wait().
   webui_interface_get_window_id.i(window.i)                                     ; Get window unique ID
   webui_interface_get_bind_id.i(window.i, element.p-Ascii)                      ; Get a unique ID. Same ID as `webui_bind()`. Return > 0 if bind exist.
EndImport
Simon White
dCipher Computing
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Linker Error

Post by infratec »

It sounds like your webui-2.so does not fit your OS.

You can check this with ldd.
swhite
Addict
Addict
Posts: 805
Joined: Thu May 21, 2009 6:56 pm

Re: Linker Error

Post by swhite »

Hi

Thank-you that found the problem. I am missing glibc_2.33 and glibc_2.34.

Simon
Simon White
dCipher Computing
swhite
Addict
Addict
Posts: 805
Joined: Thu May 21, 2009 6:56 pm

Re: Linker Error

Post by swhite »

Hi

The issue I have now is that I am using OpenSuse Leap 15.5 but it does not have glibc_2.33 or glibc_2.34 so I wonder if there is another way to fix this issue.

Thanks,
Simon
Simon White
dCipher Computing
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Linker Error

Post by infratec »

It is the other way round:

You need a webui-2.so for your SuSE.
Or you have to compile it on your SuSE.

According to:
http://webui.me/docs/2.4/#/?id=download-and-install

you can compile it with

Code: Select all

make COMPILER=clang
Or you can try:
webui-linux-clang-x64.zip
from
https://github.com/webui-dev/webui/releases
swhite
Addict
Addict
Posts: 805
Joined: Thu May 21, 2009 6:56 pm

Re: Linker Error

Post by swhite »

Hi

From the discussion on GitHub this is a known issue that they plan to fix. However I will try compiling it myself and see what happens.

Thanks
Simon
Simon White
dCipher Computing
swhite
Addict
Addict
Posts: 805
Joined: Thu May 21, 2009 6:56 pm

Re: Linker Error

Post by swhite »

Hi

I used GIT for the first time and followed the instructions and successfully created the webui-2.so Thank-you infratec for your help.

Simon
Simon White
dCipher Computing
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Linker Error

Post by infratec »

Btw. you don't need git. You can simply download the src zip file.

But now you can always get the latest stuff via:

Code: Select all

git checkout . --
git pull
:wink:
Post Reply