Skip to content

Trouble compile SQLPage on FreeBSD because of ODBC #1216

@E8y2FqZE

Description

@E8y2FqZE

Introduction

I'm trying to install SQLPage on FreeBSD in a managed hosting environment where I cannot install system packages. FreeBSD binaries are not provided here on GitHub, so I need to compile it myself. Cargo is available and an old version of SQLPage compiled just fine. Now, I'm getting errors with the latest version. I'm only using SQLite, so if there's a flag to disable ODBC entirely, that would be beneficial.

To Reproduce

RUSTFLAGS="-C codegen-units=1" cargo install sqlpage --version 0.42.0

Successfully compiles all packages except sqlpage and then produces the following error at the end when linking:

error: linking with `cc` failed: exit status: 1
  |
  = note:  "cc" "-m64" "/home/tmp/rustclB7aYi/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/home/tmp/cargo-installjJbC1y/release/deps/{libenv_lo...

(... snip ...)
  = note: ld: error: unable to find library -lodbc
          cc: error: linker command failed with exit code 1 (use -v to see invocation)
          

error: could not compile `sqlpage` (bin "sqlpage") due to 1 previous error

I'm not allowed to modify this environment and install libodbc because it's a managed/shared web hosting environment. So I tried compiling with the --features odbc-static flag:

RUSTFLAGS="-C codegen-units=1" cargo install sqlpage --version 0.42.0 --features odbc-static

Which produced this error:

warning: unix-odbc@0.1.4: unixODBC/DriverManager/SQLConnect.c:2397:16: error: use of undeclared identifier 'SHLIBEXT'
warning: unix-odbc@0.1.4:  2397 |                 if ( strlen( SHLIBEXT ) == 0 ) 
warning: unix-odbc@0.1.4:       |                              ^
warning: unix-odbc@0.1.4: unixODBC/DriverManager/SQLConnect.c:2403:26: error: use of undeclared identifier 'SHLIBEXT'
warning: unix-odbc@0.1.4:  2403 |             if ( strlen( SHLIBEXT ) + 1 > sizeof( ext )) {
warning: unix-odbc@0.1.4:       |                          ^
warning: unix-odbc@0.1.4: unixODBC/DriverManager/SQLConnect.c:2404:126: error: use of undeclared identifier 'SHLIBEXT'
warning: unix-odbc@0.1.4:  2404 |                 fprintf( stderr, "internal error, unexpected SHLIBEXT value ('%s') may indicate a problem with configure\n", SHLIBEXT );
warning: unix-odbc@0.1.4:       |                                                                                                                              ^
warning: unix-odbc@0.1.4: unixODBC/DriverManager/SQLConnect.c:2407:17: error: use of undeclared identifier 'SHLIBEXT'
warning: unix-odbc@0.1.4:  2407 |                         strcpy( ext, SHLIBEXT );
warning: unix-odbc@0.1.4:       |                                      ^
warning: unix-odbc@0.1.4: 4 errors generated.
warning: unix-odbc@0.1.4: ToolExecError: command did not execute successfully (status code exit status: 1): LC_ALL="C" "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "--target=x86_64-unknown-freebsd" "-I" "unixODBC" "-I" "." "-I" "unixODBC/include" "-I" "unixODBC/DriverManager" "-I" "unixODBC/odbcinst" "-I" "unixODBC/ini" "-I" "unixODBC/log" "-I" "unixODBC/lst" "-w" "-std=gnu99" "-Wno-pointer-to-int-cast" "-DVERSION=\"2.3.14\"" "-o" "/home/tmp/cargo-installjJbC1y/release/build/unix-odbc-8d19521d980d53fa/out/f9d8b71948dc8572-SQLConnect.o" "-c" "unixODBC/DriverManager/SQLConnect.c"
warning: unix-odbc@0.1.4: unixODBC/odbcinst/SQLManageDataSources.c:83:18: error: use of undeclared identifier 'SHLIBEXT'
warning: unix-odbc@0.1.4:    83 |     if ( strlen( SHLIBEXT ) > 0 )
warning: unix-odbc@0.1.4:       |                  ^
warning: unix-odbc@0.1.4: unixODBC/odbcinst/SQLManageDataSources.c:84:56: error: use of undeclared identifier 'SHLIBEXT'
warning: unix-odbc@0.1.4:    84 |         sprintf( pszNameAndExtension, "%s%s", pszName, SHLIBEXT );
warning: unix-odbc@0.1.4:       |                                                        ^
warning: unix-odbc@0.1.4: unixODBC/odbcinst/SQLManageDataSources.c:104:18: error: use of undeclared identifier 'DEFLIB_PATH'
warning: unix-odbc@0.1.4:   104 |     if ( strlen( DEFLIB_PATH ) > 0 )
warning: unix-odbc@0.1.4:       |                  ^
warning: unix-odbc@0.1.4: unixODBC/odbcinst/SQLManageDataSources.c:105:43: error: use of undeclared identifier 'DEFLIB_PATH'
warning: unix-odbc@0.1.4:   105 |         sprintf( pszPathAndName, "%s/%s", DEFLIB_PATH, pszName );
warning: unix-odbc@0.1.4:       |                                           ^
warning: unix-odbc@0.1.4: 4 errors generated.
warning: unix-odbc@0.1.4: ToolExecError: command did not execute successfully (status code exit status: 1): LC_ALL="C" "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "--target=x86_64-unknown-freebsd" "-I" "unixODBC" "-I" "." "-I" "unixODBC/include" "-I" "unixODBC/DriverManager" "-I" "unixODBC/odbcinst" "-I" "unixODBC/ini" "-I" "unixODBC/log" "-I" "unixODBC/lst" "-w" "-std=gnu99" "-Wno-pointer-to-int-cast" "-DVERSION=\"2.3.14\"" "-o" "/home/tmp/cargo-installjJbC1y/release/build/unix-odbc-8d19521d980d53fa/out/8bb190592743423f-SQLManageDataSources.o" "-c" "unixODBC/odbcinst/SQLManageDataSources.c"
error: failed to run custom build command for `unix-odbc v0.1.4`

Caused by:
  process didn't exit successfully: `/home/tmp/cargo-installjJbC1y/release/build/unix-odbc-e71f53ff6dc5a8ca/build-script-build` (exit status: 1)

Any ideas on how to disable ODBC entirely or appease the compiler here?

Version information

  • OS: FreeBSD 14.3-RELEASE-p5
  • Database: SQLite
  • SQLPage Version: v0.42.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions