Saturday, March 05, 2011

Fixes to fbexport compilation on linux systems debian/ubuntu

It's easy to compile firebird export utility just download the version from sourceforge

cd fbexport-1.90
after that modify fbcopy/TableDependency.cpp
and add
#include <stdio.h>
to the include section otherwise you will get the error error: ‘printf’ was not declared in this scope
make should complete the job (of course you need the firebird headers , check if you have them installed with dpkg -L firebird2.5-dev)


 make
g++ -c -O1 -DIBPP_LINUX -DIBPP_GCC -Iibpp -o fbcopy/args.o fbcopy/args.cpp
g++ -c -O1 -DIBPP_LINUX -DIBPP_GCC -Iibpp -o fbcopy/fbcopy.o fbcopy/fbcopy.cpp
g++ -c -O1 -DIBPP_LINUX -DIBPP_GCC -Iibpp -o fbcopy/TableDependency.o fbcopy/TableDependency.cpp
g++ -c -O1 -DIBPP_LINUX -DIBPP_GCC -Iibpp -o fbcopy/main.o fbcopy/main.cpp
g++ -c -O1 -DIBPP_LINUX -DIBPP_GCC -Iibpp -o ibpp/all_in_one.o ibpp/all_in_one.cpp
g++ -pthread -lfbclient ibpp/all_in_one.o fbcopy/args.o fbcopy/fbcopy.o fbcopy/TableDependency.o fbcopy/main.o  -oexe/fbcopy
g++ -c -O1 -DIBPP_LINUX -DIBPP_GCC -Iibpp -o fbexport/ParseArgs.o fbexport/ParseArgs.cpp
g++ -c -O1 -DIBPP_LINUX -DIBPP_GCC -Iibpp -o fbexport/FBExport.o fbexport/FBExport.cpp
g++ -c -O1 -DIBPP_LINUX -DIBPP_GCC -Iibpp -o fbexport/cli-main.o fbexport/cli-main.cpp
g++ -pthread -lfbclient ibpp/all_in_one.o fbexport/ParseArgs.o fbexport/FBExport.o fbexport/cli-main.o -oexe/fbexport



and the binary is in exe dir


exe/fbexport
--------------------------------
FBExport v1.80 by Milan Babuskov (mbabuskov), using IBPP 2.5.3.0
Tool for importing/exporting data with Firebird and InterBase databases.
Usage: fbexport -[S|Sc|Si|Sh|I|If|X|L] Options

 -S  Select = output to file  (S - binary, Si - INSERTs, Sc - CSV, Sh - HTML)
 -I  Insert = input from file
 -If Insert by Full SQL = input from file, by parameterized SQL
 -X  eXecute SQL statement, use with -F to execute sql scripts
 -L  List connected users

Options are:                           -H Host          [LOCALHOST]
 -D Database                           -U Username      [SYSDBA]
 -F Filename (use - for stdout)        -O Role
 -P Password                           -T Trim chars    [off]
 -A "Charset"                          -J "Date format" [D.M.Y]
 -Q "SQL Query statement"              -K "Time format" [H:M:S]
 -C # = Checkpoint at # rows [1000]    -M Commit at each checkpoint [off]
 -E # = Ignore up to # errors [0] Set to -1 to ignore all
 -R Rollback transaction if any errors occur while importing [off]
 -V Table = Verbatim copy of table (use -Q to set where clause if desired)
 -B Separator [,] = Field separator for CSV export. Allows special value: TAB
Command-line options are not case-sensitive (except the TAB setting)


Update
I have added a few more fixes in this fork on the github (related to linking errors) and included the compiling fixes from above 


4 comments:

Unknown said...

Hi, I have error:

g++ -pthread -lfbclient ibpp/all_in_one.o fbcopy/args.o fbcopy/fbcopy.o fbcopy/TableDependency.o fbcopy/main.o -oexe/fbcopy
ibpp/all_in_one.o: In function `ibpp_internals::GDS::Call()':
all_in_one.cpp:(.text+0x5a5): undefined reference to `isc_create_database'
all_in_one.cpp:(.text+0x5ad): undefined reference to `isc_attach_database'
all_in_one.cpp:(.text+0x5b5): undefined reference to `isc_detach_database'
all_in_one.cpp:(.text+0x5bd): undefined reference to `isc_drop_database'
all_in_one.cpp:(.text+0x5c5): undefined reference to `isc_database_info'
all_in_one.cpp:(.text+0x5cd): undefined reference to `isc_open_blob2'
all_in_one.cpp:(.text+0x5d5): undefined reference to `isc_create_blob2'
all_in_one.cpp:(.text+0x5dd): undefined reference to `isc_close_blob'
all_in_one.cpp:(.text+0x5e5): undefined reference to `isc_cancel_blob'
all_in_one.cpp:(.text+0x5ed): undefined reference to `isc_get_segment'
all_in_one.cpp:(.text+0x5f5): undefined reference to `isc_put_segment'
all_in_one.cpp:(.text+0x5fd): undefined reference to `isc_blob_info'
all_in_one.cpp:(.text+0x605): undefined reference to `isc_array_lookup_bounds'
all_in_one.cpp:(.text+0x60d): undefined reference to `isc_array_get_slice'
all_in_one.cpp:(.text+0x618): undefined reference to `isc_array_put_slice'
all_in_one.cpp:(.text+0x623): undefined reference to `isc_vax_integer'
all_in_one.cpp:(.text+0x62e): undefined reference to `isc_sqlcode'
all_in_one.cpp:(.text+0x639): undefined reference to `isc_sql_interprete'
all_in_one.cpp:(.text+0x644): undefined reference to `isc_interprete'
all_in_one.cpp:(.text+0x64f): undefined reference to `isc_que_events'
all_in_one.cpp:(.text+0x65a): undefined reference to `isc_cancel_events'
all_in_one.cpp:(.text+0x665): undefined reference to `isc_start_multiple'
all_in_one.cpp:(.text+0x670): undefined reference to `isc_commit_transaction'
all_in_one.cpp:(.text+0x67b): undefined reference to `isc_commit_retaining'
all_in_one.cpp:(.text+0x686): undefined reference to `isc_rollback_transaction'
all_in_one.cpp:(.text+0x691): undefined reference to `isc_rollback_retaining'
all_in_one.cpp:(.text+0x699): undefined reference to `isc_dsql_execute_immediate'
all_in_one.cpp:(.text+0x6a4): undefined reference to `isc_dsql_allocate_statement'
all_in_one.cpp:(.text+0x6af): undefined reference to `isc_dsql_describe'
all_in_one.cpp:(.text+0x6ba): undefined reference to `isc_dsql_describe_bind'
all_in_one.cpp:(.text+0x6c5): undefined reference to `isc_dsql_prepare'
all_in_one.cpp:(.text+0x6d0): undefined reference to `isc_dsql_execute'
all_in_one.cpp:(.text+0x6db): undefined reference to `isc_dsql_execute2'
all_in_one.cpp:(.text+0x6e6): undefined reference to `isc_dsql_fetch'
all_in_one.cpp:(.text+0x6f1): undefined reference to `isc_dsql_free_statement'
all_in_one.cpp:(.text+0x6fc): undefined reference to `isc_dsql_set_cursor_name'
all_in_one.cpp:(.text+0x707): undefined reference to `isc_dsql_sql_info'
all_in_one.cpp:(.text+0x712): undefined reference to `isc_service_attach'
all_in_one.cpp:(.text+0x71d): undefined reference to `isc_service_detach'
all_in_one.cpp:(.text+0x728): undefined reference to `isc_service_start'
all_in_one.cpp:(.text+0x733): undefined reference to `isc_service_query'
collect2: ld returned 1 exit status
make: ** [exe/fbcopy] Erro 1


Popa Adrian Marius said...

Hello please check the github version with fixes in the Makefile


exe/fbexport: $(OBJECTS_FBE) ibpp/all_in_one.o
g++ ibpp/all_in_one.o $(OBJECTS_FBE) -oexe/fbexport $(LINK_FLAGS)


https://github.com/mariuz/fbexport

Unknown said...

Hi, there are any issues with the negative values handled by fbexport during .fbx file creation. For example, if a value is -1, it will be translated in 4294967295, producing a numeric exception error during import operations.
My .fbx export file is in "INSERT INTO" format.
Thanks for your help.

tbogard said...

Excellent tip, it fixed my issues in ubuntu 10.04