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

Error running on macOS #2

Open
xgp opened this issue Feb 8, 2018 · 16 comments
Open

Error running on macOS #2

xgp opened this issue Feb 8, 2018 · 16 comments

Comments

@xgp
Copy link

xgp commented Feb 8, 2018

I'm not sure if Valum is tested on macOS, so that may be the core issue here. Compilation works fine, but I'm seeing the following when I try to run:

$ app

** (process:57895): CRITICAL **: vsgi-server-module.vala:67: dlopen(libvsgi-http.so, 9): image not found

** (process:57895): CRITICAL **: vsgi_server_run: assertion 'self != NULL' failed

I'm using Vala 0.38.7.

Any suggestions?

@xgp
Copy link
Author

xgp commented Feb 8, 2018

Looks like dlopen is trying to load the .so rather than the .dylib. I don't know where/how that is specified, but it seems as if it may be the culprit.

@arteymix
Copy link
Member

arteymix commented Feb 8, 2018

It's defined here: https://github.com/valum-framework/vsgi/blob/master/src/vsgi-server-module.vala#L59

It's using GModule under the hood, so I'd expect it to just work.

@arteymix
Copy link
Member

It's an issue with Meson: mesonbuild/meson#3053

If they accept to change shared_module behaviour, it will be an easy fix, otherwise I'd have to put some conditionals in the build.

@arteymix
Copy link
Member

Could you test https://github.com/valum-framework/valum/tree/stable?

You can set revision=stable in valum.wrap.

@xgp
Copy link
Author

xgp commented Feb 12, 2018

Switched valum.wrap to revision=stable and did a fresh build, but I got the same result/error.

@arteymix
Copy link
Member

Have you done the following?

  • wipe build
  • put revision=stable in subprojects/valum.wrap
  • fresh build

I don't own a Mac, so I cannot be of much help..

@xgp
Copy link
Author

xgp commented Feb 13, 2018

Yes. I did it from a clean clone just in case. Same result.

@xgp
Copy link
Author

xgp commented Feb 13, 2018

Also, running the tests in that branch of valum fails in the tests that attempt load any modules:

[0/1] Running all tests.
 1/17 legacy                                  OK       0.04 s
 2/17 auth                                    OK       0.03 s
 3/17 request                                 OK       0.03 s
 4/17 response                                OK       0.03 s
 5/17 server                                  FAIL     0.02 s
 6/17 http server                             FAIL     0.13 s
 7/17 socket server                           OK       0.03 s
 8/17 fastcgi server                          FAIL     0.02 s
 9/17 authenticate                            OK       0.03 s
10/17 basepath                                OK       0.04 s
11/17 basic                                   OK       0.04 s
12/17 content negotiation                     OK       0.03 s
13/17 context                                 OK       0.02 s
14/17 safely                                  OK       0.03 s
15/17 router                                  OK       0.03 s
16/17 rule route                              OK       0.07 s
17/17 status                                  OK       0.03 s

OK:        14
FAIL:       3
SKIP:       0
TIMEOUT:    0


The output from the failed tests:

 5/17 server                                  FAIL     0.02 s

--- command ---
/Users/garth/projects/vala/valum/build/tests/server-test
--- stdout ---
/server/fork:
--- stderr ---

** (/Users/garth/projects/vala/valum/build/tests/server-test:72461): CRITICAL **: vsgi-server-module.vala:67: dlopen(libvsgi-mock.so, 9): image not found
-------

 6/17 http server                             FAIL     0.13 s

--- command ---
G_TEST_SRCDIR='/Users/garth/projects/vala/valum/tests' /Users/garth/projects/vala/valum/build/tests/http-server-test
--- stdout ---
/http_server/https:
--- stderr ---

** (/Users/garth/projects/vala/valum/build/tests/http-server-test:72462): CRITICAL **: vsgi-server-module.vala:67: dlopen(libvsgi-http.so, 9): image not found
-------

 8/17 fastcgi server                          FAIL     0.02 s

--- command ---
/Users/garth/projects/vala/valum/build/tests/fastcgi-server-test
--- stdout ---
/fastcgi_server/port:
--- stderr ---

** (/Users/garth/projects/vala/valum/build/tests/fastcgi-server-test:72464): CRITICAL **: vsgi-server-module.vala:67: dlopen(libvsgi-fastcgi.so, 9): image not found
-------

Full log written to /Users/garth/projects/vala/valum/build/meson-logs/testlog.txt
FAILED: meson-test

testlog.txt

@ZanderBrown
Copy link

I've also seen this happen (in person) but couldn't investigate further as it wasn't my mac

@arteymix
Copy link
Member

Could any of you run the tests with strace and send me a dump?

There's some work upstream to include more sensible prefix/suffix for loadable objects: in GModule https://bugzilla.gnome.org/show_bug.cgi?id=671212#c5

@xgp
Copy link
Author

xgp commented Feb 21, 2018

Ran with dtruss on mac. Output attached. Let me know if you want it run in another way.
dtruss.log

@arteymix
Copy link
Member

I'm already aware of the bug now! I pushed a fix here: valum-framework/valum@6a46be9 if you want to test it.

@xgp
Copy link
Author

xgp commented Feb 21, 2018

Close, but have to get rid of the trailing '.so':

** (process:86549): CRITICAL **: vsgi-server-module.vala:71: dlopen(libvsgi-http.dylib.so, 9): image not found

** (process:86549): CRITICAL **: vsgi_server_run: assertion 'self != NULL' failed

@arteymix
Copy link
Member

It should work now!

@xgp
Copy link
Author

xgp commented Feb 24, 2018

It looks like the dylib that gets created is not of the name that is expected:

[garth@garths-mbp:build (wip/macos-module-dylib)]$ ls src/vsgi/
libvsgi-0.3.dylib  servers/           vsgi-0.3.vapi      vsgi-0.3@sha/      vsgi.h
[garth@garths-mbp:build (wip/macos-module-dylib)]$ ls src/valum/
libvalum-0.3.dylib  valum-0.3.vapi      valum-0.3@sha/      valum.h

If I create some symlinks for -fastcgi, -http and -mock, it finds the libs, but then I get the following errors:

The output from the failed tests:

 5/17 server                                  FAIL     0.02 s

--- command ---
/Users/garth/projects/vala/valum/build/tests/server-test
--- stdout ---
/server/fork:
--- stderr ---

** (/Users/garth/projects/vala/valum/build/tests/server-test:7270): CRITICAL **: vsgi-server-module.vala:77: 'server_init': dlsym(0x110d6cb20, server_init): symbol not found
-------

 6/17 http server                             FAIL     0.08 s

--- command ---
G_TEST_SRCDIR='/Users/garth/projects/vala/valum/tests' /Users/garth/projects/vala/valum/build/tests/http-server-test
--- stdout ---
/http_server/https:
--- stderr ---

** (/Users/garth/projects/vala/valum/build/tests/http-server-test:7272): CRITICAL **: vsgi-server-module.vala:77: 'server_init': dlsym(0x10500cb20, server_init): symbol not found
-------

 8/17 fastcgi server                          FAIL     0.04 s

--- command ---
/Users/garth/projects/vala/valum/build/tests/fastcgi-server-test
--- stdout ---
/fastcgi_server/port:
--- stderr ---

** (/Users/garth/projects/vala/valum/build/tests/fastcgi-server-test:7273): CRITICAL **: vsgi-server-module.vala:77: 'server_init': dlsym(0x11644fb20, server_init): symbol not found
-------

Looks like there is no server_init?

[garth@garths-mbp:build (wip/macos-module-dylib)]$ nm -gU src/vsgi/libvsgi-0.3.dylib
000000000002d010 D _VSGI_REQUEST_METHODS
0000000000003850 T _vsgi_application_construct
00000000000039b0 T _vsgi_application_get_server
0000000000003910 T _vsgi_application_get_type
00000000000038e0 T _vsgi_application_new
0000000000007ed0 T _vsgi_authentication_construct
0000000000008050 T _vsgi_authentication_get_charset
0000000000007f10 T _vsgi_authentication_get_realm
00000000000080c0 T _vsgi_authentication_get_type
0000000000007de0 T _vsgi_authentication_parse_authorization_header
0000000000007f80 T _vsgi_authentication_set_realm
0000000000007e60 T _vsgi_authentication_to_authenticate_header
00000000000087c0 T _vsgi_authorization_challenge_with_password
00000000000088a0 T _vsgi_authorization_construct
0000000000008950 T _vsgi_authorization_get_type
00000000000088e0 T _vsgi_authorization_get_username
0000000000008830 T _vsgi_authorization_to_authorization_header
0000000000008f40 T _vsgi_basic_authentication_construct
0000000000009020 T _vsgi_basic_authentication_get_type
0000000000008ff0 T _vsgi_basic_authentication_new
000000000000a330 T _vsgi_basic_authorization_construct
000000000000a4e0 T _vsgi_basic_authorization_get_password
000000000000a440 T _vsgi_basic_authorization_get_type
000000000000a410 T _vsgi_basic_authorization_new
000000000000ad20 T _vsgi_bounded_input_stream_construct
000000000000aea0 T _vsgi_bounded_input_stream_get_content_length
000000000000ae00 T _vsgi_bounded_input_stream_get_type
000000000000add0 T _vsgi_bounded_input_stream_new
000000000000b7b0 T _vsgi_cgi_request_construct
000000000000b940 T _vsgi_cgi_request_get_environment
000000000000b8a0 T _vsgi_cgi_request_get_type
000000000000b860 T _vsgi_cgi_request_new
000000000000bdc0 T _vsgi_cgi_response_construct
000000000000be80 T _vsgi_cgi_response_get_type
000000000000be50 T _vsgi_cgi_response_new
0000000000010880 T _vsgi_connection_construct
00000000000108c0 T _vsgi_connection_get_server
0000000000010930 T _vsgi_connection_get_type
0000000000010ee0 T _vsgi_cookie_utils_sign
00000000000110d0 T _vsgi_cookie_utils_verify
0000000000012e80 T _vsgi_handler_construct
0000000000012ec0 T _vsgi_handler_get_type
0000000000012e00 T _vsgi_handler_handle
00000000000119e0 T _vsgi_handler_module_construct
0000000000011b60 T _vsgi_handler_module_get_directory
0000000000011cb0 T _vsgi_handler_module_get_handler_type
0000000000011bd0 T _vsgi_handler_module_get_name
0000000000011c40 T _vsgi_handler_module_get_path
0000000000011ac0 T _vsgi_handler_module_get_type
0000000000011a90 T _vsgi_handler_module_new
0000000000013010 T _vsgi_mock_connection_construct
0000000000013170 T _vsgi_mock_connection_get_memory_input_stream
0000000000013240 T _vsgi_mock_connection_get_memory_output_stream
00000000000130d0 T _vsgi_mock_connection_get_type
00000000000130a0 T _vsgi_mock_connection_new
00000000000134c0 T _vsgi_mock_request_construct
0000000000013900 T _vsgi_mock_request_construct_with_method
0000000000013bf0 T _vsgi_mock_request_construct_with_query
0000000000013ab0 T _vsgi_mock_request_construct_with_uri
0000000000013860 T _vsgi_mock_request_get_type
0000000000013820 T _vsgi_mock_request_new
0000000000013a70 T _vsgi_mock_request_new_with_method
0000000000013cf0 T _vsgi_mock_request_new_with_query
0000000000013bc0 T _vsgi_mock_request_new_with_uri
0000000000014090 T _vsgi_mock_response_construct
0000000000014230 T _vsgi_mock_response_construct_with_status
0000000000014190 T _vsgi_mock_response_get_type
0000000000014160 T _vsgi_mock_response_new
0000000000014330 T _vsgi_mock_response_new_with_status
00000000000143c0 T _vsgi_mock_server_construct
00000000000143f0 T _vsgi_mock_server_get_type
0000000000013a50 T _vsgi_mock_server_new
00000000000173a0 T _vsgi_request_construct
00000000000160e0 T _vsgi_request_convert
00000000000162a0 T _vsgi_request_flatten
0000000000016670 T _vsgi_request_flatten_async
0000000000016320 T _vsgi_request_flatten_bytes
0000000000016720 T _vsgi_request_flatten_bytes_async
0000000000016d00 T _vsgi_request_flatten_bytes_finish
00000000000166d0 T _vsgi_request_flatten_finish
00000000000164c0 T _vsgi_request_flatten_utf8
0000000000016d90 T _vsgi_request_flatten_utf8_async
0000000000017310 T _vsgi_request_flatten_utf8_finish
0000000000017800 T _vsgi_request_get_body
00000000000173e0 T _vsgi_request_get_connection
0000000000015b00 T _vsgi_request_get_cookies
00000000000174c0 T _vsgi_request_get_gateway_interface
0000000000017610 T _vsgi_request_get_headers
0000000000017450 T _vsgi_request_get_http_version
0000000000017530 T _vsgi_request_get_method
00000000000158a0 T _vsgi_request_get_query
00000000000178c0 T _vsgi_request_get_type
00000000000175a0 T _vsgi_request_get_uri
0000000000015910 T _vsgi_request_lookup_cookie
0000000000015770 T _vsgi_request_lookup_query
0000000000015dd0 T _vsgi_request_lookup_signed_cookie
0000000000017680 T _vsgi_request_set_headers
000000000001ac70 T _vsgi_response_append
000000000001b500 T _vsgi_response_append_async
000000000001af70 T _vsgi_response_append_bytes
000000000001bd30 T _vsgi_response_append_bytes_async
000000000001c270 T _vsgi_response_append_bytes_finish
000000000001bcb0 T _vsgi_response_append_finish
000000000001b0a0 T _vsgi_response_append_utf8
000000000001c2f0 T _vsgi_response_append_utf8_async
000000000001c7e0 T _vsgi_response_append_utf8_finish
000000000001e330 T _vsgi_response_construct
000000000001a840 T _vsgi_response_convert
000000000001da70 T _vsgi_response_end
000000000001dd10 T _vsgi_response_end_async
000000000001e2b0 T _vsgi_response_end_finish
000000000001c860 T _vsgi_response_expand
000000000001cc80 T _vsgi_response_expand_async
000000000001c8f0 T _vsgi_response_expand_bytes
000000000001cd30 T _vsgi_response_expand_bytes_async
000000000001d220 T _vsgi_response_expand_bytes_finish
000000000001d940 T _vsgi_response_expand_file
000000000001d9c0 T _vsgi_response_expand_file_async
000000000001da20 T _vsgi_response_expand_file_finish
000000000001cce0 T _vsgi_response_expand_finish
000000000001d810 T _vsgi_response_expand_stream
000000000001d890 T _vsgi_response_expand_stream_async
000000000001d8f0 T _vsgi_response_expand_stream_finish
000000000001cab0 T _vsgi_response_expand_utf8
000000000001d2a0 T _vsgi_response_expand_utf8_async
000000000001d790 T _vsgi_response_expand_utf8_finish
000000000001af00 T _vsgi_response_get_body
000000000001e630 T _vsgi_response_get_cookies
000000000001e8a0 T _vsgi_response_get_head_written
000000000001e4a0 T _vsgi_response_get_headers
0000000000019af0 T _vsgi_response_get_reason_phrase
000000000001e370 T _vsgi_response_get_request
0000000000019b60 T _vsgi_response_get_status
000000000001e920 T _vsgi_response_get_type
000000000001e510 T _vsgi_response_set_headers
000000000001e440 T _vsgi_response_set_reason_phrase
000000000001e3e0 T _vsgi_response_set_status
000000000001ab30 T _vsgi_response_tee
00000000000194d0 T _vsgi_response_write_head
0000000000019c40 T _vsgi_response_write_head_async
000000000001a7a0 T _vsgi_response_write_head_finish
0000000000019390 T _vsgi_response_write_headers
0000000000019420 T _vsgi_response_write_headers_async
0000000000019480 T _vsgi_response_write_headers_finish
0000000000019230 T _vsgi_response_write_status_line
00000000000192d0 T _vsgi_response_write_status_line_async
0000000000019340 T _vsgi_response_write_status_line_finish
00000000000255d0 T _vsgi_server_construct
0000000000024eb0 T _vsgi_server_dispatch_async
0000000000025480 T _vsgi_server_dispatch_finish
0000000000024e40 T _vsgi_server_fork
0000000000025610 T _vsgi_server_get_handler
0000000000024a30 T _vsgi_server_get_type
0000000000025750 T _vsgi_server_get_uris
0000000000024d00 T _vsgi_server_listen
0000000000024d70 T _vsgi_server_listen_socket
0000000000022e50 T _vsgi_server_module_construct
0000000000022fd0 T _vsgi_server_module_get_directory
0000000000023040 T _vsgi_server_module_get_name
00000000000230b0 T _vsgi_server_module_get_path
0000000000023120 T _vsgi_server_module_get_server_type
0000000000022f30 T _vsgi_server_module_get_type
0000000000022f00 T _vsgi_server_module_new
0000000000024ad0 T _vsgi_server_new
0000000000024270 T _vsgi_server_new_valist
0000000000025500 T _vsgi_server_run
0000000000025680 T _vsgi_server_set_handler
0000000000024de0 T _vsgi_server_stop
0000000000026350 T _vsgi_socket_server_construct
0000000000026380 T _vsgi_socket_server_get_backlog
00000000000263f0 T _vsgi_socket_server_get_scheme
0000000000026460 T _vsgi_socket_server_get_type
00000000000262e0 T _vsgi_socket_server_incoming
0000000000022a40 T _vsgi_str_const_equal
0000000000027900 T _vsgi_tee_output_stream_construct
0000000000027ab0 T _vsgi_tee_output_stream_get_tee_stream
0000000000027a10 T _vsgi_tee_output_stream_get_type
00000000000279e0 T _vsgi_tee_output_stream_new

@arteymix
Copy link
Member

That's because the server library are actually in build/src/servers.

It sounds like a $RPATH issue. I've pushed another commit using Meson's build_rpath instead of linker flags. There's some details here that could be useful.

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

No branches or pull requests

3 participants